public void ContextTest03()
        {
            var viewContext = new ViewContext {
                Writer = new StringWriter()
            };
            var context = new KnockoutContext <TestModel>(viewContext);

            using (var subContext = context.Foreach(m => m.IntList))
            {
                string bind = subContext.Bind.Text(n => n + 1).BindingAttributeContent();
                AssertStringEquivalent("text:(parseInt($data)+parseInt(1))", bind);
            }
        }
Exemple #2
0
        public void ContextMethod1()
        {
            var viewContext = new ViewContext {
                Writer = new StringWriter()
            };
            var context = new KnockoutContext <TestAttributesModel2>(viewContext);

            using (var subContext = context.Foreach(m => m.IntList))
            {
                string bind = subContext.Bind.Method("test", m => context.Model.Method).BindingAttributeContent();
                AssertStringEquivalent("test: $parent.method", bind);
            }
        }
 public void ContextTest03()
 {
     var viewContext = new ViewContext { Writer = new StringWriter() };
       var context = new KnockoutContext<TestModel>(viewContext);
       using (var subContext = context.Foreach(m => m.IntList))
       {
     string bind = subContext.Bind.Text(n => n + 1).BindingAttributeContent();
     AssertStringEquivalent("text:(parseInt($data)+parseInt(1))", bind);
       }
 }