@@ -8,38 +8,57 @@ test('main', t => {
88 t . is ( stripCssComments ( 'body{content: "\'/*ad*/\' \\""}' ) , 'body{content: "\'/*ad*/\' \\""}' ) ;
99 t . is ( stripCssComments ( 'body{\r\n /*\n\n\n\nfoo*/\n}' ) , 'body{\r\n \n}' ) ;
1010 t . is ( stripCssComments ( 'body/*foo*/{}' ) , 'body{}' ) ;
11+ t . is ( stripCssComments ( 'body{/*"*/}' ) , 'body{}' ) ;
12+ t . is ( stripCssComments ( 'body{/*\'*/}' ) , 'body{}' ) ;
1113 t . is ( stripCssComments ( 'body{/*"\'\\"*/}' ) , 'body{}' ) ;
14+ t . is ( stripCssComments ( 'body{/*"\'"\'*/}' ) , 'body{}' ) ;
1215
1316 t . is ( stripCssComments ( '/*!//comment*/body{}' ) , '/*!//comment*/body{}' ) ;
17+ t . is ( stripCssComments ( '/*!//"comment*/body{/*//comment*/}' ) , '/*!//"comment*/body{}' ) ;
18+ t . is ( stripCssComments ( '/*!//\'comment*/body{/*//comment*/}' ) , '/*!//\'comment*/body{}' ) ;
1419 t . is ( stripCssComments ( 'body{/*!comment*/}' ) , 'body{/*!comment*/}' ) ;
1520 t . is ( stripCssComments ( 'body{/*!\ncomment\n\\*/}' ) , 'body{/*!\ncomment\n\\*/}' ) ;
1621 t . is ( stripCssComments ( 'body{content: "\'/*!ad*/\' \\""}' ) , 'body{content: "\'/*!ad*/\' \\""}' ) ;
1722 t . is ( stripCssComments ( 'body{\r\n /*!\n\n\n\nfoo*/\n}' ) , 'body{\r\n /*!\n\n\n\nfoo*/\n}' ) ;
1823 t . is ( stripCssComments ( 'body/*!foo*/{}' ) , 'body/*!foo*/{}' ) ;
24+ t . is ( stripCssComments ( 'body{/*!"*/}/*foo*/' ) , 'body{/*!"*/}' ) ;
25+ t . is ( stripCssComments ( 'body{/*!\'*/}/*foo*/' ) , 'body{/*!\'*/}' ) ;
1926 t . is ( stripCssComments ( 'body{/*!"\'\\"*/}' ) , 'body{/*!"\'\\"*/}' ) ;
27+ t . is ( stripCssComments ( 'body{/*!"\'"\'*/}' ) , 'body{/*!"\'"\'*/}' ) ;
2028
2129 t . is ( stripCssComments ( '/*!//comment*/body{}' , { all : true } ) , 'body{}' ) ;
2230 t . is ( stripCssComments ( '/*!//comment*/body{}' , { all : true } ) , 'body{}' ) ;
31+ t . is ( stripCssComments ( '/*!//"comment*/body{}' , { all : true } ) , 'body{}' ) ;
32+ t . is ( stripCssComments ( '/*!//\'comment*/body{}' , { all : true } ) , 'body{}' ) ;
2333 t . is ( stripCssComments ( 'body{/*!comment*/}' , { all : true } ) , 'body{}' ) ;
2434 t . is ( stripCssComments ( 'body{/*!\ncomment\n\\*/}' , { all : true } ) , 'body{}' ) ;
2535 t . is ( stripCssComments ( 'body{content: "\'/*!ad*/\' \\""}' , { all : true } ) , 'body{content: "\'/*!ad*/\' \\""}' ) ;
2636 t . is ( stripCssComments ( 'body{\r\n /*!\n\n\n\nfoo*/\n}' , { all : true } ) , 'body{\r\n \n}' ) ;
2737 t . is ( stripCssComments ( 'body/*!foo*/{}' , { all : true } ) , 'body{}' ) ;
38+ t . is ( stripCssComments ( 'body{/*!"*/}/*foo*/' , { all : true } ) , 'body{}' ) ;
39+ t . is ( stripCssComments ( 'body{/*!\'*/}/*foo*/' , { all : true } ) , 'body{}' ) ;
2840 t . is ( stripCssComments ( 'body{/*!"\'\\"*/}' , { all : true } ) , 'body{}' ) ;
41+ t . is ( stripCssComments ( 'body{/*!"\'"\'*/}' , { all : true } ) , 'body{}' ) ;
2942
3043 t . is ( stripCssComments ( '/*!//comment*/body{}' , { preserve : false } ) , 'body{}' ) ;
44+ t . is ( stripCssComments ( '/*!//"comment*/body{}' , { preserve : false } ) , 'body{}' ) ;
45+ t . is ( stripCssComments ( '/*!//\'comment*/body{}' , { preserve : false } ) , 'body{}' ) ;
3146 t . is ( stripCssComments ( 'body{/*!comment*/}' , { preserve : false } ) , 'body{}' ) ;
3247 t . is ( stripCssComments ( 'body{/*!\ncomment\n\\*/}' , { preserve : false } ) , 'body{}' ) ;
3348 t . is ( stripCssComments ( 'body{content: "\'/*!ad*/\' \\""}' , { preserve : false } ) , 'body{content: "\'/*!ad*/\' \\""}' ) ;
3449 t . is ( stripCssComments ( 'body{\r\n /*!\n\n\n\nfoo*/\n}' , { preserve : false } ) , 'body{\r\n \n}' ) ;
3550 t . is ( stripCssComments ( 'body/*!foo*/{}' , { preserve : false } ) , 'body{}' ) ;
51+ t . is ( stripCssComments ( 'body{/*!"*/}/*foo*/' , { preserve : false } ) , 'body{}' ) ;
52+ t . is ( stripCssComments ( 'body{/*!\'*/}/*foo*/' , { preserve : false } ) , 'body{}' ) ;
3653 t . is ( stripCssComments ( 'body{/*!"\'\\"*/}' , { preserve : false } ) , 'body{}' ) ;
54+ t . is ( stripCssComments ( 'body{/*!"\'"\'*/}' , { preserve : false } ) , 'body{}' ) ;
3755
3856 t . is ( stripCssComments ( 'body{/*##foo##*/}' , { preserve : / ^ # # f o o # # / } ) , 'body{/*##foo##*/}' ) ;
3957 t . is ( stripCssComments ( 'body{/*foo*/}' , { preserve : / ^ # # f o o # # / } ) , 'body{}' ) ;
4058 t . is ( stripCssComments ( 'body{/*##foo##*//*foo*/}' , { preserve : / ^ # # f o o # # / } ) , 'body{/*##foo##*/}' ) ;
4159 t . is ( stripCssComments ( 'body{/*##foo##*//*!foo*/}' , { preserve : / ^ # # f o o # # / } ) , 'body{/*##foo##*/}' ) ;
4260 t . is ( stripCssComments ( 'body{/*!##foo##*//*foo*/}' , { preserve : / ^ # # f o o # # / } ) , 'body{}' ) ;
61+ t . is ( stripCssComments ( 'body{/*!##foo*//*foo*/}' , { preserve : / f o o $ / } ) , 'body{/*!##foo*//*foo*/}' ) ;
4362
4463 t . is (
4564 stripCssComments ( 'body{/*##foo##*/}' , {
@@ -70,6 +89,13 @@ test('main', t => {
7089 preserve : comment => comment . startsWith ( '##foo##' )
7190 } ) , 'body{}'
7291 ) ;
92+
93+ t . is (
94+ stripCssComments ( 'body{/*!##foo*//*foo*/}' , {
95+ preserve : comment => comment . endsWith ( 'foo' )
96+ } ) ,
97+ 'body{/*!##foo*//*foo*/}'
98+ ) ;
7399} ) ;
74100
75101test . failing ( 'strips trailing comment newline' , t => {
0 commit comments