mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
fix(NumberKeyboard): render delete slot correctly when theme is custom (#12624)
This commit is contained in:
parent
989a90a329
commit
6640f6bf3c
@ -237,7 +237,7 @@ export default defineComponent({
|
||||
<div class={bem('sidebar')}>
|
||||
{props.showDeleteKey && (
|
||||
<NumberKeyboardKey
|
||||
v-slots={{ delete: slots.delete }}
|
||||
v-slots={{ default: slots.delete }}
|
||||
large
|
||||
text={props.deleteButtonText}
|
||||
type="delete"
|
||||
|
@ -1,5 +1,25 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`should render delete slot correctly 1`] = `
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="van-key van-key--delete"
|
||||
>
|
||||
Custom Delete Key
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render delete slot correctly when theme is custom 1`] = `
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="van-key van-key--large van-key--delete"
|
||||
>
|
||||
Custom Delete Key
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render extra key correctly when using extra-key prop 1`] = `
|
||||
<div
|
||||
role="button"
|
||||
|
@ -105,6 +105,29 @@ test('should render extra-key slot correctly', () => {
|
||||
expect(wrapper.findAll('.van-key')[9].html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render delete slot correctly', () => {
|
||||
const wrapper = mount(NumberKeyboard, {
|
||||
slots: {
|
||||
delete: () => 'Custom Delete Key',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.find('.van-key--delete').html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render delete slot correctly when theme is custom', () => {
|
||||
const wrapper = mount(NumberKeyboard, {
|
||||
props: {
|
||||
theme: 'custom',
|
||||
},
|
||||
slots: {
|
||||
delete: () => 'Custom Delete Key',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.find('.van-key--delete').html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should emit blur event after clicking outside', () => {
|
||||
const wrapper = mount(NumberKeyboard, {
|
||||
props: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user