fix test for InputUsername.spec.js

This commit is contained in:
ogerly 2023-06-28 10:12:44 +02:00
parent 94b62293fc
commit d241eb5249
2 changed files with 5 additions and 3 deletions

View File

@ -29,17 +29,18 @@ describe('UserName Form', () => {
wrapper = Wrapper()
})
it('renders the component', () => {
expect(wrapper.find('div.input-username').exists()).toBeTruthy()
expect(wrapper.find('[data-test="username"]').exists()).toBeTruthy()
})
describe('currentValue', () => {
beforeEach(async () => {
wrapper = Wrapper()
await wrapper.setProps({ value: 'petra' })
await wrapper.find('div.input-username.input[type="text"]').setValue('petra swastiska')
await wrapper.find('[data-test="username"]').setValue('petra')
})
it('emits input event with the current value', () => {
expect(wrapper.emitted('input')).toEqual([['petra swastiska']])
expect(wrapper.emitted('input')).toEqual([['petra']])
})
})
})

View File

@ -20,6 +20,7 @@
type="text"
:state="validated ? valid : false"
autocomplete="off"
data-test="username"
></b-form-input>
<b-input-group-append>
<b-button