2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

fix tests

This commit is contained in:
Jeff Sagal
2021-08-01 13:15:23 -07:00
parent de50b8917c
commit c54c398c56
4 changed files with 24 additions and 13 deletions
+16 -11
View File
@@ -12,7 +12,7 @@
role="combobox" role="combobox"
:aria-expanded="dropdownOpen.toString()" :aria-expanded="dropdownOpen.toString()"
:aria-owns="`vs${uid}__listbox`" :aria-owns="`vs${uid}__listbox`"
aria-label="Search for option" :aria-label="i18n.search.ariaLabel"
@mousedown="toggleDropdown($event)" @mousedown="toggleDropdown($event)"
> >
<div ref="selectedOptions" class="vs__selected-options"> <div ref="selectedOptions" class="vs__selected-options">
@@ -37,8 +37,10 @@
:disabled="disabled" :disabled="disabled"
type="button" type="button"
class="vs__deselect" class="vs__deselect"
:title="`Deselect ${getOptionLabel(option)}`" :title="i18n.deselectButton.title(getOptionLabel(option))"
:aria-label="`Deselect ${getOptionLabel(option)}`" :aria-label="
i18n.deselectButton.ariaLabel(getOptionLabel(option))
"
@click="deselect(option)" @click="deselect(option)"
> >
<component :is="childComponents.Deselect" /> <component :is="childComponents.Deselect" />
@@ -78,7 +80,9 @@
</slot> </slot>
<slot name="spinner" v-bind="scope.spinner"> <slot name="spinner" v-bind="scope.spinner">
<div v-show="mutableLoading" class="vs__spinner">Loading...</div> <div v-show="mutableLoading" class="vs__spinner">
{{ i18n.spinner.text }}
</div>
</slot> </slot>
</div> </div>
</div> </div>
@@ -116,9 +120,9 @@
</slot> </slot>
</li> </li>
<li v-if="filteredOptions.length === 0" class="vs__no-options"> <li v-if="filteredOptions.length === 0" class="vs__no-options">
<slot name="no-options" v-bind="scope.noOptions" <slot name="no-options" v-bind="scope.noOptions">
>Sorry, no matching options.</slot {{ i18n.noOptions.text }}
> </slot>
</li> </li>
<slot name="list-footer" v-bind="scope.listFooter" /> <slot name="list-footer" v-bind="scope.listFooter" />
</ul> </ul>
@@ -134,9 +138,10 @@
</template> </template>
<script> <script>
import pointerScroll from '../mixins/pointerScroll' import ajax from '../mixins/ajax.js'
import typeAheadPointer from '../mixins/typeAheadPointer' import i18n from '../mixins/i18n.js'
import ajax from '../mixins/ajax' import pointerScroll from '../mixins/pointerScroll.js'
import typeAheadPointer from '../mixins/typeAheadPointer.js'
import childComponents from './childComponents' import childComponents from './childComponents'
import appendToBody from '../directives/appendToBody' import appendToBody from '../directives/appendToBody'
import sortAndStringify from '../utility/sortAndStringify' import sortAndStringify from '../utility/sortAndStringify'
@@ -150,7 +155,7 @@ export default {
directives: { appendToBody }, directives: { appendToBody },
mixins: [pointerScroll, typeAheadPointer, ajax], mixins: [pointerScroll, typeAheadPointer, ajax, i18n],
props: { props: {
/** /**
+5 -1
View File
@@ -1,3 +1,5 @@
const deselectLabel = (label) => `Deselect ${label}`
export const text = { export const text = {
spinner: { spinner: {
text: 'Loading...', text: 'Loading...',
@@ -10,10 +12,12 @@ export const text = {
}, },
selectedOption: {}, selectedOption: {},
deselectButton: { deselectButton: {
ariaLabel: (label) => 'Deselect Option', ariaLabel: deselectLabel,
title: deselectLabel,
}, },
clearButton: { clearButton: {
ariaLabel: 'Clear Selection', ariaLabel: 'Clear Selection',
title: 'Clear Selection',
}, },
} }
+2
View File
@@ -4,3 +4,5 @@ import pointer from './typeAheadPointer'
import pointerScroll from './pointerScroll' import pointerScroll from './pointerScroll'
export default { ajax, pointer, pointerScroll, i18n } export default { ajax, pointer, pointerScroll, i18n }
// export const mixins = [ajax, i18n, pointer, pointerScroll]
+1 -1
View File
@@ -25,7 +25,7 @@ describe('International Text', () => {
it('renders default text for deselect.ariaLabel', () => { it('renders default text for deselect.ariaLabel', () => {
const Select = mountDefault({ value: 'one', multiple: true }) const Select = mountDefault({ value: 'one', multiple: true })
expect(Select.find('.vs__deselect').attributes()['aria-label']).toBe( expect(Select.find('.vs__deselect').attributes()['aria-label']).toBe(
'Deselect Option' 'Deselect one'
) )
}) })
}) })