mirror of
https://github.com/beautifier/js-beautify.git
synced 2025-02-20 05:02:02 +00:00
Merge pull request #429 from bendman/master
fixing disabled line wrapping for HTML
This commit is contained in:
commit
181b6a17f3
@ -95,7 +95,7 @@
|
||||
|
||||
// backwards compatibility to 1.3.4
|
||||
if ((options.wrap_line_length === undefined || parseInt(options.wrap_line_length, 10) === 0) &&
|
||||
(options.max_char === undefined || parseInt(options.max_char, 10) === 0)) {
|
||||
(options.max_char !== undefined && parseInt(options.max_char, 10) !== 0)) {
|
||||
options.wrap_line_length = options.max_char;
|
||||
}
|
||||
|
||||
|
@ -1688,21 +1688,34 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify, html_beautify,
|
||||
bth('<div class=\'{{#if thingIs "value"}}content{{/if}}\'></div>');
|
||||
bth('<div class=\'{{#if thingIs \'value\'}}content{{/if}}\'></div>');
|
||||
|
||||
|
||||
opts.wrap_line_length = 0;
|
||||
//...---------1---------2---------3---------4---------5---------6---------7
|
||||
//...1234567890123456789012345678901234567890123456789012345678901234567890
|
||||
bth('<div>Some test text that should wrap_inside_this section here.</div>',
|
||||
bth('<div>Some text that should not wrap at all.</div>',
|
||||
/* expected */
|
||||
'<div>Some test text that should wrap_inside_this section here.</div>');
|
||||
'<div>Some text that should not wrap at all.</div>');
|
||||
|
||||
// A value of 0 means no max line length, and should not wrap.
|
||||
//...---------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
|
||||
//...12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
bth('<div>Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all.</div>',
|
||||
/* expected */
|
||||
'<div>Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all.</div>');
|
||||
|
||||
opts.wrap_line_length = "0";
|
||||
//...---------1---------2---------3---------4---------5---------6---------7
|
||||
//...1234567890123456789012345678901234567890123456789012345678901234567890
|
||||
bth('<div>Some test text that should wrap_inside_this section here.</div>',
|
||||
bth('<div>Some text that should not wrap at all.</div>',
|
||||
/* expected */
|
||||
'<div>Some test text that should wrap_inside_this section here.</div>');
|
||||
'<div>Some text that should not wrap at all.</div>');
|
||||
|
||||
// A value of "0" means no max line length, and should not wrap
|
||||
//...---------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
|
||||
//...12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
bth('<div>Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all.</div>',
|
||||
/* expected */
|
||||
'<div>Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all. Some text that should not wrap at all.</div>');
|
||||
|
||||
//BUGBUG: This should wrap before 40 not after.
|
||||
opts.wrap_line_length = 40;
|
||||
//...---------1---------2---------3---------4---------5---------6---------7
|
||||
@ -1712,7 +1725,7 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify, html_beautify,
|
||||
'<div>Some test text that should wrap_inside_this\n' +
|
||||
' section here.</div>');
|
||||
|
||||
opts.wrap_line_length = "40";
|
||||
opts.wrap_line_length = "40";
|
||||
//...---------1---------2---------3---------4---------5---------6---------7
|
||||
//...1234567890123456789012345678901234567890123456789012345678901234567890
|
||||
bth('<div>Some test text that should wrap_inside_this section here.</div>',
|
||||
|
Loading…
x
Reference in New Issue
Block a user