mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-27 06:30:32 +00:00
More test for fixed issues
Fixes #882 Fixes #1041 Fixes #1167 Fixes #1184
This commit is contained in:
parent
48539e2a20
commit
07d746b57c
@ -3070,7 +3070,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
|
||||
|
||||
|
||||
//============================================================
|
||||
// default content_unformatted
|
||||
// default content_unformatted and inline element test
|
||||
reset_options();
|
||||
test_fragment(
|
||||
'<html><body><h1>A</h1><script>if(1){f();}</script><style>.a{display:none;}</style></body></html>',
|
||||
@ -3135,6 +3135,46 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
|
||||
'var b=a;\n' +
|
||||
'</pre>\n' +
|
||||
'</div>');
|
||||
|
||||
// Test for #1041
|
||||
test_fragment(
|
||||
'<p><span class="foo">foo <span class="bar">bar</span></span></p>\n' +
|
||||
'\n' +
|
||||
'<aside><p class="foo">foo <span class="bar">bar</span></p></aside>\n' +
|
||||
'<p class="foo"><span class="bar">bar</span></p>',
|
||||
// -- output --
|
||||
'<p><span class="foo">foo <span class="bar">bar</span></span></p>\n' +
|
||||
'\n' +
|
||||
'<aside>\n' +
|
||||
' <p class="foo">foo <span class="bar">bar</span></p>\n' +
|
||||
'</aside>\n' +
|
||||
'<p class="foo"><span class="bar">bar</span></p>');
|
||||
|
||||
// Test for #1167
|
||||
test_fragment(
|
||||
'<span>\n' +
|
||||
' <span><img src="images/off.svg" alt=""></span>\n' +
|
||||
' <span><img src="images/on.svg" alt=""></span>\n' +
|
||||
'</span>');
|
||||
|
||||
// Test for #882
|
||||
test_fragment(
|
||||
'<tr><th><h3>Name</h3></th><td class="full-width"></td></tr>',
|
||||
// -- output --
|
||||
'<tr>\n' +
|
||||
' <th>\n' +
|
||||
' <h3>Name</h3>\n' +
|
||||
' </th>\n' +
|
||||
' <td class="full-width"></td>\n' +
|
||||
'</tr>');
|
||||
|
||||
// Test for #1184
|
||||
test_fragment(
|
||||
'<div><div></div>Connect</div>',
|
||||
// -- output --
|
||||
'<div>\n' +
|
||||
' <div></div>Connect\n' +
|
||||
'</div>');
|
||||
|
||||
|
||||
//============================================================
|
||||
|
@ -1146,7 +1146,7 @@ exports.test_data = {
|
||||
]
|
||||
}]
|
||||
}, {
|
||||
name: "default content_unformatted",
|
||||
name: "default content_unformatted and inline element test",
|
||||
description: "",
|
||||
options: [],
|
||||
tests: [{
|
||||
@ -1218,6 +1218,53 @@ exports.test_data = {
|
||||
'</pre>',
|
||||
'</div>'
|
||||
]
|
||||
}, {
|
||||
comment: "Test for #1041",
|
||||
fragment: true,
|
||||
input: [
|
||||
'<p><span class="foo">foo <span class="bar">bar</span></span></p>',
|
||||
'',
|
||||
'<aside><p class="foo">foo <span class="bar">bar</span></p></aside>',
|
||||
'<p class="foo"><span class="bar">bar</span></p>'
|
||||
],
|
||||
output: [
|
||||
'<p><span class="foo">foo <span class="bar">bar</span></span></p>',
|
||||
'',
|
||||
'<aside>',
|
||||
' <p class="foo">foo <span class="bar">bar</span></p>',
|
||||
'</aside>',
|
||||
'<p class="foo"><span class="bar">bar</span></p>'
|
||||
]
|
||||
}, {
|
||||
comment: "Test for #1167",
|
||||
fragment: true,
|
||||
unchanged: [
|
||||
'<span>',
|
||||
' <span><img src="images/off.svg" alt=""></span>',
|
||||
' <span><img src="images/on.svg" alt=""></span>',
|
||||
'</span>'
|
||||
]
|
||||
}, {
|
||||
comment: "Test for #882",
|
||||
fragment: true,
|
||||
input: '<tr><th><h3>Name</h3></th><td class="full-width"></td></tr>',
|
||||
output: [
|
||||
'<tr>',
|
||||
' <th>',
|
||||
' <h3>Name</h3>',
|
||||
' </th>',
|
||||
' <td class="full-width"></td>',
|
||||
'</tr>'
|
||||
]
|
||||
}, {
|
||||
comment: "Test for #1184",
|
||||
fragment: true,
|
||||
input: '<div><div></div>Connect</div>',
|
||||
output: [
|
||||
'<div>',
|
||||
' <div></div>Connect',
|
||||
'</div>'
|
||||
]
|
||||
}]
|
||||
}, {
|
||||
name: "New Test Suite"
|
||||
|
Loading…
Reference in New Issue
Block a user