vant/test/unit/specs/toast.spec.js
张敏 034c66a77f 修复表单组件样式和单元测试用例 (#7)
* fix: loading small style, search style and dialog style

* fix: scroll to top

* fix mobile scroll

* fix scroll to top

* 文档细节优化

* unit test

* dialog and image-preview unit test

* fix form component style

* fix radio and checkbox style

* fix search component style
2017-04-24 17:33:40 +08:00

40 lines
900 B
JavaScript

import Toast from 'packages/toast';
describe('Toast', () => {
afterEach(() => {
const el = document.querySelector('.van-toast-wrapper');
if (!el) return;
if (el.parentNode) {
el.parentNode.removeChild(el);
}
Toast.clear();
if (el.__vue__) {
el.__vue__.$destroy();
}
});
it('create a toast', () => {
Toast('我是提示文案,建议不超过十五字~');
expect(document.querySelector('.van-toast-wrapper')).to.exist;
});
it('create a loading toast', () => {
Toast.loading();
expect(document.querySelector('.van-toast-wrapper')).to.exist;
});
it('create a success toast', () => {
Toast.success('success');
expect(document.querySelector('.van-toast-wrapper')).to.exist;
});
it('create a fali toast', () => {
Toast.fail('fail');
expect(document.querySelector('.van-toast-wrapper')).to.exist;
});
});