mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Toast): should allow to toggle lockClick class
This commit is contained in:
parent
3cedb085da
commit
0017c352b0
@ -2,7 +2,6 @@ import Vue from 'vue';
|
||||
import Toast from '..';
|
||||
import ToastVue from '../Toast';
|
||||
import { later } from '../../../test';
|
||||
import { lockClick } from '../lock-click';
|
||||
|
||||
test('create a forbidClick toast', async () => {
|
||||
const toast = Toast({
|
||||
@ -188,18 +187,3 @@ test('register component', () => {
|
||||
Vue.use(Toast);
|
||||
expect(Vue.component(ToastVue.name)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('lockClick function', () => {
|
||||
const CLASSNAME = 'van-toast--unclickable';
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeFalsy();
|
||||
|
||||
lockClick(true);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeTruthy();
|
||||
|
||||
lockClick(true);
|
||||
lockClick(false);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeTruthy();
|
||||
|
||||
lockClick(false);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeFalsy();
|
||||
});
|
||||
|
23
src/toast/test/lock-click.spec.js
Normal file
23
src/toast/test/lock-click.spec.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { lockClick } from '../lock-click';
|
||||
|
||||
test('should allow to toggle lockClick class', () => {
|
||||
const CLASSNAME = 'van-toast--unclickable';
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeFalsy();
|
||||
|
||||
lockClick(true);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeTruthy();
|
||||
|
||||
lockClick(true);
|
||||
lockClick(false);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeTruthy();
|
||||
|
||||
lockClick(false);
|
||||
lockClick(false);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeFalsy();
|
||||
|
||||
lockClick(true);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeTruthy();
|
||||
|
||||
lockClick(false);
|
||||
expect(document.body.classList.contains(CLASSNAME)).toBeFalsy();
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user