derby-parsing
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"name": "derby-parsing", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Add HTML template parsing to Derby", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -19,3 +19,3 @@ var expect = require('expect.js'); | ||
, view: 'section' | ||
, html: '<b>Qua?</b>' | ||
, html: '<b class="foo">Qua?</b>' | ||
, tag: 'strong' | ||
@@ -195,3 +195,3 @@ } | ||
it('unescaped HTML', function() { | ||
test('<div>{{unescaped _page.html}}</div>', '<div><b>Qua?</b></div>'); | ||
test('<div>{{unescaped _page.html}}</div>', '<div><b class="foo">Qua?</b></div>'); | ||
}); | ||
@@ -527,2 +527,56 @@ | ||
it('HTML content escapes a literal view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="<b>Hi</b>"></view>'); | ||
views.register('partial', '{{@text}}'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<b>Hi</b>'); | ||
}); | ||
it('HTML content escapes a path expression view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="{{_page.html}}"></view>'); | ||
views.register('partial', '{{@text}}'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<b class="foo">Qua?</b>'); | ||
}); | ||
it('HTML content escapes a complex template view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="{{_page.html}} bar"></view>'); | ||
views.register('partial', '{{@text}}'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<b class="foo">Qua?</b> bar'); | ||
}); | ||
it('HTML attribute escapes a literal view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="<b class="foo">Hi</b>"></view>'); | ||
views.register('partial', '<div data-text="{{@text}}"></div>'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<div data-text="<b class="foo">Hi</b>"></div>'); | ||
}); | ||
it('HTML attribute escapes a path expression view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="{{_page.html}}"></view>'); | ||
views.register('partial', '<div data-text="{{@text}}"></div>'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<div data-text="<b class="foo">Qua?</b>"></div>'); | ||
}); | ||
it('HTML attribute escapes a complex template view attribute', function() { | ||
var views = new templates.Views(); | ||
context.meta.views = views; | ||
views.register('body', '<view is="partial" text="{{_page.html}} bar"></view>'); | ||
views.register('partial', '<div data-text="{{@text}}"></div>'); | ||
var view = views.find('body'); | ||
expect(view.get(context)).equal('<div data-text="<b class="foo">Qua?</b> bar"></div>'); | ||
}); | ||
}); |
77808
1979