@@ -53,4 +53,49 @@ describe("url", function() {
5353test ( "-webkit-image-set" , ".a { background-image: -webkit-image-set(url('url1x.png') 1x, url('url2x.png') 2x) }" , [
5454[ 1 , ".a { background-image: -webkit-image-set(url({./url1x.png}) 1x, url({./url2x.png}) 2x) }" , "" ]
5555] ) ;
56+
57+ test ( "background img with url" , ".class { background: green url( \"img.png\" ) xyz }" , [
58+ [ 1 , ".class { background: green url( \"img.png\" ) xyz }" , "" ]
59+ ] , "?-url" ) ;
60+ test ( "background img 2 with url" , ".class { background: green url(~img/png) url(aaa) xyz }" , [
61+ [ 1 , ".class { background: green url(~img/png) url(aaa) xyz }" , "" ]
62+ ] , "?-url" ) ;
63+ test ( "background img 3 with url" , ".class { background: green url( 'img.png' ) xyz }" , [
64+ [ 1 , ".class { background: green url( 'img.png' ) xyz }" , "" ]
65+ ] , "?-url" ) ;
66+ test ( "background img absolute with url" , ".class { background: green url(/img.png) xyz }" , [
67+ [ 1 , ".class { background: green url(/img.png) xyz }" , "" ]
68+ ] , "?-url" ) ;
69+ test ( "background img external with url" ,
70+ ".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }" , [
71+ [ 1 , ".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }" , "" ]
72+ ] , "?-url" ) ;
73+ test ( "background img external data with url" ,
74+ ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\") }" , [
75+ [ 1 , ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\") }" , "" ]
76+ ] , "?-url" ) ;
77+ test ( "data url in filter with url" ,
78+ ".class { filter: url('data:image/svg+xml;charset=utf-8,<svg xmlns=\"http://www.w3.org/2000/svg\"><filter id=\"filter\"><feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"0\" /><feOffset dx=\"1\" dy=\"2\" result=\"offsetblur\" /><feFlood flood-color=\"rgba(255,255,255,1)\" /><feComposite in2=\"offsetblur\" operator=\"in\" /><feMerge><feMergeNode /><feMergeNode in=\"SourceGraphic\" /></feMerge></filter></svg>#filter'); }" , [
79+ [ 1 , ".class { filter: url('data:image/svg+xml;charset=utf-8,<svg xmlns=\"http://www.w3.org/2000/svg\"><filter id=\"filter\"><feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"0\" /><feOffset dx=\"1\" dy=\"2\" result=\"offsetblur\" /><feFlood flood-color=\"rgba(255,255,255,1)\" /><feComposite in2=\"offsetblur\" operator=\"in\" /><feMerge><feMergeNode /><feMergeNode in=\"SourceGraphic\" /></feMerge></filter></svg>#filter'); }" , "" ]
80+ ] , "?-url" ) ;
81+ test ( "filter hash with url" ,
82+ ".highlight { filter: url(#highlight); }" , [
83+ [ 1 , ".highlight { filter: url(#highlight); }" , "" ]
84+ ] , "?-url" ) ;
85+ test ( "filter hash quotation marks with url" ,
86+ ".highlight { filter: url('#line-marker'); }" , [
87+ [ 1 , ".highlight { filter: url('#line-marker'); }" , "" ]
88+ ] , "?-url" ) ;
89+ test ( "font face with url" , "@font-face { src: url(regular.woff) format('woff'), url(~truetype/regular.ttf) format('truetype') }" , [
90+ [ 1 , "@font-face { src: url(regular.woff) format('woff'), url(~truetype/regular.ttf) format('truetype') }" , "" ]
91+ ] , "?-url" ) ;
92+ test ( "media query with url" , "@media (min-width: 500px) { body { background: url(image.png); } }" , [
93+ [ 1 , "@media (min-width: 500px) { body { background: url(image.png); } }" , "" ]
94+ ] , "?-url" ) ;
95+ test ( "url in string with url" , "a { content: \"do not use url(path)\"; } b { content: 'do not \"use\" url(path)'; }" , [
96+ [ 1 , "a { content: \"do not use url(path)\"; } b { content: 'do not \"use\" url(path)'; }" , "" ]
97+ ] , "?-url" ) ;
98+ test ( "keyframe background img with url" , "@keyframes anim { background: green url('img.png') xyz }" , [
99+ [ 1 , "@keyframes anim { background: green url('img.png') xyz }" , "" ]
100+ ] , "?-url" ) ;
56101} ) ;
0 commit comments