Skip to content

Commit a05c5cf

Browse files
author
Sergii Naumov
committed
Tests for the script import
1 parent 483cb50 commit a05c5cf

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

test/fixtures/script-import-entry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
window.testModule = require('./script-import.vue')

test/fixtures/script-import.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
data () {
3+
return {
4+
msg: 'Hello from Component A!'
5+
}
6+
}
7+
};

test/fixtures/script-import.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<script src="./script-import.js"></script>

test/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ describe('vue-loader', function () {
130130
})
131131
})
132132

133+
it('script import', function (done) {
134+
test({
135+
entry: './test/fixtures/script-import-entry.js'
136+
}, function (window) {
137+
var module = window.testModule
138+
expect(module.data().msg).to.contain('Hello from Component A!')
139+
done()
140+
})
141+
})
142+
133143
it('source map', function (done) {
134144
var config = Object.assign({}, globalConfig, {
135145
entry: './test/fixtures/basic.js',

0 commit comments

Comments
 (0)