mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
Do not hide input while loading options. (#621)
Adding the `.hidden` class to the input while loading would cause it to lose padding. This would cause the text to "jump" back and forth.
This commit is contained in:
committed by
Jeff Sagal
parent
fb2d24f6df
commit
9262863514
@@ -1080,7 +1080,7 @@
|
|||||||
*/
|
*/
|
||||||
inputClasses() {
|
inputClasses() {
|
||||||
return {
|
return {
|
||||||
hidden: !this.isValueEmpty && !this.dropdownOpen
|
hidden: !this.isValueEmpty && !this.dropdownOpen && !this.mutableLoading
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1603,7 +1603,6 @@ describe('Select.vue', () => {
|
|||||||
expect(vm.$children[0].inputClasses.hidden).toEqual(true)
|
expect(vm.$children[0].inputClasses.hidden).toEqual(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
it('should not apply the "hidden" class to the search input when a value is present, and the dropdown is open', (done) => {
|
it('should not apply the "hidden" class to the search input when a value is present, and the dropdown is open', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
|
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
|
||||||
@@ -1623,6 +1622,24 @@ describe('Select.vue', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should not apply the "hidden" class to the search input when a value is present, the dropdown is closed, and options are loading', (done) => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
|
||||||
|
data: {
|
||||||
|
value: 'one',
|
||||||
|
options: ['one', 'two', 'three'],
|
||||||
|
open: true
|
||||||
|
}
|
||||||
|
}).$mount()
|
||||||
|
vm.$refs.select.toggleLoading(true)
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
expect(vm.$children[0].inputClasses.hidden).toEqual(false)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it ('should not reset the search input on focus lost when clearSearchOnSelect is false', (done) => {
|
it ('should not reset the search input on focus lost when clearSearchOnSelect is false', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select ref="select" :options="options" :value="value" :clear-search-on-select="false"></v-select></div>',
|
template: '<div><v-select ref="select" :options="options" :value="value" :clear-search-on-select="false"></v-select></div>',
|
||||||
|
|||||||
Reference in New Issue
Block a user