1
1
process . env . VUE_LOADER_TEST = true
2
2
3
- var fs = require ( 'fs' )
4
- var path = require ( 'path' )
5
- var jsdom = require ( 'jsdom' )
6
- var webpack = require ( 'webpack' )
7
- var MemoryFS = require ( 'memory-fs' )
8
- var expect = require ( 'chai' ) . expect
9
- var hash = require ( 'hash-sum' )
10
- var Vue = require ( 'vue' )
11
- var SSR = require ( 'vue-server-renderer' )
3
+ const fs = require ( 'fs' )
4
+ const path = require ( 'path' )
5
+ const jsdom = require ( 'jsdom' )
6
+ const webpack = require ( 'webpack' )
7
+ const MemoryFS = require ( 'memory-fs' )
8
+ const expect = require ( 'chai' ) . expect
9
+ const hash = require ( 'hash-sum' )
10
+ const Vue = require ( 'vue' )
11
+ const SSR = require ( 'vue-server-renderer' )
12
12
// var compiler = require('../lib/template-compiler')
13
- var normalizeNewline = require ( 'normalize-newline' )
14
- var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
15
- var SourceMapConsumer = require ( 'source-map' ) . SourceMapConsumer
16
-
17
- var rawLoaderPath = path . resolve ( __dirname , '../index.js' )
18
- var loaderPath = 'expose-loader?vueModule!' + rawLoaderPath
19
- var mfs = new MemoryFS ( )
20
- var globalConfig = {
13
+ const normalizeNewline = require ( 'normalize-newline' )
14
+ const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
15
+ const SourceMapConsumer = require ( 'source-map' ) . SourceMapConsumer
16
+
17
+ const rawLoaderPath = path . resolve ( __dirname , '../index.js' )
18
+ const loaderPath = 'expose-loader?vueModule!' + rawLoaderPath
19
+ const mfs = new MemoryFS ( )
20
+ const globalConfig = {
21
21
output : {
22
22
path : '/' ,
23
23
filename : 'test.build.js'
@@ -35,10 +35,14 @@ var globalConfig = {
35
35
]
36
36
}
37
37
38
+ function genId ( file ) {
39
+ return hash ( fs . readFileSync ( path . resolve ( __dirname , './fixtures' , file ) , 'utf-8' ) )
40
+ }
41
+
38
42
function bundle ( options , cb ) {
39
- var vueOptions = options . vue
43
+ const vueOptions = options . vue
40
44
delete options . vue
41
- var config = Object . assign ( { } , globalConfig , options )
45
+ const config = Object . assign ( { } , globalConfig , options )
42
46
43
47
// assign vue Options
44
48
if ( vueOptions ) {
@@ -47,7 +51,7 @@ function bundle (options, cb) {
47
51
} ) )
48
52
}
49
53
50
- var webpackCompiler = webpack ( config )
54
+ const webpackCompiler = webpack ( config )
51
55
webpackCompiler . outputFileSystem = mfs
52
56
webpackCompiler . run ( ( err , stats ) => {
53
57
expect ( err ) . to . be . null
@@ -99,12 +103,12 @@ function interopDefault (module) {
99
103
: module
100
104
}
101
105
102
- describe ( 'vue-loader' , function ( ) {
106
+ describe ( 'vue-loader' , ( ) => {
103
107
it ( 'basic' , done => {
104
108
test ( {
105
109
entry : './test/fixtures/basic.vue'
106
110
} , ( window , module , rawModule ) => {
107
- var vnode = mockRender ( module , {
111
+ const vnode = mockRender ( module , {
108
112
msg : 'hi'
109
113
} )
110
114
@@ -114,7 +118,7 @@ describe('vue-loader', function () {
114
118
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'hi' )
115
119
116
120
expect ( module . data ( ) . msg ) . to . contain ( 'Hello from Component A!' )
117
- var style = window . document . querySelector ( 'style' ) . textContent
121
+ let style = window . document . querySelector ( 'style' ) . textContent
118
122
style = normalizeNewline ( style )
119
123
expect ( style ) . to . contain ( 'comp-a h2 {\n color: #f00;\n}' )
120
124
done ( )
@@ -134,7 +138,7 @@ describe('vue-loader', function () {
134
138
test ( {
135
139
entry : './test/fixtures/pre.vue'
136
140
} , ( window , module ) => {
137
- var vnode = mockRender ( module )
141
+ const vnode = mockRender ( module )
138
142
// div
139
143
// h1 This is the app
140
144
// comp-a
@@ -144,7 +148,7 @@ describe('vue-loader', function () {
144
148
expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'comp-b' )
145
149
146
150
expect ( module . data ( ) . msg ) . to . contain ( 'Hello from coffee!' )
147
- var style = window . document . querySelector ( 'style' ) . textContent
151
+ const style = window . document . querySelector ( 'style' ) . textContent
148
152
expect ( style ) . to . contain ( 'body {\n font: 100% Helvetica, sans-serif;\n color: #999;\n}' )
149
153
done ( )
150
154
} )
@@ -160,15 +164,15 @@ describe('vue-loader', function () {
160
164
new ExtractTextPlugin ( 'test.output.css' )
161
165
]
162
166
} , ( window , module ) => {
163
- var vnode = mockRender ( module )
167
+ const vnode = mockRender ( module )
164
168
165
169
expect ( vnode . children [ 0 ] . tag ) . to . equal ( 'h1' )
166
170
expect ( vnode . children [ 1 ] . tag ) . to . equal ( 'comp-a' )
167
171
expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'comp-b' )
168
172
169
173
expect ( module . data ( ) . msg ) . to . contain ( 'Hello from coffee!' )
170
174
171
- var css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
175
+ let css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
172
176
css = normalizeNewline ( css )
173
177
expect ( css ) . to . contain ( 'body {\n font: 100% Helvetica, sans-serif;\n color: #999;\n}' )
174
178
@@ -178,15 +182,12 @@ describe('vue-loader', function () {
178
182
179
183
it ( 'scoped style' , done => {
180
184
test ( {
181
- entry : './test/fixtures/scoped-css.vue' ,
182
- vue : {
183
- hashKey : 'foo'
184
- }
185
+ entry : './test/fixtures/scoped-css.vue'
185
186
} , ( window , module ) => {
186
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/ scoped-css.vue' + 'foo ')
187
+ const id = 'data-v-' + genId ( ' scoped-css.vue')
187
188
expect ( module . _scopeId ) . to . equal ( id )
188
189
189
- var vnode = mockRender ( module , {
190
+ const vnode = mockRender ( module , {
190
191
ok : true
191
192
} )
192
193
// <div>
@@ -202,7 +203,7 @@ describe('vue-loader', function () {
202
203
expect ( vnode . children [ 4 ] . tag ) . to . equal ( 'p' )
203
204
expect ( vnode . children [ 4 ] . data . staticClass ) . to . equal ( 'test' )
204
205
205
- var style = window . document . querySelector ( 'style' ) . textContent
206
+ let style = window . document . querySelector ( 'style' ) . textContent
206
207
style = normalizeNewline ( style )
207
208
expect ( style ) . to . contain ( `.test[${ id } ] {\n color: yellow;\n}` )
208
209
expect ( style ) . to . contain ( `.test[${ id } ]:after {\n content: \'bye!\';\n}` )
@@ -222,10 +223,10 @@ describe('vue-loader', function () {
222
223
test ( {
223
224
entry : './test/fixtures/style-import.vue'
224
225
} , ( window ) => {
225
- var styles = window . document . querySelectorAll ( 'style' )
226
+ const styles = window . document . querySelectorAll ( 'style' )
226
227
expect ( styles [ 0 ] . textContent ) . to . contain ( 'h1 { color: red;\n}' )
227
228
// import with scoped
228
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/ style-import.vue')
229
+ const id = 'data-v-' + genId ( ' style-import.vue')
229
230
expect ( styles [ 1 ] . textContent ) . to . contain ( 'h1[' + id + '] { color: green;\n}' )
230
231
done ( )
231
232
} )
@@ -235,7 +236,7 @@ describe('vue-loader', function () {
235
236
test ( {
236
237
entry : './test/fixtures/template-import.vue'
237
238
} , ( window , module ) => {
238
- var vnode = mockRender ( module )
239
+ const vnode = mockRender ( module )
239
240
// '<div><h1>hello</h1></div>'
240
241
expect ( vnode . children [ 0 ] . tag ) . to . equal ( 'h1' )
241
242
expect ( vnode . children [ 0 ] . children [ 0 ] . text ) . to . equal ( 'hello' )
@@ -257,19 +258,19 @@ describe('vue-loader', function () {
257
258
entry : './test/fixtures/basic.vue' ,
258
259
devtool : '#source-map'
259
260
} , ( code , warnings ) => {
260
- var map = mfs . readFileSync ( '/test.build.js.map' ) . toString ( )
261
- var smc = new SourceMapConsumer ( JSON . parse ( map ) )
262
- var line
263
- var col
264
- var targetRE = / ^ \s + m s g : ' H e l l o f r o m C o m p o n e n t A ! ' /
261
+ const map = mfs . readFileSync ( '/test.build.js.map' ) . toString ( )
262
+ const smc = new SourceMapConsumer ( JSON . parse ( map ) )
263
+ let line
264
+ let col
265
+ const targetRE = / ^ \s + m s g : ' H e l l o f r o m C o m p o n e n t A ! ' /
265
266
code . split ( / \r ? \n / g) . some ( ( l , i ) => {
266
267
if ( targetRE . test ( l ) ) {
267
268
line = i + 1
268
269
col = 0
269
270
return true
270
271
}
271
272
} )
272
- var pos = smc . originalPositionFor ( {
273
+ const pos = smc . originalPositionFor ( {
273
274
line : line ,
274
275
column : col
275
276
} )
@@ -283,9 +284,9 @@ describe('vue-loader', function () {
283
284
test ( {
284
285
entry : './test/fixtures/media-query.vue'
285
286
} , ( window ) => {
286
- var style = window . document . querySelector ( 'style' ) . textContent
287
+ let style = window . document . querySelector ( 'style' ) . textContent
287
288
style = normalizeNewline ( style )
288
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/ media-query.vue')
289
+ const id = 'data-v-' + genId ( ' media-query.vue')
289
290
expect ( style ) . to . contain ( '@media print {\n.foo[' + id + '] {\n color: #000;\n}\n}' )
290
291
done ( )
291
292
} )
@@ -295,9 +296,9 @@ describe('vue-loader', function () {
295
296
test ( {
296
297
entry : './test/fixtures/supports-query.vue'
297
298
} , ( window ) => {
298
- var style = window . document . querySelector ( 'style' ) . textContent
299
+ let style = window . document . querySelector ( 'style' ) . textContent
299
300
style = normalizeNewline ( style )
300
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/ supports-query.vue')
301
+ const id = 'data-v-' + genId ( ' supports-query.vue')
301
302
expect ( style ) . to . contain ( '@supports ( color: #000 ) {\n.foo[' + id + '] {\n color: #000;\n}\n}' )
302
303
done ( )
303
304
} )
@@ -316,7 +317,7 @@ describe('vue-loader', function () {
316
317
new ExtractTextPlugin ( 'test.output.css' )
317
318
]
318
319
} , ( code , warnings ) => {
319
- var css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
320
+ let css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
320
321
css = normalizeNewline ( css )
321
322
expect ( css ) . to . contain ( 'h1 {\n color: #f00;\n}' )
322
323
expect ( css ) . to . contain ( 'h2 {\n color: green;\n}' )
@@ -334,7 +335,7 @@ describe('vue-loader', function () {
334
335
new ExtractTextPlugin ( 'test.output.css' )
335
336
]
336
337
} , ( code , warnings ) => {
337
- var css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
338
+ let css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
338
339
css = normalizeNewline ( css )
339
340
expect ( css ) . to . contain ( 'h1 {\n color: #f00;\n}' )
340
341
expect ( css ) . to . contain ( 'h2 {\n color: green;\n}' )
@@ -353,7 +354,7 @@ describe('vue-loader', function () {
353
354
plugin
354
355
]
355
356
} , ( code , warnings ) => {
356
- var css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
357
+ let css = mfs . readFileSync ( '/test.output.css' ) . toString ( )
357
358
css = normalizeNewline ( css )
358
359
expect ( css ) . to . contain ( 'h1 {\n color: #f00;\n}' )
359
360
expect ( css ) . to . contain ( 'h2 {\n color: green;\n}' )
@@ -366,12 +367,12 @@ describe('vue-loader', function () {
366
367
entry : './test/fixtures/inject.js'
367
368
} , ( window ) => {
368
369
// console.log(window.injector.toString())
369
- var module = interopDefault ( window . injector ( {
370
+ const module = interopDefault ( window . injector ( {
370
371
'./service' : {
371
372
msg : 'Hello from mocked service!'
372
373
}
373
374
} ) )
374
- var vnode = mockRender ( module , module . data ( ) )
375
+ const vnode = mockRender ( module , module . data ( ) )
375
376
// <div class="msg">{{ msg }}</div>
376
377
expect ( vnode . tag ) . to . equal ( 'div' )
377
378
expect ( vnode . data . staticClass ) . to . equal ( 'msg' )
@@ -395,7 +396,7 @@ describe('vue-loader', function () {
395
396
]
396
397
}
397
398
} , ( window , module ) => {
398
- var vnode = mockRender ( module )
399
+ const vnode = mockRender ( module )
399
400
// <div>
400
401
// <img src="logo.c9e00e.png">
401
402
// <img src="logo.c9e00e.png">
@@ -405,7 +406,7 @@ describe('vue-loader', function () {
405
406
expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'img' )
406
407
expect ( vnode . children [ 2 ] . data . attrs . src ) . to . equal ( 'logo.c9e00e.png' )
407
408
408
- var style = window . document . querySelector ( 'style' ) . textContent
409
+ const style = window . document . querySelector ( 'style' ) . textContent
409
410
expect ( style ) . to . contain ( 'html { background-image: url(logo.c9e00e.png);\n}' )
410
411
expect ( style ) . to . contain ( 'body { background-image: url(logo.c9e00e.png);\n}' )
411
412
done ( )
@@ -428,12 +429,12 @@ describe('vue-loader', function () {
428
429
function includeDataURL ( s ) {
429
430
return ! ! s . match ( / \s * d a t a : ( [ a - z ] + \/ [ a - z ] + ( ; [ a - z \- ] + \= [ a - z \- ] + ) ? ) ? ( ; b a s e 6 4 ) ? , [ a - z 0 - 9 \! \$ \& \' \, \( \) \* \+ \, \; \= \- \. \_ \~ \: \@ \/ \? \% \s ] * \s * / i)
430
431
}
431
- var vnode = mockRender ( module )
432
+ const vnode = mockRender ( module )
432
433
// img tag
433
434
expect ( includeDataURL ( vnode . children [ 0 ] . data . attrs . src ) ) . to . equal ( true )
434
435
// image tag (SVG)
435
436
expect ( includeDataURL ( vnode . children [ 2 ] . children [ 0 ] . data . attrs [ 'xlink:href' ] ) ) . to . equal ( true )
436
- var style = window . document . querySelector ( 'style' ) . textContent
437
+ const style = window . document . querySelector ( 'style' ) . textContent
437
438
438
439
const dataURL = vnode . children [ 0 ] . data . attrs . src
439
440
@@ -461,7 +462,7 @@ describe('vue-loader', function () {
461
462
}
462
463
}
463
464
} , ( window ) => {
464
- var style = window . document . querySelector ( 'style' ) . textContent
465
+ let style = window . document . querySelector ( 'style' ) . textContent
465
466
style = normalizeNewline ( style )
466
467
expect ( style ) . to . contain ( 'h1 {\n color: red;\n font-size: 14px\n}' )
467
468
done ( )
@@ -473,7 +474,7 @@ describe('vue-loader', function () {
473
474
test ( {
474
475
entry : './test/fixtures/postcss.vue'
475
476
} , ( window ) => {
476
- var style = window . document . querySelector ( 'style' ) . textContent
477
+ let style = window . document . querySelector ( 'style' ) . textContent
477
478
style = normalizeNewline ( style )
478
479
expect ( style ) . to . contain ( 'h1 {\n color: red;\n font-size: 14px\n}' )
479
480
fs . unlinkSync ( '.postcssrc' )
@@ -493,7 +494,7 @@ describe('vue-loader', function () {
493
494
}
494
495
}
495
496
} , ( window ) => {
496
- var style = window . document . querySelector ( 'style' ) . textContent
497
+ let style = window . document . querySelector ( 'style' ) . textContent
497
498
style = normalizeNewline ( style )
498
499
expect ( style ) . to . contain ( 'h1 {\n color: red;\n font-size: 14px\n}' )
499
500
fs . unlinkSync ( 'test/.postcssrc' )
@@ -505,7 +506,7 @@ describe('vue-loader', function () {
505
506
test ( {
506
507
entry : './test/fixtures/es2015.vue'
507
508
} , ( window , module ) => {
508
- var vnode = mockRender ( module , {
509
+ const vnode = mockRender ( module , {
509
510
a : 'hello' ,
510
511
b : true
511
512
} )
@@ -522,7 +523,7 @@ describe('vue-loader', function () {
522
523
entry : './test/fixtures/extend.vue'
523
524
} , ( window , Module ) => {
524
525
// extend.vue should export Vue constructor
525
- var vnode = mockRender ( Module . options , {
526
+ const vnode = mockRender ( Module . options , {
526
527
msg : 'success'
527
528
} )
528
529
expect ( vnode . tag ) . to . equal ( 'div' )
@@ -540,7 +541,7 @@ describe('vue-loader', function () {
540
541
}
541
542
} , ( window , module , rawModule ) => {
542
543
expect ( rawModule . __esModule ) . to . equal ( true )
543
- var vnode = mockRender ( rawModule . default , {
544
+ const vnode = mockRender ( rawModule . default , {
544
545
msg : 'hi'
545
546
} )
546
547
expect ( vnode . tag ) . to . equal ( 'h2' )
@@ -563,27 +564,27 @@ describe('vue-loader', function () {
563
564
}
564
565
} , ( window , module , raw , instance ) => {
565
566
// get local class name
566
- var className = instance . style . red
567
+ const className = instance . style . red
567
568
expect ( className ) . to . match ( regexToMatch )
568
569
569
570
// class name in style
570
- var style = [ ] . slice . call ( window . document . querySelectorAll ( 'style' ) ) . map ( ( style ) => {
571
+ let style = [ ] . slice . call ( window . document . querySelectorAll ( 'style' ) ) . map ( ( style ) => {
571
572
return style . textContent
572
573
} ) . join ( '\n' )
573
574
style = normalizeNewline ( style )
574
575
expect ( style ) . to . contain ( '.' + className + ' {\n color: red;\n}' )
575
576
576
577
// animation name
577
- var match = style . match ( / @ k e y f r a m e s \s + ( \S + ) \s + { / )
578
+ const match = style . match ( / @ k e y f r a m e s \s + ( \S + ) \s + { / )
578
579
expect ( match ) . to . have . length ( 2 )
579
- var animationName = match [ 1 ]
580
+ const animationName = match [ 1 ]
580
581
expect ( animationName ) . to . not . equal ( 'fade' )
581
582
expect ( style ) . to . contain ( 'animation: ' + animationName + ' 1s;' )
582
583
583
584
// default module + pre-processor + scoped
584
- var anotherClassName = instance . $style . red
585
+ const anotherClassName = instance . $style . red
585
586
expect ( anotherClassName ) . to . match ( regexToMatch ) . and . not . equal ( className )
586
- var id = 'data-v-' + hash ( 'vue-loader/test/fixtures/ css-modules.vue')
587
+ const id = 'data-v-' + genId ( ' css-modules.vue')
587
588
expect ( style ) . to . contain ( '.' + anotherClassName + '[' + id + ']' )
588
589
589
590
cb ( )
@@ -592,8 +593,8 @@ describe('vue-loader', function () {
592
593
// default localIdentName
593
594
testWithIdent ( undefined , / ^ \w { 23 } / , ( ) => {
594
595
// specified localIdentName
595
- var ident = '[path][name]---[local]---[hash:base64:5]'
596
- var regex = / ^ t e s t - f i x t u r e s - c s s - m o d u l e s - - - r e d - - - \w { 5 } /
596
+ const ident = '[path][name]---[local]---[hash:base64:5]'
597
+ const regex = / ^ t e s t - f i x t u r e s - c s s - m o d u l e s - - - r e d - - - \w { 5 } /
597
598
testWithIdent ( ident , regex , done )
598
599
} )
599
600
} )
@@ -608,14 +609,14 @@ describe('vue-loader', function () {
608
609
} , ( code , warnings ) => {
609
610
// http://stackoverflow.com/questions/17581830/load-node-js-module-from-string-in-memory
610
611
function requireFromString ( src , filename ) {
611
- var Module = module . constructor
612
- var m = new Module ( )
612
+ const Module = module . constructor
613
+ const m = new Module ( )
613
614
m . _compile ( src , filename )
614
615
return m . exports
615
616
}
616
617
617
- var output = interopDefault ( requireFromString ( code , './test.build.js' ) )
618
- var mockInstance = { }
618
+ const output = interopDefault ( requireFromString ( code , './test.build.js' ) )
619
+ const mockInstance = { }
619
620
620
621
output . beforeCreate . forEach ( hook => hook . call ( mockInstance ) )
621
622
expect ( mockInstance . style . red ) . to . exist
@@ -633,7 +634,7 @@ describe('vue-loader', function () {
633
634
}
634
635
}
635
636
} , ( window , module ) => {
636
- var vnode = mockRender ( module , {
637
+ const vnode = mockRender ( module , {
637
638
msg : 'hi'
638
639
} )
639
640
// <h2 id="-msg-">{{msg}}</h2>
@@ -713,7 +714,7 @@ describe('vue-loader', function () {
713
714
new ExtractTextPlugin ( 'doc.md' )
714
715
]
715
716
} , ( code , warnings ) => {
716
- var unitTest = mfs . readFileSync ( '/doc.md' ) . toString ( )
717
+ let unitTest = mfs . readFileSync ( '/doc.md' ) . toString ( )
717
718
unitTest = normalizeNewline ( unitTest )
718
719
expect ( unitTest ) . to . contain ( 'This is example documentation for a component.' )
719
720
done ( )
@@ -814,7 +815,7 @@ describe('vue-loader', function () {
814
815
}
815
816
}
816
817
} , ( window , module ) => {
817
- var vnode = mockRender ( module , {
818
+ const vnode = mockRender ( module , {
818
819
msg : 'hi'
819
820
} )
820
821
// <h2 class="green">{{msg}}</h2>
@@ -823,7 +824,7 @@ describe('vue-loader', function () {
823
824
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'hi' )
824
825
825
826
expect ( module . data ( ) . msg ) . to . contain ( 'Changed!' )
826
- var style = window . document . querySelector ( 'style' ) . textContent
827
+ let style = window . document . querySelector ( 'style' ) . textContent
827
828
style = normalizeNewline ( style )
828
829
expect ( style ) . to . contain ( 'comp-a h2 {\n color: #00f;\n}' )
829
830
done ( )
@@ -846,7 +847,7 @@ describe('vue-loader', function () {
846
847
}
847
848
}
848
849
} , ( window , module ) => {
849
- var vnode = mockRender ( module , {
850
+ const vnode = mockRender ( module , {
850
851
msg : JSON . parse ( module . __i18n ) . en . hello ,
851
852
blog : module . __blog
852
853
} )
@@ -874,7 +875,7 @@ describe('vue-loader', function () {
874
875
]
875
876
}
876
877
} , ( window , module ) => {
877
- var results = [ ]
878
+ const results = [ ]
878
879
// var vnode =
879
880
mockRender (
880
881
Object . assign ( module , { methods : { $processStyle : style => results . push ( style ) } } ) ,
@@ -895,7 +896,7 @@ describe('vue-loader', function () {
895
896
compilerModules : require . resolve ( './fixtures/custom-module' )
896
897
}
897
898
} , ( window , module ) => {
898
- var vnode = mockRender ( module , {
899
+ const vnode = mockRender ( module , {
899
900
msg : 'hi'
900
901
} )
901
902
expect ( vnode . data . staticClass ) . to . equal ( 'red blue' )
@@ -920,7 +921,7 @@ describe('vue-loader', function () {
920
921
}
921
922
}
922
923
} , ( window , module ) => {
923
- var vnode = mockRender ( module )
924
+ const vnode = mockRender ( module )
924
925
expect ( vnode . data . domProps . textContent ) . to . equal ( 'keypath' )
925
926
done ( )
926
927
} )
@@ -931,13 +932,13 @@ describe('vue-loader', function () {
931
932
entry : './test/fixtures/functional-style.vue'
932
933
} , ( window , module , rawModule ) => {
933
934
expect ( module . functional ) . to . equal ( true )
934
- var vnode = mockRender ( module )
935
+ const vnode = mockRender ( module )
935
936
// <div class="foo">hi</div>
936
937
expect ( vnode . tag ) . to . equal ( 'div' )
937
938
expect ( vnode . data . class ) . to . equal ( 'foo' )
938
939
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'functional' )
939
940
940
- var style = window . document . querySelector ( 'style' ) . textContent
941
+ let style = window . document . querySelector ( 'style' ) . textContent
941
942
style = normalizeNewline ( style )
942
943
expect ( style ) . to . contain ( '.foo { color: red;\n}' )
943
944
done ( )
@@ -949,7 +950,7 @@ describe('vue-loader', function () {
949
950
entry : './test/fixtures/template-comment.vue'
950
951
} , ( window , module , rawModule ) => {
951
952
expect ( module . comments ) . to . equal ( true )
952
- var vnode = mockRender ( module , {
953
+ const vnode = mockRender ( module , {
953
954
msg : 'hi'
954
955
} )
955
956
expect ( vnode . tag ) . to . equal ( 'div' )
@@ -969,7 +970,7 @@ describe('vue-loader', function () {
969
970
cacheBusting : false
970
971
}
971
972
} , ( window , module , rawModule ) => {
972
- var vnode = mockRender ( module , {
973
+ const vnode = mockRender ( module , {
973
974
msg : 'hi'
974
975
} )
975
976
@@ -979,7 +980,7 @@ describe('vue-loader', function () {
979
980
expect ( vnode . children [ 0 ] . text ) . to . equal ( 'hi' )
980
981
981
982
expect ( module . data ( ) . msg ) . to . contain ( 'Hello from Component A!' )
982
- var style = window . document . querySelector ( 'style' ) . textContent
983
+ let style = window . document . querySelector ( 'style' ) . textContent
983
984
style = normalizeNewline ( style )
984
985
expect ( style ) . to . contain ( 'comp-a h2 {\n color: #f00;\n}' )
985
986
done ( )
0 commit comments