Skip to content

Commit ddc2006

Browse files
authored
fix(table): fix broken aria-labels for sortable columns + break out code into additional mixins + tests (#2884)
1 parent 61b75dc commit ddc2006

35 files changed

+2590
-1791
lines changed

src/components/form-select/form-select.spec.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,35 @@ describe('form-select', () => {
433433
wrapper.destroy()
434434
})
435435

436+
it('updating v-model (value) when selects correct option', async () => {
437+
const wrapper = mount(Select, {
438+
propsData: {
439+
options: ['one', 'two', { text: 'three', value: { three: 3 } }],
440+
value: 'one'
441+
}
442+
})
443+
const $options = wrapper.findAll('option')
444+
expect($options.length).toBe(3)
445+
446+
expect($options.at(0).element.selected).toBe(true)
447+
448+
// select 2nd option
449+
wrapper.setProps({
450+
value: 'two'
451+
})
452+
453+
expect($options.at(1).element.selected).toBe(true)
454+
455+
// select 3rd option
456+
wrapper.setProps({
457+
value: { three: 3 }
458+
})
459+
460+
expect($options.at(2).element.selected).toBe(true)
461+
462+
wrapper.destroy()
463+
})
464+
436465
it('updates v-model when option selected in single mode with complex values', async () => {
437466
const wrapper = mount(Select, {
438467
propsData: {

src/components/pagination/pagination.spec.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,35 @@ describe('pagination', () => {
134134
wrapper.destroy()
135135
})
136136

137+
it('renders corerct number of elements when total-rows changes', async () => {
138+
const wrapper = mount(Pagination, {
139+
propsData: {
140+
size: 'sm',
141+
totalRows: 1,
142+
perPage: 1,
143+
limit: 10
144+
}
145+
})
146+
expect(wrapper.is('ul')).toBe(true)
147+
expect(wrapper.findAll('li').length).toBe(5)
148+
149+
wrapper.setProps({
150+
totalRows: 4
151+
})
152+
153+
expect(wrapper.is('ul')).toBe(true)
154+
expect(wrapper.findAll('li').length).toBe(8)
155+
156+
wrapper.setProps({
157+
perPage: 2
158+
})
159+
160+
expect(wrapper.is('ul')).toBe(true)
161+
expect(wrapper.findAll('li').length).toBe(6)
162+
163+
wrapper.destroy()
164+
})
165+
137166
it('has class "pagination-sm" when prop size="sm"', async () => {
138167
const wrapper = mount(Pagination, {
139168
propsData: {

src/components/table/README.md

Lines changed: 105 additions & 86 deletions
Large diffs are not rendered by default.

src/components/table/fixtures/table.html

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/components/table/fixtures/table.js

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)