A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/2438137c3757b28657e7185432805079ee25c559 below:

set `aria-sort` when using `sortKey` and `no-local-sort… · bootstrap-vue/bootstrap-vue@2438137 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+26

-3

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+26

-3

lines changed Original file line number Diff line number Diff line change

@@ -235,15 +235,19 @@ export const sortingMixin = Vue.extend({

235 235

}

236 236

},

237 237

sortTheadThAttrs(key, field, isFoot) {

238 -

if (!this.isSortable || (isFoot && this.noFooterSorting)) {

238 +

const { isSortable, noFooterSorting, localSortDesc, localSortBy, localSorting } = this

239 +

if (!isSortable || (isFoot && noFooterSorting)) {

239 240

// No attributes if not a sortable table

240 241

return {}

241 242

}

243 + 242 244

const sortable = field.sortable

245 +

const sortKey = !localSorting ? field.sortKey ?? key : key

246 + 243 247

// Assemble the aria-sort attribute value

244 248

const ariaSort =

245 -

sortable && this.localSortBy === key

246 -

? this.localSortDesc

249 +

sortable && localSortBy === sortKey

250 +

? localSortDesc

247 251

? 'descending'

248 252

: 'ascending'

249 253

: sortable

Original file line number Diff line number Diff line change

@@ -63,6 +63,25 @@ describe('table > sorting', () => {

63 63

expect(wrapper.emitted('sort-changed')[0][0].sortBy).toEqual('non-local')

64 64

})

65 65 66 +

it('should set `aria-sort` when `field.sortKey` and `no-local-sorting` is used', async () => {

67 +

const wrapper = mount(BTable, {

68 +

propsData: {

69 +

fields: [...testFields, { key: 'd', label: 'D', sortable: true, sortKey: 'non-local' }],

70 +

items: testItems,

71 +

noLocalSorting: true

72 +

}

73 +

})

74 + 75 +

expect(wrapper).toBeDefined()

76 +

const $header = wrapper.findAll('thead > tr > th').at(3)

77 + 78 +

await $header.trigger('keydown.enter')

79 +

expect(wrapper.emitted('sort-changed').length).toBe(1)

80 +

expect(wrapper.emitted('sort-changed')[0][0].sortBy).toEqual('non-local')

81 + 82 +

expect($header.attributes('aria-sort')).toBe('ascending')

83 +

})

84 + 66 85

it('should sort column descending when sortBy set and sortDesc changed, with proper attributes', async () => {

67 86

const wrapper = mount(BTable, {

68 87

propsData: {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4