Skip to content

Commit 9262863

Browse files
stevenharmansagalbot
authored andcommitted
Do not hide input while loading options. (sagalbot#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.
1 parent fb2d24f commit 9262863

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/components/Select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@
10801080
*/
10811081
inputClasses() {
10821082
return {
1083-
hidden: !this.isValueEmpty && !this.dropdownOpen
1083+
hidden: !this.isValueEmpty && !this.dropdownOpen && !this.mutableLoading
10841084
}
10851085
},
10861086

test/unit/specs/Select.spec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,6 @@ describe('Select.vue', () => {
16031603
expect(vm.$children[0].inputClasses.hidden).toEqual(true)
16041604
})
16051605

1606-
16071606
it('should not apply the "hidden" class to the search input when a value is present, and the dropdown is open', (done) => {
16081607
const vm = new Vue({
16091608
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
@@ -1623,6 +1622,24 @@ describe('Select.vue', () => {
16231622
})
16241623
})
16251624

1625+
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) => {
1626+
const vm = new Vue({
1627+
template: '<div><v-select ref="select" :options="options" :value="value"></v-select></div>',
1628+
data: {
1629+
value: 'one',
1630+
options: ['one', 'two', 'three'],
1631+
open: true
1632+
}
1633+
}).$mount()
1634+
vm.$refs.select.toggleLoading(true)
1635+
Vue.nextTick(() => {
1636+
Vue.nextTick(() => {
1637+
expect(vm.$children[0].inputClasses.hidden).toEqual(false)
1638+
done()
1639+
})
1640+
})
1641+
})
1642+
16261643
it ('should not reset the search input on focus lost when clearSearchOnSelect is false', (done) => {
16271644
const vm = new Vue({
16281645
template: '<div><v-select ref="select" :options="options" :value="value" :clear-search-on-select="false"></v-select></div>',

0 commit comments

Comments
 (0)