feat(Dialog): add footer slot (#8382)

This commit is contained in:
neverland
2021-03-20 15:47:52 +08:00
committed by GitHub
parent a7bd8d02b3
commit 1865e06a7a
5 changed files with 47 additions and 9 deletions
@@ -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
+13
View File
@@ -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();
});