add body attributes tests

This commit is contained in:
Netanel Gilad
2015-01-12 00:33:34 +02:00
committed by Sashko Stubailo
parent 48ecdf1d54
commit fa4e9c676e
2 changed files with 4 additions and 6 deletions

View File

@@ -172,7 +172,7 @@ html_scanner = {
} else {
// <body>
if (hasAttribs) {
for(var attr in attribs) {p
for(var attr in attribs) {
if (this.bodyAttributes.indexOf(attr) !== -1) {
console.log('WARNING: tag ' + attr + ' already defined on body.');
}

View File

@@ -112,6 +112,9 @@ Tinytest.add("templating - html scanner", function (test) {
'pizza</template>'),
simpleTemplate('"the \\"cool\\" template"', '"pizza"'));
checkResults(html_scanner.scan('<body foo="bar">\n Hello\n</body>'),
"\nMeteor.startup(function() { $('body').attr({\"foo\":\"bar\"}); });\n" + simpleBody('"Hello"'));
// error cases; exact line numbers are not critical, these just reflect
// the current implementation
@@ -153,11 +156,6 @@ Tinytest.add("templating - html scanner", function (test) {
'<!doctype html>');
}, "DOCTYPE", 1);
// attributes on body not supported
checkError(function() {
return html_scanner.scan('<body foo="bar">\n Hello\n</body>');
}, "<body>", 1);
// attributes on head not supported
checkError(function() {
return html_scanner.scan('<head foo="bar">\n Hello\n</head>');