我想测试我的Vue
组件中的方法,但是我需要为此模拟一些属性数据,稍后以this.$attrs.pattern
的形式访问,等等...我当前的代码是:
let wrapper;
beforeEach(() => {
wrapper = shallowMount(Input);
});
afterEach(() => {
wrapper.destroy();
});
it('should pass pattern check',() => {
// I want to setup pattern attribute here
expect(wrapper.vm.passpatternCheck).toBeTruthy();
});
我原以为会有类似wrapper.setProps()
的东西,但是还找不到。