在我的App?vue模板中,我有一个自定义指令( v-noise )
// App.vue
<template>
<div id="app" class="container" v-noise="'brown'">
<...>
</div>
</template>
测试我的插件,我没有在console.log中看到该指令
import Vue from 'vue'
import App from '@/App'
import VueNoiseGeneratorPlugin from '@/plugins/VueNoiseGeneratorPlugin'
import sinon from 'sinon'
import { mount } from 'avoriaz'
Vue.use(VueNoiseGeneratorPlugin)
...
describe('VueNoiseGeneratorPlugin', () => {
let wrapper
let audioContext = sinon.mock(new (window.AudioContext || window.webkitAudioContext)())
beforeEach(() => {
wrapper = mount(App)
})
it('should start noise', () => {
console.log('WRAPPER.VM.$EL: ', wrapper.vm.$el)
Vue.noise.start()
audioContext.expects('resume').once()
})
})
没有v-noise指令
'WRAPPER.VM.$EL: ', <div data-v-ee77fb84="" id="app" class="container">
<h2 data-v-ee77fb84=""><span data-v-ee77fb84="">POMODORO </span>
<span data-v-c15acdbe="" data-v-ee77fb84=""><button data-v-c15acdbe="">
....
我希望能够更改指令(更改噪音的颜色) 反馈欢迎