-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
css colon character fix port to python
- Loading branch information
1 parent
d030e1c
commit 57bc806
Showing
3 changed files
with
106 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2215,7 +2215,7 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify, html_beautify, | |
btc("#bla, #foo{color:red}", "#bla,\n#foo {\n\tcolor: red\n}"); | ||
btc("@media print {.tab{}}", "@media print {\n\t.tab {}\n}"); | ||
btc("@media print {.tab{background-image:url([email protected])}}", "@media print {\n\t.tab {\n\t\tbackground-image: url([email protected])\n\t}\n}"); | ||
|
||
//lead-in whitespace determines base-indent. | ||
// lead-in newlines are stripped. | ||
btc("\n\na, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ def testBasics(self): | |
t(".tabs{background:url('back.jpg')}", ".tabs {\n\tbackground: url('back.jpg')\n}") | ||
t("#bla, #foo{color:red}", "#bla,\n#foo {\n\tcolor: red\n}") | ||
t("@media print {.tab{}}", "@media print {\n\t.tab {}\n}") | ||
t("@media print {.tab{background-image:url([email protected])}}", "@media print {\n\t.tab {\n\t\tbackground-image: url([email protected])\n\t}\n}") | ||
|
||
# may not eat the space before "[" | ||
t('html.js [data-custom="123"] {\n\topacity: 1.00;\n}') | ||
|
@@ -46,6 +47,7 @@ def testBasics(self): | |
t(" \t \na, img {padding: 0.2px}", " \t a,\n \t img {\n \t \tpadding: 0.2px\n \t }") | ||
t("\n\n a, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}") | ||
|
||
|
||
def testComments(self): | ||
self.resetOptions() | ||
t = self.decodesto | ||
|
@@ -71,6 +73,34 @@ def testSeperateSelectors(self): | |
t("#bla, #foo{color:red}", "#bla,\n#foo {\n\tcolor: red\n}") | ||
t("a, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}") | ||
|
||
|
||
def testBlockNesting(self): | ||
self.resetOptions() | ||
t = self.decodesto | ||
|
||
t("#foo {\n\tbackground-image: url([email protected]);\n\t@font-face {\n\t\tfont-family: 'Bitstream Vera Serif Bold';\n\t\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n\t}\n}") | ||
t("@media screen {\n\t#foo:hover {\n\t\tbackground-image: url([email protected]);\n\t}\n\t@font-face {\n\t\tfont-family: 'Bitstream Vera Serif Bold';\n\t\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n\t}\n}") | ||
|
||
# @font-face { | ||
# font-family: 'Bitstream Vera Serif Bold'; | ||
# src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf'); | ||
# } | ||
# @media screen { | ||
# #foo:hover { | ||
# background-image: url(foo.png); | ||
# } | ||
# @media screen and (min-device-pixel-ratio: 2) { | ||
# @font-face { | ||
# font-family: 'Helvetica Neue' | ||
# } | ||
# #foo:hover { | ||
# background-image: url([email protected]); | ||
# } | ||
# } | ||
# } | ||
t("@font-face {\n\tfont-family: 'Bitstream Vera Serif Bold';\n\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n}\n@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo.png);\n\t}\n\t@media screen and (min-device-pixel-ratio: 2) {\n\t\t@font-face {\n\t\t\tfont-family: 'Helvetica Neue'\n\t\t}\n\t\t#foo:hover {\n\t\t\tbackground-image: url([email protected]);\n\t\t}\n\t}\n}") | ||
|
||
|
||
def testOptions(self): | ||
self.resetOptions() | ||
self.options.indent_size = 2 | ||
|
@@ -80,8 +110,21 @@ def testOptions(self): | |
|
||
t("#bla, #foo{color:green}", "#bla, #foo {\n color: green\n}") | ||
t("@media print {.tab{}}", "@media print {\n .tab {}\n}") | ||
t("@media print {.tab,.bat{}}", "@media print {\n .tab, .bat {}\n}") | ||
t("#bla, #foo{color:black}", "#bla, #foo {\n color: black\n}") | ||
|
||
# pseudo-classes and pseudo-elements | ||
t("#foo:hover {\n background-image: url([email protected])\n}") | ||
t("#foo *:hover {\n color: purple\n}") | ||
t("::selection {\n color: #ff0000;\n}") | ||
|
||
# TODO: don't break nested pseduo-classes | ||
t("@media screen {.tab,.bat:hover {color:red}}", "@media screen {\n .tab, .bat:hover {\n color: red\n }\n}") | ||
|
||
# particular edge case with braces and semicolons inside tags that allows custom text | ||
t( "a:not(\"foobar\\\";{}omg\"){\ncontent: 'example\\';{} text';\ncontent: \"example\\\";{} text\";}", | ||
"a:not(\"foobar\\\";{}omg\") {\n content: 'example\\';{} text';\n content: \"example\\\";{} text\";\n}") | ||
|
||
def decodesto(self, input, expectation=None): | ||
if expectation == None: | ||
expectation = input | ||
|