feat(Dialog): allow to render JSX message (#8420)
* feat(Dialog): allow to render JSX message * types: add DialogMessage type
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`should allow to render JSX message 1`] = `
|
||||
<div class="van-dialog__message">
|
||||
<div>
|
||||
foo
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -49,3 +49,17 @@ test('should close dialog after calling Dialog.call', async () => {
|
||||
'van-dialog-bounce-leave-active'
|
||||
);
|
||||
});
|
||||
|
||||
test('should allow to render JSX message', async () => {
|
||||
const wrapper = document.createElement('div');
|
||||
Dialog.alert({
|
||||
message: () => <div>foo</div>,
|
||||
teleport: wrapper,
|
||||
});
|
||||
|
||||
await later();
|
||||
const dialog = wrapper.querySelector('.van-dialog');
|
||||
expect(
|
||||
dialog.querySelector('.van-dialog__message').outerHTML
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user