[new feature] Sidebar: support use v-model to bind active key (#3698)

This commit is contained in:
neverland
2019-06-30 09:43:54 +08:00
committed by GitHub
parent 531fa6681e
commit a7b4b4c219
6 changed files with 55 additions and 54 deletions
+23
View File
@@ -27,6 +27,29 @@ test('click event & change event', () => {
wrapper.vm.$destroy();
});
test('v-model', () => {
const wrapper = mount({
template: `
<sidebar v-model="active">
<sidebar-item>Text</sidebar-item>
<sidebar-item>Text</sidebar-item>
</sidebar>
`,
components: {
Sidebar,
SidebarItem
},
data() {
return {
active: 0
};
}
});
wrapper.findAll('.van-sidebar-item').at(1).trigger('click');
expect(wrapper.vm.active).toEqual(1);
});
test('without parent', () => {
const consoleError = console.error;
try {