Skip to content

Commit 86e0298

Browse files
committed
test: add test case for #1081 (custom block default export)
1 parent 7459a87 commit 86e0298

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

test/fixtures/custom-blocks.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ ja:
77

88
<blog>## foo</blog>
99

10+
<esm>
11+
export default function (Component) {
12+
Component.options.foo = 1
13+
}
14+
</esm>
15+
1016
<template>
1117
<div>
1218
<h1>{{ msg }}</h1>

test/mock-loaders/identity.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function (source, map) {
2+
this.callback(null, source, map)
3+
}

test/test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,21 @@ describe('vue-loader', () => {
782782
})
783783
})
784784

785+
it('custom blocks with ES module default export', done => {
786+
test({
787+
entry: './test/fixtures/custom-blocks.vue',
788+
vue: {
789+
loaders: {
790+
esm: require.resolve('./mock-loaders/identity')
791+
}
792+
}
793+
}, (window, module) => {
794+
// option added by custom block code
795+
expect(module.foo).to.equal(1)
796+
done()
797+
})
798+
})
799+
785800
it('passes attributes as options to the loader', done => {
786801
bundle({
787802
entry: './test/fixtures/custom-options.vue',

0 commit comments

Comments
 (0)