Skip to content

Commit f56ba84

Browse files
committed
chores: add test for useCssModule.
1 parent fc0e824 commit f56ba84

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/apis/useCssModule.spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const Vue = require('vue/dist/vue.common.js')
2+
const { useCSSModule } = require('../../src')
3+
4+
const style = { whateverStyle: 'whateverStyle' }
5+
6+
function injectStyles() {
7+
Object.defineProperty(this, '$style', {
8+
configurable: true,
9+
get: function () {
10+
return style
11+
},
12+
})
13+
}
14+
15+
describe('api/useCssModule', () => {
16+
it('should get the same object', (done) => {
17+
const vm = new Vue({
18+
beforeCreate() {
19+
injectStyles.call(this)
20+
},
21+
template: '<div>{{style}}</div>',
22+
setup() {
23+
const style = useCSSModule()
24+
return { style }
25+
},
26+
})
27+
vm.$mount()
28+
expect(vm.style).toBe(style)
29+
done()
30+
})
31+
})

0 commit comments

Comments
 (0)