Skip to content

Commit 9f206fe

Browse files
committed
feat: update input-base disabled behavior
1 parent bfaec20 commit 9f206fe

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/components/Input/Base.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { noCorrect } from '~/utils/input'
33
44
const props = withDefaults(
55
defineProps<{
6+
disabled?: boolean
67
modelValue?: string
78
size?: 'small' | 'medium' | 'large'
89
noCorrect?: boolean
@@ -47,5 +48,9 @@ defineExpose({
4748
'text-sm px-3 py-2.5 h-10 rounded-lg': size === 'medium',
4849
'text-base px-6 py-3.5 h-14 rounded-xl': size === 'large',
4950
}"
51+
:disabled="
52+
/** Catching Vue render-bug of invalid `disabled=false` attribute in the final HTML */
53+
disabled ? true : undefined
54+
"
5055
/>
5156
</template>

test/nuxt/components/Input/Base.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ describe('InputBase', () => {
146146
const input = component.find('input')
147147
expect(input.attributes('disabled')).toBeDefined()
148148
expect((input.element as HTMLInputElement).disabled).toBe(true)
149-
// should add just `disabled`, not `disabled="true"`
150-
expect((input.element as HTMLInputElement).getHTML()).not.toContain('disabled=')
151149
})
152150
})
153151
})

0 commit comments

Comments
 (0)