feat(Dialog): add footer slot (#8382)
This commit is contained in:
@@ -29,6 +29,20 @@ exports[`should render default slot correctly 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render footer slot correctly 1`] = `
|
||||
<div class="van-popup van-popup--center van-dialog"
|
||||
role="dialog"
|
||||
aria-labelledby="message"
|
||||
>
|
||||
<div class="van-dialog__content van-dialog__content--isolated">
|
||||
<div class="van-dialog__message">
|
||||
message
|
||||
</div>
|
||||
</div>
|
||||
Custom Footer
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render title slot correctly 1`] = `
|
||||
<div class="van-dialog__header van-dialog__header--isolated">
|
||||
Custom Title
|
||||
|
||||
@@ -129,3 +129,16 @@ test('should update width when using width prop', async () => {
|
||||
const dialog = wrapper.find('.van-dialog').element;
|
||||
expect(dialog.style.width).toEqual('200px');
|
||||
});
|
||||
|
||||
test('should render footer slot correctly', () => {
|
||||
const wrapper = mount(Dialog, {
|
||||
props: {
|
||||
show: true,
|
||||
message: 'message',
|
||||
},
|
||||
slots: {
|
||||
footer: () => 'Custom Footer',
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('.van-dialog').html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user