[Improvement] Collapse: add transition animation (#1500)

This commit is contained in:
neverland
2018-07-17 21:33:55 +08:00
committed by GitHub
parent a99e73e07e
commit 9da3e0ce5a
4 changed files with 88 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import Collapse from '..';
import CollapseItem from '../../collapse-item';
import { mount } from '../../../test/utils';
import { later, mount } from '../../../test/utils';
const component = {
template: `
@@ -24,7 +24,7 @@ const component = {
}
};
test('basic mode', () => {
test('basic mode', async() => {
const wrapper = mount(component);
const titles = wrapper.findAll('.van-collapse-item__title');
@@ -34,13 +34,14 @@ test('basic mode', () => {
titles.at(1).trigger('click');
expect(wrapper.vm.active).toEqual(['first', 1]);
await later();
titles.at(0).trigger('click');
expect(wrapper.vm.active).toEqual([1]);
wrapper.destroy();
});
it('accordion', () => {
it('accordion', async() => {
const wrapper = mount(component, {
propsData: {
accordion: true
@@ -54,6 +55,7 @@ it('accordion', () => {
titles.at(1).trigger('click');
expect(wrapper.vm.active).toEqual(1);
await later();
titles.at(0).trigger('click');
expect(wrapper.vm.active).toEqual('first');