[improvement] rename packages dir to src (#3659)

This commit is contained in:
neverland
2019-06-27 11:25:57 +08:00
committed by GitHub
parent 8489918dca
commit 75c79b7044
619 changed files with 21 additions and 21 deletions
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders demo correctly 1`] = `
<div>
<div><button class="van-button van-button--primary van-button--normal"><span class="van-button__text">显示消息通知</span></button></div>
<div><button class="van-button van-button--primary van-button--normal"><span class="van-button__text">显示自定义消息通知</span></button></div>
</div>
`;
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`create a notify 1`] = `<div class="van-popup van-popup--top van-notify" style="color: rgb(255, 255, 255); background: rgb(255, 68, 68); z-index: 2000;" name="van-popup-slide-top">test</div>`;
exports[`notify disappear 1`] = `<div class="van-popup van-popup--top van-notify" style="color: red; z-index: 2000; background: blue;" name="van-popup-slide-top">test</div>`;
exports[`notify disappear 2`] = `<div class="van-popup van-popup--top van-notify" style="color: red; z-index: 2000; background: blue; display: none;" name="van-popup-slide-top">test</div>`;
exports[`notify disappear 3`] = `<div class="van-popup van-popup--top van-notify" style="color: rgb(255, 255, 255); z-index: 2001; background: rgb(255, 68, 68);" name="van-popup-slide-top">text2</div>`;
exports[`notify disappear 4`] = `<div class="van-popup van-popup--top van-notify" style="color: rgb(255, 255, 255); z-index: 2001; background: rgb(255, 68, 68); display: none;" name="van-popup-slide-top">text2</div>`;
+4
View File
@@ -0,0 +1,4 @@
import Demo from '../demo';
import demoTest from '../../../test/demo-test';
demoTest(Demo);
+63
View File
@@ -0,0 +1,63 @@
import Notify from '..';
import { transitionStub, later } from '../../../test/utils';
transitionStub();
test('create a notify', async () => {
// should not cause error when call clear before show notify
Notify.clear();
const notify = Notify('test');
await later();
expect(notify.$el.outerHTML).toMatchSnapshot();
});
test('notify disappear', async () => {
const onClose = jest.fn();
const notify = Notify({
message: 'test',
color: 'red',
background: 'blue',
duration: 10,
onClose
});
await later();
expect(notify.$el.outerHTML).toMatchSnapshot();
await later(20);
expect(notify.$el.outerHTML).toMatchSnapshot();
expect(onClose).toHaveBeenCalledTimes(1);
Notify({
message: 'text2',
duration: 0
});
await later();
expect(notify.$el.outerHTML).toMatchSnapshot();
Notify.clear();
await later();
expect(notify.$el.outerHTML).toMatchSnapshot();
});
test('set default options', () => {
Notify.setDefaultOptions({ duration: 1000 });
expect(Notify().duration).toEqual(1000);
Notify.resetDefaultOptions();
expect(Notify().duration).toEqual(3000);
Notify.clear();
});
test('onClick prop', async () => {
const onClick = jest.fn();
const notify = Notify({
message: 'test',
onClick
});
notify.$el.click();
expect(onClick).toHaveBeenCalled();
});