mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-26 22:20:56 +00:00
Add test for wrapping negative expressions that end a line
This commit is contained in:
parent
a1bfc0589d
commit
e3979f51fd
@ -5642,20 +5642,22 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
|
||||
|
||||
|
||||
//============================================================
|
||||
// Indent with tabs
|
||||
// Linewrap length
|
||||
reset_options();
|
||||
set_name('Indent with tabs');
|
||||
opts.indent_with_tabs = true;
|
||||
set_name('Linewrap length');
|
||||
opts.wrap_line_length = 40;
|
||||
|
||||
// Issue #740 -- Negative values ending a line are wrapped as a unit
|
||||
test_fragment(
|
||||
'<div>\n' +
|
||||
'<div>\n' +
|
||||
'</div>\n' +
|
||||
'</div>',
|
||||
'return someLongExpressionThatGe !== -1;\n' +
|
||||
'return someLongExpressionThatGet !== -10;\n' +
|
||||
'return someLongExpressionThatGet !== -100;',
|
||||
// -- output --
|
||||
'<div>\n' +
|
||||
'\t<div>\n' +
|
||||
'\t</div>\n' +
|
||||
'</div>');
|
||||
'return someLongExpressionThatGe !== -1;\n' +
|
||||
'return someLongExpressionThatGet !==\n' +
|
||||
'-10;\n' +
|
||||
'return someLongExpressionThatGet !==\n' +
|
||||
'-100;');
|
||||
|
||||
|
||||
//============================================================
|
||||
|
@ -1723,22 +1723,25 @@ exports.test_data = {
|
||||
]
|
||||
}]
|
||||
}, {
|
||||
name: "Indent with tabs",
|
||||
description: "Use one tab instead of several spaces for indentation",
|
||||
template: "^^^ $$$",
|
||||
options: [
|
||||
{ name: "indent_with_tabs", value: "true" }
|
||||
],
|
||||
name: "Linewrap length",
|
||||
description: "",
|
||||
options: [{ name: "wrap_line_length", value: "40" }],
|
||||
tests: [{
|
||||
comment: "Issue #740 -- Negative values ending a line are wrapped as a unit",
|
||||
fragment: true,
|
||||
input_: '<div>\n' +
|
||||
'<div>\n' +
|
||||
'</div>\n' +
|
||||
'</div>',
|
||||
output: '<div>\n' +
|
||||
'\t<div>\n' +
|
||||
'\t</div>\n' +
|
||||
'</div>'
|
||||
input: [
|
||||
'return someLongExpressionThatGe !== -1;',
|
||||
'return someLongExpressionThatGet !== -10;',
|
||||
'return someLongExpressionThatGet !== -100;'
|
||||
],
|
||||
//.---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10--------11--------12--------13--------14--------15--------16--------17--------18--------19--------20--------21--------22--------23--------24--------25--------26--------27--------28--------29
|
||||
output: [
|
||||
'return someLongExpressionThatGe !== -1;',
|
||||
'return someLongExpressionThatGet !==',
|
||||
'-10;',
|
||||
'return someLongExpressionThatGet !==',
|
||||
'-100;'
|
||||
]
|
||||
}]
|
||||
}, {
|
||||
name: "Indent without tabs",
|
||||
|
Loading…
Reference in New Issue
Block a user