Closed
Description
Version
- Vue version: 3
Description
We have typical use case: country select, translated to several locales. Options is array of objects:
const options = [{code: 'au', name: 'Autstralia'}]
If we have selected value au
for example in English locale, our label shows Australia
. But when change locale for example to Russian (ru
), and update options, label will remain the same
I wrote test-case for this to clear our problem:
it('should reactively changes label when options has been changed', () => {
let select = createSelect({
value: 'ru',
label: 'name',
valueProp: 'code',
options: [{ code: 'au', name: 'Australia' }, { code: 'ru', name: 'Russia' }, { code: 'us', name: 'USA' }],
})
select.vm.options = [{ code: 'au', name: 'Австралия' }, { code: 'ru', name: 'Россия' }, { code: 'us', name: 'США' }]
expect(select.find('.multiselect-single-label').element).toBeVisible()
expect(select.find('.multiselect-single-label').html()).toContain('Россия') // <---- Fails here, but shouldn't
})
Demo
Metadata
Metadata
Assignees
Labels
No labels