[new feature] Toast: add icon prop (#3485)

This commit is contained in:
neverland
2019-06-12 17:21:59 +08:00
committed by GitHub
parent 2d18f67a7d
commit 153fb9d69f
15 changed files with 185 additions and 48 deletions

View File

@@ -11,6 +11,7 @@ test('create a forbidClick toast', async () => {
type: 'success'
});
await later();
expect(toast.$el.outerHTML).toMatchSnapshot();
await later();
@@ -30,6 +31,35 @@ it('toast disappeared after duration', async () => {
expect(toast.$el.style.display).toEqual('none');
});
test('show loading toast', async () => {
const toast = Toast.loading({
message: 'Message'
});
await later();
expect(toast.$el.outerHTML).toMatchSnapshot();
});
test('show html toast', async () => {
const toast = Toast({
type: 'html',
message: '<div>Message</div>'
});
await later();
expect(toast.$el.outerHTML).toMatchSnapshot();
});
test('icon prop', async () => {
const toast = Toast({
message: 'Message',
icon: 'star-o'
});
await later();
expect(toast.$el.outerHTML).toMatchSnapshot();
});
test('clear toast', () => {
const toast1 = Toast();
expect(toast1.value).toBeTruthy();