@@ -14,7 +14,9 @@ describe('isUrlRequest()', () => {
14
14
// without root
15
15
[ [ '//google.com' ] , false , 'should be negative for scheme-agnostic urls' ] ,
16
16
[ [ 'http://google.com' ] , false , 'should be negative for http urls' ] ,
17
+ [ [ 'HTTP://google.com' ] , false , 'should be negative for http urls' ] ,
17
18
[ [ 'https://google.com' ] , false , 'should be negative for https urls' ] ,
19
+ [ [ 'HTTPS://google.com' ] , false , 'should be negative for https urls' ] ,
18
20
19
21
[ [ 'chrome-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
20
22
[ [ 'moz-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
@@ -26,6 +28,13 @@ describe('isUrlRequest()', () => {
26
28
[ [ 'custom-extension://' ] , false , 'should be negative for nonstandard urls' ] ,
27
29
28
30
[ [ '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
+ ] ,
29
38
[
30
39
[ './path/to/thing' ] ,
31
40
true ,
@@ -42,6 +51,18 @@ describe('isUrlRequest()', () => {
42
51
true ,
43
52
'should be positive for module urls with relative path prefix' ,
44
53
] ,
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
+ ] ,
45
66
46
67
// with root (normal path)
47
68
[
@@ -110,6 +131,48 @@ describe('isUrlRequest()', () => {
110
131
111
132
// about url
112
133
[ [ '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
+ [ 'mailto:someone@example.com' ] ,
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' ] ,
113
176
] . forEach ( ( test ) => {
114
177
it ( test [ 2 ] , ( ) => {
115
178
const expected = test [ 1 ] ;
0 commit comments