Exemplo n.º 1
0
        public void Properties()
        {
            ClickBehavior b = new ClickBehavior();

            // default
            Assert.AreEqual("clickBehavior", b.TagName, "A1");
        }
Exemplo n.º 2
0
        public void IsTypeDescriptorClosed()
        {
            ClickBehavior        a    = new ClickBehavior();
            ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor();

            desc.AddEvent(new ScriptEventDescriptor("testEvent", true));
        }
Exemplo n.º 3
0
        public void Render()
        {
            ClickBehavior    c = new ClickBehavior();
            StringWriter     sw;
            ScriptTextWriter w;

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            ((IScriptComponent)c).RenderScript(w);

            Assert.AreEqual("", sw.ToString(), "A1");
        }
Exemplo n.º 4
0
        public void TypeDescriptor()
        {
            ClickBehavior        a    = new ClickBehavior();
            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(), "A4");
            DoEvent(ee.Current, "click", 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.IsFalse(pe.MoveNext(), "A11");
        }
Exemplo n.º 5
0
 public void AddBehavior(ClickBehavior clickBehavior)
 {
     ClickBehaviors.Add(clickBehavior);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Used to set an elements ClickBehavior attached property
        /// </summary>
        /// <param name="element"></param>
        /// <param name="b"></param>
        public static void SetClickBehavior(DependencyObject element, ClickBehavior b)
        {
            if (element == null)
             {
            throw new ArgumentNullException("element");
             }

             element.SetValue(AnimationBehaviorHost.ClickBehaviorProperty, b);
        }