feat(Notify): add type prop (#4237)
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
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><button class="van-button van-button--danger van-button--normal"><span class="van-button__text">基础用法</span></button></div>
|
||||
<div>
|
||||
<div style="margin-bottom: 15px;"><button class="van-button van-button--info van-button--normal"><span class="van-button__text">主要通知</span></button> <button class="van-button van-button--primary van-button--normal"><span class="van-button__text">成功通知</span></button></div> <button class="van-button van-button--danger van-button--normal"><span class="van-button__text">危险通知</span></button> <button class="van-button van-button--warning 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> <button class="van-button van-button--primary van-button--normal"><span class="van-button__text">自定义时长</span></button></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// 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: 2001;" name="van-popup-slide-top">test</div>`;
|
||||
exports[`create a notify 1`] = `<div class="van-popup van-popup--top van-notify van-notify--danger" style="color: rgb(255, 255, 255); z-index: 2001;" 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: 2001; background: blue;" name="van-popup-slide-top">test</div>`;
|
||||
exports[`notify disappear 1`] = `<div class="van-popup van-popup--top van-notify van-notify--danger" style="color: red; z-index: 2001; 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: 2001; background: blue; display: none;" name="van-popup-slide-top">test</div>`;
|
||||
exports[`notify disappear 2`] = `<div class="van-popup van-popup--top van-notify van-notify--danger" style="color: red; z-index: 2001; 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: 2002; background: rgb(255, 68, 68);" name="van-popup-slide-top">text2</div>`;
|
||||
exports[`notify disappear 3`] = `<div class="van-popup van-popup--top van-notify van-notify--danger" style="color: rgb(255, 255, 255); z-index: 2002;" 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: 2002; background: rgb(255, 68, 68); display: none;" name="van-popup-slide-top">text2</div>`;
|
||||
exports[`notify disappear 4`] = `<div class="van-popup van-popup--top van-notify van-notify--danger" style="color: rgb(255, 255, 255); z-index: 2002; display: none;" name="van-popup-slide-top">text2</div>`;
|
||||
|
||||
exports[`type prop 1`] = `<div class="van-popup van-popup--top van-notify van-notify--primary" style="color: rgb(255, 255, 255); z-index: 2001;" name="van-popup-slide-top">test</div>`;
|
||||
|
||||
@@ -11,6 +11,16 @@ test('create a notify', async () => {
|
||||
expect(notify.$el.outerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('type prop', async () => {
|
||||
const notify = Notify({
|
||||
message: 'test',
|
||||
type: 'primary'
|
||||
});
|
||||
|
||||
await later();
|
||||
expect(notify.$el.outerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('notify disappear', async () => {
|
||||
const onClose = jest.fn();
|
||||
const notify = Notify({
|
||||
|
||||
Reference in New Issue
Block a user