[new feature] Sidebar: support use v-model to bind active key (#3698)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user