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