@@ -432,6 +432,47 @@ function testUnmatchedBracesInFile() {
432432 $ this ->assertSame ($ sExpected , $ oDoc ->render ());
433433 }
434434
435+ function testInvalidSelectorsInFile () {
436+ $ oDoc = $ this ->parsedStructureForFile ('invalid-selectors ' , Settings::create ()->withMultibyteSupport (true ));
437+ $ sExpected = '@keyframes mymove {from {top: 0px;}}
438+ #test {color: white;background: green;}
439+ #test {display: block;background: white;color: black;} ' ;
440+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
441+
442+ $ oDoc = $ this ->parsedStructureForFile ('invalid-selectors-2 ' , Settings::create ()->withMultibyteSupport (true ));
443+ $ sExpected = '@media only screen and (max-width: 1215px) {.breadcrumb {padding-left: 10px;}
444+ .super-menu > li:first-of-type {border-left-width: 0;}
445+ .super-menu > li:last-of-type {border-right-width: 0;}
446+ html[dir="rtl"] .super-menu > li:first-of-type {border-left-width: 1px;border-right-width: 0;}
447+ html[dir="rtl"] .super-menu > li:last-of-type {border-left-width: 0;}}
448+ body {background-color: red;} ' ;
449+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
450+ }
451+
452+ function testSelectorEscapesInFile () {
453+ $ oDoc = $ this ->parsedStructureForFile ('selector-escapes ' , Settings::create ()->withMultibyteSupport (true ));
454+ $ sExpected = '#\# {color: red;}
455+ .col-sm-1\/5 {width: 20%;} ' ;
456+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
457+
458+ $ oDoc = $ this ->parsedStructureForFile ('invalid-selectors-2 ' , Settings::create ()->withMultibyteSupport (true ));
459+ $ sExpected = '@media only screen and (max-width: 1215px) {.breadcrumb {padding-left: 10px;}
460+ .super-menu > li:first-of-type {border-left-width: 0;}
461+ .super-menu > li:last-of-type {border-right-width: 0;}
462+ html[dir="rtl"] .super-menu > li:first-of-type {border-left-width: 1px;border-right-width: 0;}
463+ html[dir="rtl"] .super-menu > li:last-of-type {border-left-width: 0;}}
464+ body {background-color: red;} ' ;
465+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
466+ }
467+
468+ function testSelectorIgnoresInFile () {
469+ $ oDoc = $ this ->parsedStructureForFile ('selector-ignores ' , Settings::create ()->withMultibyteSupport (true ));
470+ $ sExpected = '.some[selectors-may= \'contain-a-{ \'] {}
471+ .this-selector .valid {width: 100px;}
472+ @media only screen and (min-width: 200px) {.test {prop: val;}} ' ;
473+ $ this ->assertSame ($ sExpected , $ oDoc ->render ());
474+ }
475+
435476 /**
436477 * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
437478 */
@@ -501,7 +542,7 @@ function testCharsetFailure2() {
501542 * @expectedException \Sabberworm\CSS\Parsing\SourceException
502543 */
503544 function testUnopenedClosingBracketFailure () {
504- $ this ->parsedStructureForFile ('unopened-close-brackets ' , Settings::create ()->withLenientParsing (false ));
545+ $ this ->parsedStructureForFile ('- unopened-close-brackets ' , Settings::create ()->withLenientParsing (false ));
505546 }
506547
507548 /**
0 commit comments