예제 #1
0
		public void Render ()
		{
			HoverBehavior b = new HoverBehavior ();
			StringWriter sw;
			ScriptTextWriter w;

			sw = new StringWriter();
			w = new ScriptTextWriter (sw);

			b.HoverElementID = "hi";
			b.UnhoverDelay = 100;

			((IScriptComponent)b).RenderScript (w);

			Assert.AreEqual ("", sw.ToString(), "A1");
		}
예제 #2
0
		public void Properties ()
		{
			HoverBehavior b = new HoverBehavior ();

			// default
			Assert.AreEqual ("hoverBehavior", b.TagName, "A1");
			Assert.AreEqual ("", b.HoverElementID, "A2");
			Assert.AreEqual (0, b.UnhoverDelay, "A3");

			// getter/setter
			b.HoverElementID = "hi";
			Assert.AreEqual ("hi", b.HoverElementID, "A4");
			b.UnhoverDelay = 5;
			Assert.AreEqual (5, b.UnhoverDelay, "A5");
			// XXX negative delay?
		}
예제 #3
0
		public void IsTypeDescriptorClosed ()
		{
			HoverBehavior a = new HoverBehavior();
			ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();

			desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
		}
예제 #4
0
		public void TypeDescriptor ()
		{
			HoverBehavior a = new HoverBehavior();
			ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor ();

			Assert.AreEqual (a, desc.ScriptObject, "A1");

			// events
			IEnumerable<ScriptEventDescriptor> events = desc.GetEvents();
			Assert.IsNotNull (events, "A2");

			IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator();
			Assert.IsTrue (ee.MoveNext(), "A3");
			DoEvent (ee.Current, "propertyChanged", true);
			Assert.IsTrue (ee.MoveNext(), "A3");
			DoEvent (ee.Current, "hover", true);
			Assert.IsTrue (ee.MoveNext(), "A4");
			DoEvent (ee.Current, "unhover", true);
			Assert.IsFalse (ee.MoveNext(), "A5");

			// methods
			IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods();
			Assert.IsNotNull (methods, "A6");

			IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator();
			Assert.IsFalse (me.MoveNext ());

			// properties
			IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties();
			Assert.IsNotNull (props, "A7");

			IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator();
			Assert.IsTrue (pe.MoveNext(), "A8");
			DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings");
			Assert.IsTrue (pe.MoveNext(), "A9");
			DoProperty (pe.Current, "dataContext", ScriptType.Object, false, "");
			Assert.IsTrue (pe.MoveNext(), "A10");
			DoProperty (pe.Current, "id", ScriptType.String, false, "ID");
			Assert.IsTrue (pe.MoveNext(), "A11");
			DoProperty (pe.Current, "hoverElement", ScriptType.Object, false, "");
			Assert.IsTrue (pe.MoveNext(), "A12");
			DoProperty (pe.Current, "unhoverDelay", ScriptType.Number, false, "UnhoverDelay");
			Assert.IsFalse (pe.MoveNext(), "A13");
		}