From d31dd79d7ccd3ada947f5622069c16bae61e6ce5 Mon Sep 17 00:00:00 2001 From: Reeska Date: Sat, 21 Dec 2024 21:51:56 +0100 Subject: [PATCH] fix(PinInput): display placeholders after resetting pin value programmatically --- .../radix-vue/src/PinInput/PinInput.test.ts | 17 +++++++++++++++++ .../radix-vue/src/PinInput/PinInputInput.vue | 9 ++++++++- .../src/PinInput/story/PinInput.story.vue | 12 ++++++++++++ .../radix-vue/src/PinInput/story/_PinInput.vue | 8 ++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/packages/radix-vue/src/PinInput/PinInput.test.ts b/packages/radix-vue/src/PinInput/PinInput.test.ts index 9e5ff6b7a..89eca0332 100644 --- a/packages/radix-vue/src/PinInput/PinInput.test.ts +++ b/packages/radix-vue/src/PinInput/PinInput.test.ts @@ -144,6 +144,23 @@ describe('given default PinInput', () => { expect(wrapper.emitted('complete')?.[0]?.[0]).toStrictEqual(['a', 'p', 'p', 'l', 'e']) }) }) + + describe('after resetting value', async () => { + beforeEach(async () => { + await userEvent.keyboard('apple') + const button = wrapper.find('button').element + button.focus() + button.click() + }) + + it('should display input placeholders', () => { + expect(inputs[0].element.placeholder).toBe('*') + expect(inputs[1].element.placeholder).toBe('*') + expect(inputs[2].element.placeholder).toBe('*') + expect(inputs[3].element.placeholder).toBe('*') + expect(inputs[4].element.placeholder).toBe('*') + }) + }) }) describe('give PinInput type=number', async () => { diff --git a/packages/radix-vue/src/PinInput/PinInputInput.vue b/packages/radix-vue/src/PinInput/PinInputInput.vue index 3aff8bdb9..c2ea4e572 100644 --- a/packages/radix-vue/src/PinInput/PinInputInput.vue +++ b/packages/radix-vue/src/PinInput/PinInputInput.vue @@ -12,7 +12,7 @@ export interface PinInputInputProps extends PrimitiveProps {