Skip to content

Commit

Permalink
test: add test for thread mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 7, 2018
1 parent 078fa1c commit 8ef70c1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/_book
*.iml
*.log
RELEASE.md
.options-cache-*
2 changes: 1 addition & 1 deletion lib/utils/options-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ function serialize (options) {
}

function getidToOptionsPath (id) {
return path.resolve(__dirname, `.options-idToOptions-${id}`)
return path.resolve(__dirname, `.options-cache-${id}`)
}
24 changes: 24 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,4 +1104,28 @@ describe('vue-loader', () => {
done()
})
})

it('thread mode', done => {
test({
entry: 'basic.vue',
vue: {
threadMode: true
}
}, (window, module, rawModule) => {
const vnode = mockRender(module, {
msg: 'hi'
})

// <h2 class="red">{{msg}}</h2>
expect(vnode.tag).to.equal('h2')
expect(vnode.data.staticClass).to.equal('red')
expect(vnode.children[0].text).to.equal('hi')

expect(module.data().msg).to.contain('Hello from Component A!')
let style = window.document.querySelector('style').textContent
style = normalizeNewline(style)
expect(style).to.contain('comp-a h2 {\n color: #f00;\n}')
done()
})
})
})

0 comments on commit 8ef70c1

Please sign in to comment.