Skip to content

Commit 8ef70c1

Browse files
committed
test: add test for thread mode
1 parent 078fa1c commit 8ef70c1

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ docs/_book
77
*.iml
88
*.log
99
RELEASE.md
10+
.options-cache-*

lib/utils/options-cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ function serialize (options) {
7373
}
7474

7575
function getidToOptionsPath (id) {
76-
return path.resolve(__dirname, `.options-idToOptions-${id}`)
76+
return path.resolve(__dirname, `.options-cache-${id}`)
7777
}

test/test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,4 +1104,28 @@ describe('vue-loader', () => {
11041104
done()
11051105
})
11061106
})
1107+
1108+
it('thread mode', done => {
1109+
test({
1110+
entry: 'basic.vue',
1111+
vue: {
1112+
threadMode: true
1113+
}
1114+
}, (window, module, rawModule) => {
1115+
const vnode = mockRender(module, {
1116+
msg: 'hi'
1117+
})
1118+
1119+
// <h2 class="red">{{msg}}</h2>
1120+
expect(vnode.tag).to.equal('h2')
1121+
expect(vnode.data.staticClass).to.equal('red')
1122+
expect(vnode.children[0].text).to.equal('hi')
1123+
1124+
expect(module.data().msg).to.contain('Hello from Component A!')
1125+
let style = window.document.querySelector('style').textContent
1126+
style = normalizeNewline(style)
1127+
expect(style).to.contain('comp-a h2 {\n color: #f00;\n}')
1128+
done()
1129+
})
1130+
})
11071131
})

0 commit comments

Comments
 (0)