Exemple #1
0
        static void InnerHTML_binding_With_longPropertyPath(Assert Assert)
        {
            var model = new Model
            {
                UserInfo = new UserInfoContract
                {
                    StringProperty0 = "Test1"
                }
            };

            var div             = DOM.CreateElement("div");
            var htmlBindingInfo = new HTMLBindingInfo
            {
                Source      = model,
                SourcePath  = "UserInfo.StringProperty0",
                Target      = div,
                TargetPath  = "innerHTML",
                BindingMode = BindingMode.OneWay
            };

            htmlBindingInfo.Connect();

            model.UserInfo.StringProperty0 = "A";

            Assert.AreEqual("A", div.Html());

            div = TestHelper.BuildAndGetFirstLogicalChild("<div>{UserInfo.StringProperty0}</div>", model).Root;

            Assert.AreEqual("A", div.Html());

            model.UserInfo.StringProperty0 = "B";

            Assert.AreEqual("B", div.Html());
        }
Exemple #2
0
        static void simpleBindingfor_src(Assert Assert)
        {
            var simpleClass1 = new SimpleClass1();

            var img             = DOM.CreateElement("img");
            var htmlBindingInfo = new HTMLBindingInfo
            {
                Source      = simpleClass1,
                SourcePath  = "LastName",
                Target      = img,
                TargetPath  = "src",
                BindingMode = BindingMode.OneWay
            };

            htmlBindingInfo.Connect();

            simpleClass1.LastName = TestHelper.SampleImageUrl_350_150;

            Assert.AreEqual(TestHelper.SampleImageUrl_350_150, img.Attr("src"));
        }