public void WhenCompileHtmlWithSingleQuotesInDataBindAttribute_ThenSingleQuotesAreNotEscaped()
        {
            var compiler = new KnockoutJQueryTmplCompiler();
            var output   = compiler.Compile("<div data-bind=\"test: 'a'\"></div>", Mock.Of <IFile>());

            output.ShouldEqual(@"function(jQuery, $item) {var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('');__.push(((function() { return ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() {                     return (function() { return { test: 'a' } })()                 }) })()) || '');__.push('<div ></div>');}return __;}");
        }
Esempio n. 2
0
 public void WhenCompileHtmlWithSingleQuotes_ThenSingleQuotesAreEscaped()
 {
     var compiler = new KnockoutJQueryTmplCompiler();
     var result = compiler.Compile("<div id='a'></div>", new CompileContext());
     result.Output.ShouldEqual(
         @"function(jQuery, $item) {var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('<div id=\'a\'></div>');}return __;}"
     );
 }
Esempio n. 3
0
        public void WhenCompileHtmlWithSingleQuotes_ThenSingleQuotesAreEscaped()
        {
            var compiler = new KnockoutJQueryTmplCompiler();
            var output   = compiler.Compile("<div id='a'></div>", Mock.Of <IFile>());

            output.ShouldEqual(
                @"function(jQuery, $item) {var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('<div id=\'a\'></div>');}return __;}"
                );
        }
 public void WhenCompileHtmlWithSingleQuotesInDataBindAttribute_ThenSingleQuotesAreNotEscaped()
 {
     var compiler = new KnockoutJQueryTmplCompiler();
     var result = compiler.Compile("<div data-bind=\"test: 'a'\"></div>", new CompileContext());
     result.Output.ShouldEqual(@"function(jQuery, $item) {var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('');__.push(((function() { return ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() {                     return (function() { return { test: 'a' } })()                 }) })()) || '');__.push('<div ></div>');}return __;}");
 }