@@ -14,7 +14,9 @@ describe('isUrlRequest()', () => {
1414 // without root
1515 [ [ '//google.com' ] , false , 'should be negative for scheme-agnostic urls' ] ,
1616 [ [ 'http://google.com' ] , false , 'should be negative for http urls' ] ,
17+ [ [ 'HTTP://google.com' ] , false , 'should be negative for http urls' ] ,
1718 [ [ 'https://google.com' ] , false , 'should be negative for https urls' ] ,
19+ [ [ 'HTTPS://google.com' ] , false , 'should be negative for https urls' ] ,
1820
1921 [ [ 'chrome-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
2022 [ [ 'moz-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
@@ -26,6 +28,13 @@ describe('isUrlRequest()', () => {
2628 [ [ 'custom-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
2729
2830 [ [ 'path/to/thing' ] , true , 'should be positive for implicit relative urls' ] ,
31+ [ [ './img.png' ] , true , 'should be positive for implicit relative urls' ] ,
32+ [ [ '../img.png' ] , true , 'should be positive for implicit relative urls' ] ,
33+ [
34+ [ './img.png?foo=bar#hash' ] ,
35+ true ,
36+ 'should be positive for implicit relative urls' ,
37+ ] ,
2938 [
3039 [ './path/to/thing' ] ,
3140 true ,
@@ -42,6 +51,18 @@ describe('isUrlRequest()', () => {
4251 true ,
4352 'should be positive for module urls with relative path prefix' ,
4453 ] ,
54+ [ [ 'C:/thing' ] , true , 'should be positive for linux path with driver' ] ,
55+ [ [ 'C:\\thing' ] , true , 'should be positive for windows path with driver' ] ,
56+ [
57+ [ 'directory/things' ] ,
58+ true ,
59+ 'should be positive for relative path (linux)' ,
60+ ] ,
61+ [
62+ [ 'directory\\things' ] ,
63+ true ,
64+ 'should be positive for relative path (windows)' ,
65+ ] ,
4566
4667 // with root (normal path)
4768 [
@@ -110,6 +131,48 @@ describe('isUrlRequest()', () => {
110131
111132 // about url
112133 [ [ 'about:blank' ] , false , 'should be negative for about:blank' ] ,
134+
135+ // hash
136+ [ [ '#gradient' ] , false , 'should be negative for hash url' ] ,
137+
138+ // url
139+ [ [ '//sindresorhus.com' ] , false , 'should ignore noscheme url' ] ,
140+ [
141+ [ '//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot' ] ,
142+ false ,
143+ 'should ignore noscheme url with path' ,
144+ ] ,
145+ [
146+ [ 'https://example.com/././foo' ] ,
147+ false ,
148+ 'should ignore absolute url with relative' ,
149+ ] ,
150+
151+ // non standard protocols
152+ [
153+ [ 'file://sindresorhus.com' ] ,
154+ false ,
155+ 'should ignore non standard protocols (file)' ,
156+ ] ,
157+ [
158+ 159+ false ,
160+ 'should ignore non standard protocols (mailto)' ,
161+ ] ,
162+ [
163+ [ 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D' ] ,
164+ false ,
165+ 'should ignore non standard protocols (data)' ,
166+ ] ,
167+ [
168+ [ 'DATA:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D' ] ,
169+ false ,
170+ 'should ignore non standard protocols (data)' ,
171+ ] ,
172+
173+ // root-relative url
174+ [ [ '/' ] , false , 'ignore root-relative url' ] ,
175+ [ [ '//' ] , false , 'ignore root-relative url 1' ] ,
113176 ] . forEach ( ( test ) => {
114177 it ( test [ 2 ] , ( ) => {
115178 const expected = test [ 1 ] ;
0 commit comments