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/d4e66fa48fdd1cd7fd4b93907fe999de3fc577f8 below:

better sort labeling for screen readers (closes #4487)… · bootstrap-vue/bootstrap-vue@d4e66fa · GitHub

@@ -77,17 +77,32 @@ describe('table > sorting', () => {

77 77

// Currently sorted as ascending

78 78

expect($ths.at(0).attributes('aria-sort')).toBe('ascending')

79 79

// For switching to descending

80 -

expect($ths.at(0).attributes('aria-label')).toBe(wrapper.vm.labelSortDesc)

80 +

expect(

81 +

$ths

82 +

.at(0)

83 +

.find('.sr-only')

84 +

.text()

85 +

).toContain(wrapper.vm.labelSortDesc)

81 86 82 87

// Not sorted by this column

83 88

expect($ths.at(1).attributes('aria-sort')).toBe('none')

84 89

// For sorting by ascending

85 -

expect($ths.at(1).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

90 +

expect(

91 +

$ths

92 +

.at(1)

93 +

.find('.sr-only')

94 +

.text()

95 +

).toContain(wrapper.vm.labelSortAsc)

86 96 87 97

// Not a sortable column

88 98

expect($ths.at(2).attributes('aria-sort')).not.toBeDefined()

89 99

// For clearing sorting

90 -

expect($ths.at(2).attributes('aria-label')).toBe(wrapper.vm.labelSortClear)

100 +

expect(

101 +

$ths

102 +

.at(2)

103 +

.find('.sr-only')

104 +

.text()

105 +

).toContain(wrapper.vm.labelSortClear)

91 106 92 107

// Change sort direction

93 108

wrapper.setProps({

@@ -113,17 +128,32 @@ describe('table > sorting', () => {

113 128

// Currently sorted as descending

114 129

expect($ths.at(0).attributes('aria-sort')).toBe('descending')

115 130

// For switching to ascending

116 -

expect($ths.at(0).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

131 +

expect(

132 +

$ths

133 +

.at(0)

134 +

.find('.sr-only')

135 +

.text()

136 +

).toContain(wrapper.vm.labelSortAsc)

117 137 118 138

// Not sorted by this column

119 139

expect($ths.at(1).attributes('aria-sort')).toBe('none')

120 140

// For sorting by ascending

121 -

expect($ths.at(1).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

141 +

expect(

142 +

$ths

143 +

.at(1)

144 +

.find('.sr-only')

145 +

.text()

146 +

).toContain(wrapper.vm.labelSortAsc)

122 147 123 148

// Not a sortable column

124 149

expect($ths.at(2).attributes('aria-sort')).not.toBeDefined()

125 150

// For clearing sorting

126 -

expect($ths.at(2).attributes('aria-label')).toBe(wrapper.vm.labelSortClear)

151 +

expect(

152 +

$ths

153 +

.at(2)

154 +

.find('.sr-only')

155 +

.text()

156 +

).toContain(wrapper.vm.labelSortClear)

127 157 128 158

// Clear sort

129 159

wrapper.setProps({

@@ -150,17 +180,32 @@ describe('table > sorting', () => {

150 180

// Currently not sorted

151 181

expect($ths.at(0).attributes('aria-sort')).toBe('none')

152 182

// For sorting by ascending

153 -

expect($ths.at(0).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

183 +

expect(

184 +

$ths

185 +

.at(0)

186 +

.find('.sr-only')

187 +

.text()

188 +

).toContain(wrapper.vm.labelSortAsc)

154 189 155 190

// Not sorted by this column

156 191

expect($ths.at(1).attributes('aria-sort')).toBe('none')

157 192

// For sorting by ascending

158 -

expect($ths.at(1).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

193 +

expect(

194 +

$ths

195 +

.at(1)

196 +

.find('.sr-only')

197 +

.text()

198 +

).toContain(wrapper.vm.labelSortAsc)

159 199 160 200

// Not a sortable column

161 201

expect($ths.at(2).attributes('aria-sort')).not.toBeDefined()

162 202

// For clearing sorting

163 -

expect($ths.at(2).attributes('aria-label')).not.toBeDefined()

203 +

expect(

204 +

$ths

205 +

.at(2)

206 +

.find('.sr-only')

207 +

.exists()

208 +

).toBe(false)

164 209 165 210

wrapper.destroy()

166 211

})

@@ -351,7 +396,7 @@ describe('table > sorting', () => {

351 396

expect(columnA[2]).toBe('2')

352 397

// Should have aria-* labels

353 398

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(2)

354 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(2)

399 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(2)

355 400 356 401

// Sort by first column

357 402

wrapper

@@ -376,7 +421,7 @@ describe('table > sorting', () => {

376 421

expect(columnA[2]).toBe('3')

377 422

// Should have aria-* labels

378 423

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(2)

379 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(3)

424 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(3)

380 425 381 426

// Click first column header again to reverse sort

382 427

wrapper

@@ -400,7 +445,7 @@ describe('table > sorting', () => {

400 445

expect(columnA[2]).toBe('1')

401 446

// Should have aria-* labels

402 447

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(2)

403 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(3)

448 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(3)

404 449 405 450

// Click second column header to sort by it (by using keydown.enter)

406 451

wrapper

@@ -445,7 +490,7 @@ describe('table > sorting', () => {

445 490

expect(columnA[2]).toBe('2')

446 491

// Should have aria-* labels

447 492

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(2)

448 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(2)

493 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(2)

449 494 450 495

wrapper.destroy()

451 496

})

@@ -483,7 +528,7 @@ describe('table > sorting', () => {

483 528

expect(columnA[2]).toBe('2')

484 529

// Shouldn't have aria-* labels

485 530

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(0)

486 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(0)

531 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(0)

487 532 488 533

// Click first column

489 534

wrapper

@@ -506,7 +551,7 @@ describe('table > sorting', () => {

506 551

expect(columnA[2]).toBe('2')

507 552

// Shouldn't have aria-* labels

508 553

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(0)

509 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(0)

554 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(0)

510 555 511 556

// Click third column header

512 557

wrapper

@@ -529,7 +574,7 @@ describe('table > sorting', () => {

529 574

expect(columnA[2]).toBe('2')

530 575

// Shouldn't have aria-* labels

531 576

expect(wrapper.findAll('tfoot > tr > th[aria-sort]').length).toBe(0)

532 -

expect(wrapper.findAll('tfoot > tr > th[aria-label]').length).toBe(0)

577 +

expect(wrapper.findAll('tfoot > tr > th > .sr-only').length).toBe(0)

533 578 534 579

wrapper.destroy()

535 580

})

@@ -568,17 +613,32 @@ describe('table > sorting', () => {

568 613

// Currently not sorted

569 614

expect($ths.at(0).attributes('aria-sort')).toBe('none')

570 615

// For switching to descending

571 -

expect($ths.at(0).attributes('aria-label')).toBe(wrapper.vm.labelSortDesc)

616 +

expect(

617 +

$ths

618 +

.at(0)

619 +

.find('.sr-only')

620 +

.text()

621 +

).toContain(wrapper.vm.labelSortDesc)

572 622 573 623

// Not sorted by this column

574 624

expect($ths.at(1).attributes('aria-sort')).toBe('none')

575 625

// For sorting by ascending

576 -

expect($ths.at(1).attributes('aria-label')).toBe(wrapper.vm.labelSortDesc)

626 +

expect(

627 +

$ths

628 +

.at(1)

629 +

.find('.sr-only')

630 +

.text()

631 +

).toContain(wrapper.vm.labelSortDesc)

577 632 578 633

// Not a sortable column

579 634

expect($ths.at(2).attributes('aria-sort')).not.toBeDefined()

580 635

// For clearing sorting

581 -

expect($ths.at(2).attributes('aria-label')).not.toBeDefined()

636 +

expect(

637 +

$ths

638 +

.at(2)

639 +

.find('.sr-only')

640 +

.exists()

641 +

).toBe(false)

582 642 583 643

// Change sort direction (should be descending first)

584 644

wrapper

@@ -605,17 +665,32 @@ describe('table > sorting', () => {

605 665

// Currently sorted as descending

606 666

expect($ths.at(0).attributes('aria-sort')).toBe('descending')

607 667

// For switching to ascending

608 -

expect($ths.at(0).attributes('aria-label')).toBe(wrapper.vm.labelSortAsc)

668 +

expect(

669 +

$ths

670 +

.at(0)

671 +

.find('.sr-only')

672 +

.text()

673 +

).toContain(wrapper.vm.labelSortAsc)

609 674 610 675

// Not sorted by this column

611 676

expect($ths.at(1).attributes('aria-sort')).toBe('none')

612 677

// For sorting by ascending

613 -

expect($ths.at(1).attributes('aria-label')).toBe(wrapper.vm.labelSortDesc)

678 +

expect(

679 +

$ths

680 +

.at(1)

681 +

.find('.sr-only')

682 +

.text()

683 +

).toContain(wrapper.vm.labelSortDesc)

614 684 615 685

// Not a sortable column

616 686

expect($ths.at(2).attributes('aria-sort')).not.toBeDefined()

617 687

// For clearing sorting

618 -

expect($ths.at(2).attributes('aria-label')).toBe(wrapper.vm.labelSortClear)

688 +

expect(

689 +

$ths

690 +

.at(2)

691 +

.find('.sr-only')

692 +

.text()

693 +

).toContain(wrapper.vm.labelSortClear)

619 694 620 695

wrapper.destroy()

621 696

})


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