@uuv/dictionary 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.js +100 -0
- package/LICENSE +22 -0
- package/README.md +57 -0
- package/dist/README.md +57 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +20 -0
- package/dist/lib/accessible-role.d.ts +13 -0
- package/dist/lib/accessible-role.js +13 -0
- package/dist/lib/dictionary.d.ts +32 -0
- package/dist/lib/dictionary.js +71 -0
- package/dist/lib/web/en/en-enriched-wordings.json +106 -0
- package/dist/lib/web/en/en-roles.d.ts +2 -0
- package/dist/lib/web/en/en-roles.js +137 -0
- package/dist/lib/web/en/en.json +314 -0
- package/dist/lib/web/en/index.d.ts +24 -0
- package/dist/lib/web/en/index.js +20 -0
- package/dist/lib/web/fr/fr-enriched-wordings.json +106 -0
- package/dist/lib/web/fr/fr-roles.d.ts +2 -0
- package/dist/lib/web/fr/fr-roles.js +599 -0
- package/dist/lib/web/fr/fr.json +314 -0
- package/dist/lib/web/fr/index.d.ts +21 -0
- package/dist/lib/web/fr/index.js +14 -0
- package/dist/lib/web/index.d.ts +2 -0
- package/dist/lib/web/index.js +6 -0
- package/dist/lib/web/template.json +126 -0
- package/dist/package.json +47 -0
- package/jest.config.ts +19 -0
- package/package.json +47 -0
- package/project.json +124 -0
- package/src/index.ts +18 -0
- package/src/lib/accessible-role.ts +17 -0
- package/src/lib/dictionary.spec.ts +140 -0
- package/src/lib/dictionary.ts +102 -0
- package/src/lib/web/en/en-enriched-wordings.json +107 -0
- package/src/lib/web/en/en-roles.ts +144 -0
- package/src/lib/web/en/en.json +314 -0
- package/src/lib/web/en/index.ts +16 -0
- package/src/lib/web/fr/fr-enriched-wordings.json +106 -0
- package/src/lib/web/fr/fr-roles.ts +602 -0
- package/src/lib/web/fr/fr.json +314 -0
- package/src/lib/web/fr/index.ts +10 -0
- package/src/lib/web/index.ts +2 -0
- package/src/lib/web/template.json +126 -0
- package/tsconfig.json +24 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +10 -0
package/project.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dictionary",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/dictionary/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/js:tsc",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"rootDir": "packages/dictionary/src",
|
|
13
|
+
"outputPath": "packages/dictionary/dist/",
|
|
14
|
+
"main": "packages/dictionary/src/index.ts",
|
|
15
|
+
"tsConfig": "packages/dictionary/tsconfig.lib.json",
|
|
16
|
+
"assets": [
|
|
17
|
+
"packages/dictionary/*.md"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"test": {
|
|
22
|
+
"executor": "@nx/jest:jest",
|
|
23
|
+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
24
|
+
"options": {
|
|
25
|
+
"jestConfig": "packages/dictionary/jest.config.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"lint": {
|
|
29
|
+
"executor": "@nx/eslint:lint",
|
|
30
|
+
"outputs": [
|
|
31
|
+
"{options.outputFile}"
|
|
32
|
+
],
|
|
33
|
+
"options": {
|
|
34
|
+
"lintFilePatterns": [
|
|
35
|
+
"packages/dictionary/src/**/*.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"semantic-release": {
|
|
40
|
+
"executor": "@theunderscorer/nx-semantic-release:semantic-release",
|
|
41
|
+
"options": {
|
|
42
|
+
"commitMessage": "release(dictionary): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
|
|
43
|
+
"plugins": [
|
|
44
|
+
[
|
|
45
|
+
"@semantic-release/npm",
|
|
46
|
+
{
|
|
47
|
+
"npmPublish": false,
|
|
48
|
+
"tarballDir": "dist/packages",
|
|
49
|
+
"pkgRoot": "packages/dictionary"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
"@semantic-release/github",
|
|
54
|
+
{
|
|
55
|
+
"successComment": false,
|
|
56
|
+
"failComment": false,
|
|
57
|
+
"assets": [
|
|
58
|
+
{
|
|
59
|
+
"path": "dist/packages/uuv-dictionary-*.tgz",
|
|
60
|
+
"label": "Npm Package"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"@google/semantic-release-replace-plugin",
|
|
67
|
+
{
|
|
68
|
+
"replacements": [
|
|
69
|
+
{
|
|
70
|
+
"files": [
|
|
71
|
+
"packages/runner-commons/package.json"
|
|
72
|
+
],
|
|
73
|
+
"from": "\"@uuv/dictionary\": \".*\"",
|
|
74
|
+
"to": "\"@uuv/dictionary\": \"${nextRelease.version}\"",
|
|
75
|
+
"results": [
|
|
76
|
+
{
|
|
77
|
+
"file": "packages/runner-commons/package.json",
|
|
78
|
+
"hasChanged": true,
|
|
79
|
+
"numMatches": 1,
|
|
80
|
+
"numReplacements": 1
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"countMatches": true
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"files": [
|
|
87
|
+
"packages/assistant/package.json"
|
|
88
|
+
],
|
|
89
|
+
"from": "\"@uuv/dictionary\": \".*\"",
|
|
90
|
+
"to": "\"@uuv/dictionary\": \"${nextRelease.version}\"",
|
|
91
|
+
"results": [
|
|
92
|
+
{
|
|
93
|
+
"file": "packages/assistant/package.json",
|
|
94
|
+
"hasChanged": true,
|
|
95
|
+
"numMatches": 1,
|
|
96
|
+
"numReplacements": 1
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"countMatches": true
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"files": [
|
|
103
|
+
"packages/mcp-server/package.json"
|
|
104
|
+
],
|
|
105
|
+
"from": "\"@uuv/dictionary\": \".*\"",
|
|
106
|
+
"to": "\"@uuv/dictionary\": \"${nextRelease.version}\"",
|
|
107
|
+
"results": [
|
|
108
|
+
{
|
|
109
|
+
"file": "packages/mcp-server/package.json",
|
|
110
|
+
"hasChanged": true,
|
|
111
|
+
"numMatches": 1,
|
|
112
|
+
"numReplacements": 1
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"countMatches": true
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dictionary, LANG } from "./lib/dictionary";
|
|
2
|
+
import { FrDictionary } from "./lib/web/fr";
|
|
3
|
+
import { EnDictionary } from "./lib/web/en";
|
|
4
|
+
|
|
5
|
+
export * from "./lib/dictionary";
|
|
6
|
+
export * from "./lib/accessible-role";
|
|
7
|
+
export * from "./lib/web";
|
|
8
|
+
export * from "./lib/web/en";
|
|
9
|
+
export * from "./lib/web/fr";
|
|
10
|
+
|
|
11
|
+
export function getDefinedDictionary(lang: string): Dictionary {
|
|
12
|
+
switch (lang) {
|
|
13
|
+
case LANG.FR.toString():
|
|
14
|
+
return new FrDictionary();
|
|
15
|
+
default:
|
|
16
|
+
return new EnDictionary();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export abstract class AccessibleRole {
|
|
2
|
+
id!: string;
|
|
3
|
+
name!: string;
|
|
4
|
+
shouldGenerateClickSentence!: boolean;
|
|
5
|
+
shouldGenerateTypeSentence!: boolean;
|
|
6
|
+
shouldGenerateContainsSentence!: boolean;
|
|
7
|
+
shouldGenerateKeyboardSentence = false;
|
|
8
|
+
shouldGenerateCheckedSentence = false;
|
|
9
|
+
|
|
10
|
+
abstract getDefiniteArticle(): string;
|
|
11
|
+
|
|
12
|
+
abstract getIndefiniteArticle(): string;
|
|
13
|
+
|
|
14
|
+
abstract getOfDefiniteArticle(): string;
|
|
15
|
+
|
|
16
|
+
abstract namedAdjective(): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Dictionary } from "./dictionary";
|
|
2
|
+
import { AccessibleRole } from "./accessible-role";
|
|
3
|
+
|
|
4
|
+
class TestDictionary extends Dictionary {
|
|
5
|
+
protected override baseSentences = [
|
|
6
|
+
{
|
|
7
|
+
key: "test.key",
|
|
8
|
+
description: "Test description",
|
|
9
|
+
wording: "This is a test"
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
protected override roleBasedSentencesTemplate = [
|
|
14
|
+
{
|
|
15
|
+
key: "role.test.key",
|
|
16
|
+
description: "Role based test description",
|
|
17
|
+
wording: "I should see $indefiniteArticle $roleName named {string}",
|
|
18
|
+
section: "general"
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
protected override roles: AccessibleRole[] = [
|
|
23
|
+
{
|
|
24
|
+
id: "button",
|
|
25
|
+
name: "button",
|
|
26
|
+
shouldGenerateClickSentence: true,
|
|
27
|
+
shouldGenerateTypeSentence: false,
|
|
28
|
+
shouldGenerateContainsSentence: false,
|
|
29
|
+
shouldGenerateKeyboardSentence: true,
|
|
30
|
+
shouldGenerateCheckedSentence: false,
|
|
31
|
+
getDefiniteArticle(): string {
|
|
32
|
+
return "the";
|
|
33
|
+
},
|
|
34
|
+
getIndefiniteArticle(): string {
|
|
35
|
+
return "a";
|
|
36
|
+
},
|
|
37
|
+
getOfDefiniteArticle(): string {
|
|
38
|
+
return "of the";
|
|
39
|
+
},
|
|
40
|
+
namedAdjective(): string {
|
|
41
|
+
return "named";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("Dictionary", () => {
|
|
48
|
+
let dictionary: TestDictionary;
|
|
49
|
+
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
dictionary = new TestDictionary();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("getBaseSentences", () => {
|
|
55
|
+
it("should return base sentences", () => {
|
|
56
|
+
const result = dictionary.getBaseSentences();
|
|
57
|
+
expect(result).toHaveLength(1);
|
|
58
|
+
expect(result[0].key).toBe("test.key");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe("getRoleBasedSentencesTemplate", () => {
|
|
63
|
+
it("should return role based sentence templates", () => {
|
|
64
|
+
const result = dictionary.getRoleBasedSentencesTemplate();
|
|
65
|
+
expect(result).toHaveLength(1);
|
|
66
|
+
expect(result[0].key).toBe("role.test.key");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe("getDefinedRoles", () => {
|
|
71
|
+
it("should return defined roles", () => {
|
|
72
|
+
const result = dictionary.getDefinedRoles();
|
|
73
|
+
expect(result).toHaveLength(1);
|
|
74
|
+
expect(result[0].id).toBe("button");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("getRoleBasedSentences", () => {
|
|
79
|
+
it("should generate role based sentences for all sections", () => {
|
|
80
|
+
const result = dictionary.getRoleBasedSentences();
|
|
81
|
+
expect(result).toHaveLength(1); // Only one role, so only one sentence generated
|
|
82
|
+
expect(result[0].key).toBe("role.test.key.role.button");
|
|
83
|
+
expect(result[0].role).toBe("button");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("should properly replace placeholders in sentences", () => {
|
|
87
|
+
const result = dictionary.getRoleBasedSentences();
|
|
88
|
+
// The template has $indefiniteArticle and $roleName which should be replaced
|
|
89
|
+
expect(result[0].wording).toContain("a button named");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("computeSentence", () => {
|
|
94
|
+
it("should compute sentence with mock value", () => {
|
|
95
|
+
const input = {
|
|
96
|
+
sentence: {
|
|
97
|
+
key: "test.key",
|
|
98
|
+
description: "Test description",
|
|
99
|
+
wording: "I type the sentence {string} in $definiteArticle $roleName named {string}"
|
|
100
|
+
},
|
|
101
|
+
mock: "test value",
|
|
102
|
+
accessibleRole: "button",
|
|
103
|
+
parameters: [ "myButton" ]
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const result = dictionary.computeSentence(input);
|
|
107
|
+
expect(result).toEqual("I type the sentence \"test value\" in the button named \"myButton\"");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should compute sentence with parameters", () => {
|
|
111
|
+
const input = {
|
|
112
|
+
sentence: {
|
|
113
|
+
key: "test.key",
|
|
114
|
+
description: "Test description",
|
|
115
|
+
wording: "I click on $roleName named {string} and containing {string}"
|
|
116
|
+
},
|
|
117
|
+
accessibleRole: "button",
|
|
118
|
+
parameters: ["parameter1", "parameter2"]
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const result = dictionary.computeSentence(input);
|
|
122
|
+
expect(result).toEqual("I click on button named \"parameter1\" and containing \"parameter2\"");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("should handle missing role gracefully", () => {
|
|
126
|
+
const input = {
|
|
127
|
+
sentence: {
|
|
128
|
+
key: "test.key",
|
|
129
|
+
description: "Test description",
|
|
130
|
+
wording: "I type the sentence {string} in $definiteArticle $roleName named {string}"
|
|
131
|
+
},
|
|
132
|
+
accessibleRole: "nonexistent-role",
|
|
133
|
+
parameters: []
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const result = dictionary.computeSentence(input);
|
|
137
|
+
expect(result).toEqual("I type the sentence {string} in undefined nonexistent-role named {string}");
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { AccessibleRole } from "./accessible-role";
|
|
2
|
+
|
|
3
|
+
export enum LANG {
|
|
4
|
+
FR = "fr",
|
|
5
|
+
EN = "en",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type BaseSentence = {
|
|
9
|
+
key: string;
|
|
10
|
+
description: string;
|
|
11
|
+
wording: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type RoleBasedSentenceTemplate = BaseSentence & {
|
|
15
|
+
section: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type RoleBasedSentence = RoleBasedSentenceTemplate & {
|
|
19
|
+
role: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ComputeSentenceInput = {
|
|
23
|
+
sentence: BaseSentence;
|
|
24
|
+
mock?: string;
|
|
25
|
+
accessibleRole: string;
|
|
26
|
+
parameters: string[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export abstract class Dictionary {
|
|
30
|
+
protected baseSentences!: BaseSentence[];
|
|
31
|
+
protected roleBasedSentencesTemplate!: RoleBasedSentenceTemplate[];
|
|
32
|
+
protected roles!: AccessibleRole[];
|
|
33
|
+
|
|
34
|
+
public getBaseSentences(): BaseSentence[] {
|
|
35
|
+
return this.baseSentences;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public getRoleBasedSentencesTemplate(): RoleBasedSentenceTemplate[] {
|
|
39
|
+
return this.roleBasedSentencesTemplate;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public getDefinedRoles(): AccessibleRole[] {
|
|
43
|
+
return this.roles;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public getRoleBasedSentences(): RoleBasedSentence[] {
|
|
47
|
+
const result: RoleBasedSentence[] = [];
|
|
48
|
+
this.roles.forEach(role => {
|
|
49
|
+
this.roleBasedSentencesTemplate
|
|
50
|
+
.filter(
|
|
51
|
+
sentence =>
|
|
52
|
+
sentence.section === "general" ||
|
|
53
|
+
(sentence.section === "keyboard" && role.shouldGenerateKeyboardSentence) ||
|
|
54
|
+
(sentence.section === "click" && role.shouldGenerateClickSentence) ||
|
|
55
|
+
(sentence.section === "contains" && role.shouldGenerateContainsSentence) ||
|
|
56
|
+
(sentence.section === "type" && role.shouldGenerateTypeSentence) ||
|
|
57
|
+
(sentence.section === "checkable" && role.shouldGenerateCheckedSentence)
|
|
58
|
+
)
|
|
59
|
+
.map(sentence => {
|
|
60
|
+
return {
|
|
61
|
+
...sentence,
|
|
62
|
+
role: role.name,
|
|
63
|
+
key: `${sentence.key}.role.${role.name.toLowerCase()}`,
|
|
64
|
+
wording: sentence.wording
|
|
65
|
+
.replaceAll("(n)", "")
|
|
66
|
+
.replaceAll("$roleName", role.name)
|
|
67
|
+
.replaceAll("$definiteArticle", role.getDefiniteArticle())
|
|
68
|
+
.replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
|
|
69
|
+
.replaceAll("$namedAdjective", role.namedAdjective())
|
|
70
|
+
.replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle()),
|
|
71
|
+
};
|
|
72
|
+
})
|
|
73
|
+
.forEach(sentence => {
|
|
74
|
+
result.push(sentence);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public computeSentence(input: ComputeSentenceInput): string {
|
|
81
|
+
const targetRole = this.getDefinedRoles().filter(role => role.id === input.accessibleRole)[0];
|
|
82
|
+
let resultSentence = input.sentence.wording;
|
|
83
|
+
|
|
84
|
+
if (input.mock) {
|
|
85
|
+
resultSentence = resultSentence.replace("{string}", `"${input.mock}"`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
resultSentence = resultSentence
|
|
89
|
+
.replaceAll("(n)", "")
|
|
90
|
+
.replaceAll("$roleName", targetRole?.name ?? input.accessibleRole)
|
|
91
|
+
.replaceAll("$definiteArticle", targetRole?.getDefiniteArticle())
|
|
92
|
+
.replaceAll("$indefiniteArticle", targetRole?.getIndefiniteArticle())
|
|
93
|
+
.replaceAll("$namedAdjective", targetRole?.namedAdjective())
|
|
94
|
+
.replaceAll("$ofDefiniteArticle", targetRole?.getOfDefiniteArticle());
|
|
95
|
+
|
|
96
|
+
input.parameters.forEach(param => {
|
|
97
|
+
resultSentence = resultSentence.replace("{string}", `"${param}"`);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return resultSentence;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enriched": [
|
|
3
|
+
{
|
|
4
|
+
"key": "key.when.withinElement.roleAndName",
|
|
5
|
+
"description": "Selects the element whose [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and accessible [name](https://russmaxdesign.github.io/html-elements-names/) are specified <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
|
|
6
|
+
"wording": "within $indefiniteArticle $roleName named {string}",
|
|
7
|
+
"section": "general"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"key": "key.then.element.withRoleAndName",
|
|
11
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
|
|
12
|
+
"wording": "I should see $indefiniteArticle $roleName named {string}",
|
|
13
|
+
"section": "general"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"key": "key.then.element.withRoleAndNameFocused",
|
|
17
|
+
"description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
|
|
18
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} keyboard focused",
|
|
19
|
+
"section": "keyboard"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"key": "key.then.element.nextWithRoleAndNameFocused",
|
|
23
|
+
"description": "Move to the next html element that can be reached with Tab and checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
|
|
24
|
+
"wording": "the next keyboard element focused should be $indefiniteArticle $roleName named {string}",
|
|
25
|
+
"section": "keyboard"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "key.then.element.previousWithRoleAndNameFocused",
|
|
29
|
+
"description": "Move to the previous html element that can be reached with Tab and checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
|
|
30
|
+
"wording": "the previous keyboard element focused should be $indefiniteArticle $roleName named {string}",
|
|
31
|
+
"section": "keyboard"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "key.then.element.not.withRoleAndName",
|
|
35
|
+
"description": "Checks that an Html element does not exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
|
|
36
|
+
"wording": "I should not see $indefiniteArticle $roleName named {string}",
|
|
37
|
+
"section": "general"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"key": "key.then.element.withRoleAndNameAndContent",
|
|
41
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content",
|
|
42
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string}",
|
|
43
|
+
"section": "contains"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"key": "key.then.element.withRoleAndNameAndValue",
|
|
47
|
+
"description": "Checks that an Form element(input) exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and specified value",
|
|
48
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} with value {string}",
|
|
49
|
+
"section": "contains"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"key": "key.then.element.withRoleAndNameAndContentDisabled",
|
|
53
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content, and with the disabled attribute set to true",
|
|
54
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} disabled",
|
|
55
|
+
"section": "contains"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"key": "key.then.element.withRoleAndNameAndContentEnabled",
|
|
59
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content, and with the disabled attribute set to false",
|
|
60
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} enabled",
|
|
61
|
+
"section": "contains"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"key": "key.then.element.withRoleAndNameDisabled",
|
|
65
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/), and with the disabled attribute set to true",
|
|
66
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} disabled",
|
|
67
|
+
"section": "contains"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"key": "key.then.element.withRoleAndNameEnabled",
|
|
71
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/), and with the disabled attribute set to false",
|
|
72
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} enabled",
|
|
73
|
+
"section": "contains"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"key": "key.when.type",
|
|
77
|
+
"description": "Writes the sentence given as a parameter inside the specified field (useful for example to fill in a form field)",
|
|
78
|
+
"wording": "I type the sentence {string} in $definiteArticle $roleName named {string}",
|
|
79
|
+
"section": "type"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"key": "key.then.element.withRoleAndNameAndChecked",
|
|
83
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) and is checked",
|
|
84
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} checked",
|
|
85
|
+
"section": "checkable"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"key": "key.then.element.withRoleAndNameAndUnchecked",
|
|
89
|
+
"description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) and is unchecked",
|
|
90
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} unchecked",
|
|
91
|
+
"section": "checkable"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"key": "key.when.enter",
|
|
95
|
+
"description": "Writes the sentence given as a parameter inside the specified field (useful for example to fill in a form field)",
|
|
96
|
+
"wording": "I enter the value {string} in $definiteArticle $roleName named {string}",
|
|
97
|
+
"section": "type"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"key": "key.when.click",
|
|
101
|
+
"description": "Triggers a click on the element with role $roleId and the specified name",
|
|
102
|
+
"wording": "I click on $roleName named {string}",
|
|
103
|
+
"section": "click"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { AccessibleRole } from "../../accessible-role";
|
|
2
|
+
|
|
3
|
+
enum DEFINITE_ARTICLE {
|
|
4
|
+
THE = "the"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
enum INDEFINITE_ARTICLE {
|
|
8
|
+
A = "a",
|
|
9
|
+
AN = "an"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class EnAccessibleRole extends AccessibleRole {
|
|
14
|
+
constructor(
|
|
15
|
+
override id: string,
|
|
16
|
+
override name: string,
|
|
17
|
+
private definiteArticle: DEFINITE_ARTICLE = DEFINITE_ARTICLE.THE,
|
|
18
|
+
private indefiniteArticle: INDEFINITE_ARTICLE = INDEFINITE_ARTICLE.A,
|
|
19
|
+
override shouldGenerateClickSentence = false,
|
|
20
|
+
override shouldGenerateTypeSentence = true,
|
|
21
|
+
override shouldGenerateContainsSentence = true,
|
|
22
|
+
override shouldGenerateKeyboardSentence = false,
|
|
23
|
+
override shouldGenerateCheckedSentence = false
|
|
24
|
+
) {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static from(input: any) : AccessibleRole {
|
|
29
|
+
return new EnAccessibleRole(
|
|
30
|
+
input.id,
|
|
31
|
+
input.name,
|
|
32
|
+
input.definiteArticle,
|
|
33
|
+
input.indefiniteArticle,
|
|
34
|
+
input.shouldGenerateClickSentence,
|
|
35
|
+
input.shouldGenerateTypeSentence,
|
|
36
|
+
input.shouldGenerateContainsSentence,
|
|
37
|
+
input.shouldGenerateKeyboardSentence,
|
|
38
|
+
input.shouldGenerateCheckedSentence
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override getDefiniteArticle(): string {
|
|
43
|
+
return this.definiteArticle.toString();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override getIndefiniteArticle(): string {
|
|
47
|
+
return this.indefiniteArticle.toString();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override getOfDefiniteArticle(): string {
|
|
51
|
+
return `of ${this.definiteArticle}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override namedAdjective(): string {
|
|
55
|
+
return "named";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const EN_ROLES: AccessibleRole[] = [
|
|
60
|
+
{ id: "alert", name: "alert", indefiniteArticle: INDEFINITE_ARTICLE.AN },
|
|
61
|
+
{ id: "alertdialog", name: "alert dialog", indefiniteArticle: INDEFINITE_ARTICLE.AN },
|
|
62
|
+
{ id: "application", name: "application", indefiniteArticle: INDEFINITE_ARTICLE.AN },
|
|
63
|
+
{ id: "article", name: "article", indefiniteArticle: INDEFINITE_ARTICLE.AN },
|
|
64
|
+
{ id: "banner", name: "banner" },
|
|
65
|
+
{ id: "button", name: "button", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
66
|
+
{ id: "cell", name: "cell" },
|
|
67
|
+
{ id: "checkbox", name: "checkbox", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true, shouldGenerateClickSentence: true },
|
|
68
|
+
{ id: "columnheader", name: "column header" },
|
|
69
|
+
{ id: "combobox", name: "combo box", shouldGenerateTypeSentence: false, shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
70
|
+
{ id: "command", name: "command" },
|
|
71
|
+
{ id: "comment", name: "comment" },
|
|
72
|
+
{ id: "complementary", name: "complementary" },
|
|
73
|
+
{ id: "composite", name: "composite" },
|
|
74
|
+
{ id: "contentinfo", name: "contentinfo" },
|
|
75
|
+
{ id: "definition", name: "definition" },
|
|
76
|
+
{ id: "dialog", name: "dialog" },
|
|
77
|
+
{ id: "directory", name: "directory" },
|
|
78
|
+
{ id: "document", name: "document" },
|
|
79
|
+
{ id: "feed", name: "flow" },
|
|
80
|
+
{ id: "figure", name: "figure" },
|
|
81
|
+
{ id: "form", name: "form" },
|
|
82
|
+
{ id: "generic", name: "generic" },
|
|
83
|
+
{ id: "grid", name: "grid" },
|
|
84
|
+
{ id: "gridcell", name: "grid cell" },
|
|
85
|
+
{ id: "group", name: "group" },
|
|
86
|
+
{ id: "heading", name: "title" },
|
|
87
|
+
{ id: "img", name: "image", indefiniteArticle: INDEFINITE_ARTICLE.AN },
|
|
88
|
+
{ id: "landmark", name: "landmark" },
|
|
89
|
+
{ id: "link", name: "link", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
90
|
+
{ id: "list", name: "list", shouldGenerateContainsSentence: false, shouldGenerateTypeSentence: false },
|
|
91
|
+
{ id: "listbox", name: "list box", shouldGenerateKeyboardSentence: true },
|
|
92
|
+
{ id: "listitem", name: "list item", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
93
|
+
{ id: "log", name: "log" },
|
|
94
|
+
{ id: "main", name: "main" },
|
|
95
|
+
{ id: "mark", name: "mark" },
|
|
96
|
+
{ id: "math", name: "math" },
|
|
97
|
+
{ id: "menu", name: "menu" },
|
|
98
|
+
{ id: "menubar", name: "menubar" },
|
|
99
|
+
{ id: "menuitem", name: "menuitem", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
100
|
+
{ id: "menuitemcheckbox", name: "menuitemcheckbox", shouldGenerateKeyboardSentence: true },
|
|
101
|
+
{ id: "menuitemradio", name: "menuitemradio", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true },
|
|
102
|
+
{ id: "meter", name: "counter" },
|
|
103
|
+
{ id: "navigation", name: "navigation" },
|
|
104
|
+
{ id: "none", name: "no" },
|
|
105
|
+
{ id: "note", name: "note" },
|
|
106
|
+
{ id: "option", name: "option", indefiniteArticle: INDEFINITE_ARTICLE.AN, shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
|
|
107
|
+
{ id: "presentation", name: "presentation" },
|
|
108
|
+
{ id: "progressbar", name: "progress bar" },
|
|
109
|
+
{ id: "radio", name: "radio", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true, shouldGenerateClickSentence: true },
|
|
110
|
+
{ id: "radiogroup", name: "radio group" },
|
|
111
|
+
{ id: "range", name: "range" },
|
|
112
|
+
{ id: "region", name: "region" },
|
|
113
|
+
{ id: "roletype", name: "role type" },
|
|
114
|
+
{ id: "row", name: "row" },
|
|
115
|
+
{ id: "rowgroup", name: "row group" },
|
|
116
|
+
{ id: "rowheader", name: "row header" },
|
|
117
|
+
{ id: "scrollbar", name: "scroll bar" },
|
|
118
|
+
{ id: "search", name: "search", shouldGenerateKeyboardSentence: true },
|
|
119
|
+
{ id: "searchbox", name: "search box", shouldGenerateKeyboardSentence: true },
|
|
120
|
+
{ id: "section", name: "section" },
|
|
121
|
+
{ id: "sectionhead", name: "section header" },
|
|
122
|
+
{ id: "select", name: "select", shouldGenerateKeyboardSentence: true },
|
|
123
|
+
{ id: "separator", name: "separator" },
|
|
124
|
+
{ id: "slider", name: "slider", shouldGenerateKeyboardSentence: true },
|
|
125
|
+
{ id: "spinbutton", name: "spin button", shouldGenerateKeyboardSentence: true },
|
|
126
|
+
{ id: "status", name: "status" },
|
|
127
|
+
{ id: "structure", name: "structure" },
|
|
128
|
+
{ id: "suggestion", name: "suggestion" },
|
|
129
|
+
{ id: "switch", name: "switch", shouldGenerateKeyboardSentence: true },
|
|
130
|
+
{ id: "tab", name: "tab", shouldGenerateKeyboardSentence: true },
|
|
131
|
+
{ id: "table", name: "table" },
|
|
132
|
+
{ id: "tablist", name: "tablist" },
|
|
133
|
+
{ id: "tabpanel", name: "tabpanel" },
|
|
134
|
+
{ id: "term", name: "term" },
|
|
135
|
+
{ id: "textbox", name: "text box", shouldGenerateKeyboardSentence: true },
|
|
136
|
+
{ id: "timer", name: "timer" },
|
|
137
|
+
{ id: "toolbar", name: "toolbar" },
|
|
138
|
+
{ id: "tooltip", name: "tooltip" },
|
|
139
|
+
{ id: "tree", name: "tree" },
|
|
140
|
+
{ id: "treegrid", name: "tree grid" },
|
|
141
|
+
{ id: "treeitem", name: "tree item" },
|
|
142
|
+
{ id: "widget", name: "widget", shouldGenerateKeyboardSentence: true },
|
|
143
|
+
{ id: "window", name: "window" }
|
|
144
|
+
].map(role => EnAccessibleRole.from(role));
|