@@ -121,15 +121,7 @@ describe('GetFilenameFromUrl', () => {
121
121
url : '/pathname%20with%20spaces.js' ,
122
122
outputPath : '/' ,
123
123
publicPath : '/' ,
124
- // ref #284 - windows paths should persist %20
125
- expected : isWindows ? '/pathname%20with%20spaces.js' : '/pathname with spaces.js'
126
- } ,
127
- {
128
- url : '/test/windows.txt' ,
129
- outputPath : 'c:\\foo' ,
130
- publicPath : '/test' ,
131
- // this is weird, but it's legal-ish, and what URI parsing produces
132
- expected : 'c://\\foo/windows.txt'
124
+ expected : '/pathname with spaces.js'
133
125
} ,
134
126
{
135
127
url : '/js/sample.js' ,
@@ -279,17 +271,55 @@ describe('GetFilenameFromUrl', () => {
279
271
} ) ;
280
272
}
281
273
274
+ // Explicit Tests for Microsoft Windows
282
275
if ( isWindows ) {
283
- // explicit test for #284
284
- const test = {
285
- url : '/test/windows.txt' ,
286
- outputPath : 'C:\\My%20Path\\wwwroot' ,
287
- publicPath : '/test' ,
288
- expected : 'C://\\My%20Path\\wwwroot/windows.txt'
289
- } ;
276
+ const windowsTests = [
277
+ {
278
+ url : '/test/windows.txt' ,
279
+ outputPath : 'c:\\foo' ,
280
+ publicPath : '/test' ,
281
+ // this is weird, but it's legal-ish, and what URI parsing produces
282
+ expected : 'c://\\foo/windows.txt'
283
+ } ,
284
+ // Tests for #284
285
+ {
286
+ url : '/test/windows.txt' ,
287
+ outputPath : 'C:\\My%20Path\\wwwroot' ,
288
+ publicPath : '/test' ,
289
+ expected : 'C://\\My%20Path\\wwwroot/windows.txt'
290
+ } ,
291
+ {
292
+ url : '/test/windows%202.txt' ,
293
+ outputPath : 'C:\\My%20Path\\wwwroot' ,
294
+ publicPath : '/test' ,
295
+ expected : 'C://\\My%20Path\\wwwroot/windows 2.txt'
296
+ } ,
297
+ // Tests for #297
298
+ {
299
+ url : '/test/windows.txt' ,
300
+ outputPath : 'C:\\My Path\\wwwroot' ,
301
+ publicPath : '/test' ,
302
+ expected : 'C://\\My Path\\wwwroot/windows.txt'
303
+ } ,
304
+ {
305
+ url : '/test/windows%202.txt' ,
306
+ outputPath : 'C:\\My Path\\wwwroot' ,
307
+ publicPath : '/test' ,
308
+ expected : 'C://\\My Path\\wwwroot/windows 2.txt'
309
+ } ,
310
+ // Tests for #284 & #297
311
+ {
312
+ url : '/windows%20test/test%20%26%20test%20%26%20%2520.txt' ,
313
+ outputPath : 'C:\\My %20 Path\\wwwroot' ,
314
+ publicPath : '/windows%20test' ,
315
+ expected : 'C://\\My %20 Path\\wwwroot/test & test & %20.txt'
316
+ }
317
+ ] ;
290
318
291
- it ( `windows: should process ${ test . url } -> ${ test . expected } ` , ( ) => {
292
- testUrl ( test ) ;
293
- } ) ;
319
+ for ( const test of windowsTests ) {
320
+ it ( `windows: should process ${ test . url } -> ${ test . expected } ` , ( ) => {
321
+ testUrl ( test ) ;
322
+ } ) ;
323
+ }
294
324
}
295
325
} ) ;
0 commit comments