Add test for html ignore directive

Closes #545
Closes #994
This commit is contained in:
Liam Newman 2018-08-11 21:57:25 -07:00
parent 6e8afc8406
commit c4f03cce7e
2 changed files with 71 additions and 0 deletions

View File

@ -3901,6 +3901,41 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
'</html>');
//============================================================
// ISSUE #575 and #994 Ignore directive works in html
reset_options();
set_name('ISSUE #575 and #994 Ignore directive works in html');
bth(
'<!-- beautify ignore:start -->\n' +
'@{\n' +
'\n' +
' ViewBag.Title = "Dashboard";\n' +
' string firstName = string.Empty;\n' +
' string userId = ViewBag.UserId;\n' +
'\n' +
' if( !string.IsNullOrEmpty(ViewBag.FirstName ) ) {\n' +
'\n' +
' firstName = "<h2>Hi " + ViewBag.FirstName + "</h2>";\n' +
'\n' +
' }\n' +
'\n' +
'}\n' +
'<!-- beautify ignore:end -->\n' +
'\n' +
'<header class="layout-header">\n' +
'\n' +
' <h2 id="logo"><a href="/">Logo</a></h2>\n' +
'\n' +
' <ul class="social">\n' +
'\n' +
' <li class="facebook"><a href="#">Facebook</a></li>\n' +
' <li class="twitter"><a href="#">Twitter</a></li>\n' +
'\n' +
' </ul>\n' +
'\n' +
'</header>');
//============================================================
// Issue 1478 - Space handling inside self closing tag
reset_options();

View File

@ -1010,6 +1010,42 @@ exports.test_data = {
'</html>'
]
}]
}, {
name: "ISSUE #575 and #994 Ignore directive works in html",
description: "",
options: [],
tests: [{
unchanged: [
'<!-- beautify ignore:start -->',
'@{',
'',
' ViewBag.Title = "Dashboard";',
' string firstName = string.Empty;',
' string userId = ViewBag.UserId;',
'',
' if( !string.IsNullOrEmpty(ViewBag.FirstName ) ) {',
'',
' firstName = "<h2>Hi " + ViewBag.FirstName + "</h2>";',
'',
' }',
'',
'}',
'<!-- beautify ignore:end -->',
'',
'<header class="layout-header">',
'',
' <h2 id="logo"><a href="/">Logo</a></h2>',
'',
' <ul class="social">',
'',
' <li class="facebook"><a href="#">Facebook</a></li>',
' <li class="twitter"><a href="#">Twitter</a></li>',
'',
' </ul>',
'',
'</header>'
]
}]
}, {
name: "Issue 1478 - Space handling inside self closing tag",
description: "Properly indent following text after self closing tags regardless of space",