diff --git a/packages/vant/src/number-keyboard/NumberKeyboard.tsx b/packages/vant/src/number-keyboard/NumberKeyboard.tsx index 2ccd02489..4a702d161 100644 --- a/packages/vant/src/number-keyboard/NumberKeyboard.tsx +++ b/packages/vant/src/number-keyboard/NumberKeyboard.tsx @@ -237,7 +237,7 @@ export default defineComponent({
{props.showDeleteKey && ( + Custom Delete Key +
+`; + +exports[`should render delete slot correctly when theme is custom 1`] = ` +
+ Custom Delete Key +
+`; + exports[`should render extra key correctly when using extra-key prop 1`] = `
{ 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: {