Skip to content

Commit

Permalink
Add test for html ignore directive
Browse files Browse the repository at this point in the history
Closes #545
Closes #994
  • Loading branch information
bitwiseman committed Aug 12, 2018
1 parent 6e8afc8 commit c4f03cc
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
35 changes: 35 additions & 0 deletions js/test/generated/beautify-html-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
36 changes: 36 additions & 0 deletions test/data/html/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c4f03cc

Please sign in to comment.