From 8ef70c1dcde6670171b44a2778a201ff909f9eae Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 7 Mar 2018 00:14:39 -0500 Subject: [PATCH] test: add test for thread mode --- .gitignore | 1 + lib/utils/options-cache.js | 2 +- test/test.js | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a7d34f090..e8ea33d5c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ docs/_book *.iml *.log RELEASE.md +.options-cache-* diff --git a/lib/utils/options-cache.js b/lib/utils/options-cache.js index 7532d07cd..ccc9999f6 100644 --- a/lib/utils/options-cache.js +++ b/lib/utils/options-cache.js @@ -73,5 +73,5 @@ function serialize (options) { } function getidToOptionsPath (id) { - return path.resolve(__dirname, `.options-idToOptions-${id}`) + return path.resolve(__dirname, `.options-cache-${id}`) } diff --git a/test/test.js b/test/test.js index c58bff45e..eaa64b391 100644 --- a/test/test.js +++ b/test/test.js @@ -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' + }) + + //

{{msg}}

+ 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() + }) + }) })