diff --git a/app/components/malio/input/InputPhone.test.ts b/app/components/malio/input/InputPhone.test.ts index 67acfe7..b5903b4 100644 --- a/app/components/malio/input/InputPhone.test.ts +++ b/app/components/malio/input/InputPhone.test.ts @@ -274,10 +274,32 @@ describe('MalioInputPhone', () => { expect(wrapper.get('[data-test="add-button"]').attributes('disabled')).toBeDefined() }) - it('disables add button when readonly', () => { + it('add button is not natively disabled in readonly (onAdd guard blocks the action)', () => { const wrapper = mountComponent({addable: true, readonly: true}) - expect(wrapper.get('[data-test="add-button"]').attributes('disabled')).toBeDefined() + expect(wrapper.get('[data-test="add-button"]').attributes('disabled')).toBeUndefined() + }) + + it('readonly : border-black appliqué sur l\'input', () => { + const wrapper = mountComponent({label: 'Tel', readonly: true}) + expect(wrapper.get('input').classes()).toContain('border-black') + }) + + it('readonly : icône en text-m-muted quand vide', () => { + const wrapper = mountComponent({label: 'Tel', readonly: true}) + expect(wrapper.get('[data-test="icon"]').classes()).toContain('text-m-muted') + }) + + it('readonly : icône en text-black quand rempli', () => { + const wrapper = mountComponent({label: 'Tel', readonly: true, modelValue: '+33612345678'}) + expect(wrapper.get('[data-test="icon"]').classes()).toContain('text-black') + }) + + it('readonly : pas d\'apparence désactivée (pas opacity-40)', () => { + const wrapper = mountComponent({label: 'Tel', readonly: true}) + expect(wrapper.get('input').classes()).not.toContain('opacity-40') + // and the input is not natively disabled in readonly: + expect(wrapper.get('input').attributes('disabled')).toBeUndefined() }) it('renders the default add icon (mdi:plus)', () => { diff --git a/app/components/malio/input/InputPhone.vue b/app/components/malio/input/InputPhone.vue index b29c9ba..3f68fec 100644 --- a/app/components/malio/input/InputPhone.vue +++ b/app/components/malio/input/InputPhone.vue @@ -44,7 +44,7 @@