-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editors: Add configurations for accessibility testing (#27317)
- Loading branch information
1 parent
221af3b
commit 3215f3c
Showing
7 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
e2e/testcafe-devextreme/tests/accessibility/fileUploader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Properties } from 'devextreme/ui/file_uploader.d'; | ||
import url from '../../helpers/getPageUrl'; | ||
import { testAccessibility, Configuration } from '../../helpers/accessibility/test'; | ||
import { Options } from '../../helpers/generateOptionMatrix'; | ||
|
||
fixture.disablePageReloads`Accessibility` | ||
.page(url(__dirname, '../container.html')); | ||
|
||
const file: File[] = [{ | ||
lastModified: Date.now(), | ||
name: 'Item_1.png', | ||
type: 'image/png', | ||
size: 1024, | ||
webkitRelativePath: '', | ||
slice: () => new Blob(), | ||
stream: () => new ReadableStream(), | ||
text: () => Promise.resolve('File text'), | ||
arrayBuffer: () => Promise.resolve(new ArrayBuffer(1024)), | ||
}]; | ||
|
||
const options: Options<Properties> = { | ||
value: [undefined, file], | ||
multiple: [true, false], | ||
disabled: [true, false], | ||
readOnly: [true, false], | ||
hint: [undefined, 'hint'], | ||
name: ['', 'name'], | ||
focusStateEnabled: [true], | ||
inputAttr: [{ 'aria-label': 'aria-label' }], | ||
}; | ||
|
||
const a11yCheckConfig = { | ||
// NOTE: color-contrast issues | ||
rules: { 'color-contrast': { enabled: false } }, | ||
}; | ||
|
||
const configuration: Configuration = { | ||
component: 'dxFileUploader', | ||
a11yCheckConfig, | ||
options, | ||
}; | ||
|
||
testAccessibility(configuration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Properties } from 'devextreme/ui/html_editor.d'; | ||
import { Selector } from 'testcafe'; | ||
import url from '../../helpers/getPageUrl'; | ||
import { defaultSelector, testAccessibility, Configuration } from '../../helpers/accessibility/test'; | ||
import { Options } from '../../helpers/generateOptionMatrix'; | ||
|
||
fixture.disablePageReloads`Accessibility` | ||
.page(url(__dirname, '../container.html')); | ||
|
||
const markup = '<p>He<em>llo</em></p>'; | ||
|
||
const options: Options<Properties> = { | ||
value: [undefined, markup], | ||
readOnly: [true, false], | ||
hint: [undefined, 'hint'], | ||
name: ['', 'name'], | ||
height: [undefined, 300], | ||
width: [undefined, 300], | ||
placeholder: ['', 'placeholder'], | ||
focusStateEnabled: [true], | ||
toolbar: [ | ||
undefined, | ||
{ | ||
items: ['bold', 'color'], | ||
}, | ||
], | ||
}; | ||
|
||
const created = async (t: TestController): Promise<void> => { | ||
await t.click(Selector(defaultSelector)); | ||
}; | ||
|
||
const a11yCheckConfig = { | ||
// NOTE: color-contrast issues | ||
rules: { 'color-contrast': { enabled: false } }, | ||
}; | ||
|
||
const configuration: Configuration = { | ||
component: 'dxHtmlEditor', | ||
a11yCheckConfig, | ||
options, | ||
created, | ||
}; | ||
|
||
testAccessibility(configuration); |
30 changes: 30 additions & 0 deletions
30
e2e/testcafe-devextreme/tests/accessibility/progressBar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Properties } from 'devextreme/ui/progress_bar.d'; | ||
import url from '../../helpers/getPageUrl'; | ||
import { testAccessibility, Configuration } from '../../helpers/accessibility/test'; | ||
import { Options } from '../../helpers/generateOptionMatrix'; | ||
|
||
fixture.disablePageReloads`Accessibility` | ||
.page(url(__dirname, '../container.html')); | ||
|
||
const options: Options<Properties> = { | ||
value: [undefined, 45], | ||
min: [0], | ||
max: [100], | ||
disabled: [true, false], | ||
hint: [undefined, 'hint'], | ||
showStatus: [true, false], | ||
elementAttr: [{ 'aria-label': 'Progress Bar' }], | ||
}; | ||
|
||
const a11yCheckConfig = { | ||
// NOTE: color-contrast issues | ||
rules: { 'color-contrast': { enabled: false } }, | ||
}; | ||
|
||
const configuration: Configuration = { | ||
component: 'dxProgressBar', | ||
a11yCheckConfig, | ||
options, | ||
}; | ||
|
||
testAccessibility(configuration); |
52 changes: 52 additions & 0 deletions
52
e2e/testcafe-devextreme/tests/accessibility/rangeSlider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Properties } from 'devextreme/ui/range_slider.d'; | ||
import url from '../../helpers/getPageUrl'; | ||
import { testAccessibility, Configuration } from '../../helpers/accessibility/test'; | ||
import { Options } from '../../helpers/generateOptionMatrix'; | ||
|
||
fixture.disablePageReloads`Accessibility` | ||
.page(url(__dirname, '../container.html')); | ||
|
||
const options: Options<Properties> = { | ||
start: [40], | ||
end: [60], | ||
disabled: [true, false], | ||
readOnly: [true, false], | ||
hint: [undefined, 'hint'], | ||
height: [undefined, 250], | ||
width: [undefined, '50%'], | ||
focusStateEnabled: [true], | ||
label: [ | ||
undefined, | ||
{ | ||
visible: true, | ||
format(value) { | ||
return `${value}%`; | ||
}, | ||
position: 'top', | ||
}, | ||
], | ||
tooltip: [ | ||
undefined, | ||
{ | ||
enabled: true, | ||
format(value) { | ||
return `${value}%`; | ||
}, | ||
showMode: 'always', | ||
position: 'bottom', | ||
}, | ||
], | ||
}; | ||
|
||
const a11yCheckConfig = { | ||
// NOTE: color-contrast issues | ||
rules: { 'color-contrast': { enabled: false } }, | ||
}; | ||
|
||
const configuration: Configuration = { | ||
component: 'dxRangeSlider', | ||
a11yCheckConfig, | ||
options, | ||
}; | ||
|
||
testAccessibility(configuration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Properties } from 'devextreme/ui/slider.d'; | ||
import url from '../../helpers/getPageUrl'; | ||
import { testAccessibility, Configuration } from '../../helpers/accessibility/test'; | ||
import { Options } from '../../helpers/generateOptionMatrix'; | ||
|
||
fixture.disablePageReloads`Accessibility` | ||
.page(url(__dirname, '../container.html')); | ||
|
||
const options: Options<Properties> = { | ||
value: [45], | ||
disabled: [true, false], | ||
readOnly: [true, false], | ||
hint: [undefined, 'hint'], | ||
name: ['', 'name'], | ||
height: [undefined, 250], | ||
width: [undefined, '50%'], | ||
min: [undefined, 10], | ||
max: [undefined, 90], | ||
showRange: [true, false], | ||
focusStateEnabled: [true], | ||
label: [ | ||
undefined, | ||
{ | ||
visible: true, | ||
format(value) { | ||
return `${value}%`; | ||
}, | ||
position: 'top', | ||
}, | ||
], | ||
tooltip: [ | ||
undefined, | ||
{ | ||
enabled: true, | ||
format(value) { | ||
return `${value}%`; | ||
}, | ||
showMode: 'always', | ||
position: 'bottom', | ||
}, | ||
], | ||
}; | ||
|
||
const a11yCheckConfig = { | ||
// NOTE: color-contrast issues | ||
rules: { 'color-contrast': { enabled: false } }, | ||
}; | ||
|
||
const configuration: Configuration = { | ||
component: 'dxSlider', | ||
a11yCheckConfig, | ||
options, | ||
}; | ||
|
||
testAccessibility(configuration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters