Add tests for #1233

Fixes #1233
This commit is contained in:
Liam Newman 2019-05-01 16:05:25 -07:00
parent a4aa9bb079
commit d299a74670
3 changed files with 181 additions and 24 deletions

View File

@ -10556,6 +10556,23 @@ function run_css_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_bea
' color: red;\n' +
'}');
// Issue #1233
t(
'.one {\n' +
' color: #FFF;\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'.two {\n' +
' color: #000;\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}');
//============================================================
// Regresssion Tests
@ -10578,9 +10595,9 @@ function run_css_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_bea
//============================================================
// Issue #645
// Issue #645, #1233
reset_options();
set_name('Issue #645');
set_name('Issue #645, #1233');
opts.selector_separator_newline = true;
opts.preserve_newlines = true;
opts.newline_between_rules = true;
@ -10602,6 +10619,39 @@ function run_css_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_bea
'}\n' +
'\n' +
'/* Comment after last rule */');
t(
'.one {\n' +
' color: #FFF;\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'.two {\n' +
' color: #000;\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}',
// -- output --
'.one {\n' +
' color: #FFF;\n' +
'\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'\n' +
'.two {\n' +
' color: #000;\n' +
'\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}');
//============================================================

View File

@ -10439,6 +10439,23 @@ class CSSBeautifierTest(unittest.TestCase):
' color: red;\n' +
'}')
# Issue #1233
t(
'.one {\n' +
' color: #FFF;\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'.two {\n' +
' color: #000;\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}')
#============================================================
# Regresssion Tests
@ -10460,7 +10477,7 @@ class CSSBeautifierTest(unittest.TestCase):
#============================================================
# Issue #645
# Issue #645, #1233
self.reset_options()
self.options.selector_separator_newline = true
self.options.preserve_newlines = true
@ -10483,6 +10500,39 @@ class CSSBeautifierTest(unittest.TestCase):
'}\n' +
'\n' +
'/* Comment after last rule */')
t(
'.one {\n' +
' color: #FFF;\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'.two {\n' +
' color: #000;\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}',
# -- output --
'.one {\n' +
' color: #FFF;\n' +
'\n' +
' // pseudo-element\n' +
' span:not(*::selection) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}\n' +
'\n' +
'.two {\n' +
' color: #000;\n' +
'\n' +
' // pseudo-class\n' +
' span:not(*:active) {\n' +
' margin-top: 0;\n' +
' }\n' +
'}')
#============================================================

View File

@ -1361,6 +1361,25 @@ exports.test_data = {
' color: red;',
'}'
]
},
{
comment: "Issue #1233",
unchanged: [
'.one {',
' color: #FFF;',
' // pseudo-element',
' span:not(*::selection) {',
' margin-top: 0;',
' }',
'}',
'.two {',
' color: #000;',
' // pseudo-class',
' span:not(*:active) {',
' margin-top: 0;',
' }',
'}'
]
}
]
}, {
@ -1386,7 +1405,7 @@ exports.test_data = {
]
}]
}, {
name: "Issue #645",
name: "Issue #645, #1233",
description: "",
options: [
{ name: "selector_separator_newline", value: "true" },
@ -1414,7 +1433,45 @@ exports.test_data = {
'',
'/* Comment after last rule */'
]
}]
},
{
input: [
'.one {',
' color: #FFF;',
' // pseudo-element',
' span:not(*::selection) {',
' margin-top: 0;',
' }',
'}',
'.two {',
' color: #000;',
' // pseudo-class',
' span:not(*:active) {',
' margin-top: 0;',
' }',
'}'
],
output: [
'.one {',
' color: #FFF;',
'',
' // pseudo-element',
' span:not(*::selection) {',
' margin-top: 0;',
' }',
'}',
'',
'.two {',
' color: #000;',
'',
' // pseudo-class',
' span:not(*:active) {',
' margin-top: 0;',
' }',
'}'
]
}
]
}, {
name: "Extend Tests",
description: "Test for '@extend'",