@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.
Files changed (47) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +100 -0
  3. package/LICENSE +22 -0
  4. package/README.md +57 -0
  5. package/dist/README.md +57 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.js +20 -0
  8. package/dist/lib/accessible-role.d.ts +13 -0
  9. package/dist/lib/accessible-role.js +13 -0
  10. package/dist/lib/dictionary.d.ts +32 -0
  11. package/dist/lib/dictionary.js +71 -0
  12. package/dist/lib/web/en/en-enriched-wordings.json +106 -0
  13. package/dist/lib/web/en/en-roles.d.ts +2 -0
  14. package/dist/lib/web/en/en-roles.js +137 -0
  15. package/dist/lib/web/en/en.json +314 -0
  16. package/dist/lib/web/en/index.d.ts +24 -0
  17. package/dist/lib/web/en/index.js +20 -0
  18. package/dist/lib/web/fr/fr-enriched-wordings.json +106 -0
  19. package/dist/lib/web/fr/fr-roles.d.ts +2 -0
  20. package/dist/lib/web/fr/fr-roles.js +599 -0
  21. package/dist/lib/web/fr/fr.json +314 -0
  22. package/dist/lib/web/fr/index.d.ts +21 -0
  23. package/dist/lib/web/fr/index.js +14 -0
  24. package/dist/lib/web/index.d.ts +2 -0
  25. package/dist/lib/web/index.js +6 -0
  26. package/dist/lib/web/template.json +126 -0
  27. package/dist/package.json +47 -0
  28. package/jest.config.ts +19 -0
  29. package/package.json +47 -0
  30. package/project.json +124 -0
  31. package/src/index.ts +18 -0
  32. package/src/lib/accessible-role.ts +17 -0
  33. package/src/lib/dictionary.spec.ts +140 -0
  34. package/src/lib/dictionary.ts +102 -0
  35. package/src/lib/web/en/en-enriched-wordings.json +107 -0
  36. package/src/lib/web/en/en-roles.ts +144 -0
  37. package/src/lib/web/en/en.json +314 -0
  38. package/src/lib/web/en/index.ts +16 -0
  39. package/src/lib/web/fr/fr-enriched-wordings.json +106 -0
  40. package/src/lib/web/fr/fr-roles.ts +602 -0
  41. package/src/lib/web/fr/fr.json +314 -0
  42. package/src/lib/web/fr/index.ts +10 -0
  43. package/src/lib/web/index.ts +2 -0
  44. package/src/lib/web/template.json +126 -0
  45. package/tsconfig.json +24 -0
  46. package/tsconfig.lib.json +10 -0
  47. package/tsconfig.spec.json +10 -0
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
package/.eslintrc.js ADDED
@@ -0,0 +1,100 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": [
7
+ "../../.eslintrc.json",
8
+ "eslint:recommended",
9
+ "plugin:@nx/typescript"
10
+ ],
11
+ "overrides": [
12
+ ],
13
+ "parser": "@typescript-eslint/parser",
14
+ "parserOptions": {
15
+ "ecmaVersion": "latest",
16
+ "sourceType": "module"
17
+ },
18
+ "plugins": [
19
+ "jest"
20
+ ],
21
+ "rules": {
22
+ "no-negated-in-lhs": "error",
23
+ "no-cond-assign": ["error", "except-parens"],
24
+ "curly": ["error", "all"],
25
+ "object-curly-spacing": ["error", "always"],
26
+ "no-unused-expressions": "error",
27
+ "no-sequences": "error",
28
+ "no-nested-ternary": "error",
29
+ "no-unreachable": "error",
30
+ "wrap-iife": ["error", "inside"],
31
+ "no-caller": "error",
32
+ "quotes": ["error", "double"],
33
+ "no-undef": "off",
34
+ "no-unused-vars": "off",
35
+ "comma-style": ["error", "last"],
36
+ "camelcase": [
37
+ "error",
38
+ {
39
+ "properties": "never"
40
+ }
41
+ ],
42
+ "dot-notation": [
43
+ "error",
44
+ {
45
+ "allowPattern": "^[a-z]+(_[a-z]+)+$"
46
+ }
47
+ ],
48
+ "max-len": [
49
+ "warn",
50
+ {
51
+ "code": 150,
52
+ "ignoreComments": true,
53
+ "ignoreUrls": true,
54
+ "ignoreRegExpLiterals": true
55
+ }
56
+ ],
57
+ "no-mixed-spaces-and-tabs": "error",
58
+ "no-trailing-spaces": "error",
59
+ "no-multi-str": "error",
60
+ "comma-spacing": [
61
+ "error",
62
+ {
63
+ "before": false,
64
+ "after": true
65
+ }
66
+ ],
67
+ "space-before-blocks": ["error", "always"],
68
+ "space-in-parens": ["off"],
69
+ "keyword-spacing": [2],
70
+ "semi": ["error", "always"],
71
+ "semi-spacing": [
72
+ "error",
73
+ {
74
+ "after": true
75
+ }
76
+ ],
77
+ "space-infix-ops": "error",
78
+ "eol-last": "error",
79
+ "linebreak-style": ["error", process.platform === "win32" ? "windows" : "unix"],
80
+ "no-with": "error",
81
+ "brace-style": "error",
82
+ "space-before-function-paren": ["off"],
83
+ "no-loop-func": "error",
84
+ "key-spacing": [
85
+ "error",
86
+ {
87
+ "beforeColon": false,
88
+ "afterColon": true
89
+ }
90
+ ],
91
+ "space-unary-ops": [
92
+ "error",
93
+ {
94
+ "words": false,
95
+ "nonwords": false
96
+ }
97
+ ],
98
+ "no-multiple-empty-lines": 2
99
+ }
100
+ };
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
9
+ Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @uuv/dictionary
2
+
3
+ [![npm version](https://badge.fury.io/js/%40uuv%2Fdictionary.svg)](https://badge.fury.io/js/%40uuv%2Fdictionary)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ This package provides a built-in set of Cucumber sentences for writing end-to-end tests with UUV. It includes translations in English and French, along with accessibility role-based sentence generation.
7
+
8
+ ## Features
9
+
10
+ - Built-in Cucumber sentences for E2E testing
11
+ - Support for multiple languages (English and French)
12
+ - Role-based sentence generation for accessibility
13
+ - Integration-ready with Cypress, Playwright, and Testing Library
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @uuv/dictionary
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Import the dictionary in your test files:
24
+
25
+ ```typescript
26
+ import { getDefinedDictionary } from '@uuv/dictionary';
27
+
28
+ const dictionary = getDefinedDictionary('en'); // or 'fr' for French
29
+ ```
30
+
31
+ ### Available Dictionaries
32
+
33
+ - English (`en`)
34
+ - French (`fr`)
35
+
36
+ ## Structure
37
+
38
+ The package contains:
39
+
40
+ 1. **Base Sentences**: General sentences for common actions
41
+ 2. **Role-based Sentences**: Context-specific sentences based on accessibility roles
42
+ 3. **Language Support**: Translations in English and French
43
+ 4. **Accessibility Integration**: Role-based sentence generation
44
+
45
+ ## Development
46
+
47
+ ### Building
48
+
49
+ Run `nx build dictionary` to build the library.
50
+
51
+ ### Running Unit Tests
52
+
53
+ Run `nx test dictionary` to execute the unit tests via [Jest](https://jestjs.io).
54
+
55
+ ### Linting
56
+
57
+ Run `nx lint dictionary` to lint the codebase.
package/dist/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @uuv/dictionary
2
+
3
+ [![npm version](https://badge.fury.io/js/%40uuv%2Fdictionary.svg)](https://badge.fury.io/js/%40uuv%2Fdictionary)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ This package provides a built-in set of Cucumber sentences for writing end-to-end tests with UUV. It includes translations in English and French, along with accessibility role-based sentence generation.
7
+
8
+ ## Features
9
+
10
+ - Built-in Cucumber sentences for E2E testing
11
+ - Support for multiple languages (English and French)
12
+ - Role-based sentence generation for accessibility
13
+ - Integration-ready with Cypress, Playwright, and Testing Library
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @uuv/dictionary
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Import the dictionary in your test files:
24
+
25
+ ```typescript
26
+ import { getDefinedDictionary } from '@uuv/dictionary';
27
+
28
+ const dictionary = getDefinedDictionary('en'); // or 'fr' for French
29
+ ```
30
+
31
+ ### Available Dictionaries
32
+
33
+ - English (`en`)
34
+ - French (`fr`)
35
+
36
+ ## Structure
37
+
38
+ The package contains:
39
+
40
+ 1. **Base Sentences**: General sentences for common actions
41
+ 2. **Role-based Sentences**: Context-specific sentences based on accessibility roles
42
+ 3. **Language Support**: Translations in English and French
43
+ 4. **Accessibility Integration**: Role-based sentence generation
44
+
45
+ ## Development
46
+
47
+ ### Building
48
+
49
+ Run `nx build dictionary` to build the library.
50
+
51
+ ### Running Unit Tests
52
+
53
+ Run `nx test dictionary` to execute the unit tests via [Jest](https://jestjs.io).
54
+
55
+ ### Linting
56
+
57
+ Run `nx lint dictionary` to lint the codebase.
@@ -0,0 +1,7 @@
1
+ import { Dictionary } from "./lib/dictionary";
2
+ export * from "./lib/dictionary";
3
+ export * from "./lib/accessible-role";
4
+ export * from "./lib/web";
5
+ export * from "./lib/web/en";
6
+ export * from "./lib/web/fr";
7
+ export declare function getDefinedDictionary(lang: string): Dictionary;
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefinedDictionary = getDefinedDictionary;
4
+ const tslib_1 = require("tslib");
5
+ const dictionary_1 = require("./lib/dictionary");
6
+ const fr_1 = require("./lib/web/fr");
7
+ const en_1 = require("./lib/web/en");
8
+ tslib_1.__exportStar(require("./lib/dictionary"), exports);
9
+ tslib_1.__exportStar(require("./lib/accessible-role"), exports);
10
+ tslib_1.__exportStar(require("./lib/web"), exports);
11
+ tslib_1.__exportStar(require("./lib/web/en"), exports);
12
+ tslib_1.__exportStar(require("./lib/web/fr"), exports);
13
+ function getDefinedDictionary(lang) {
14
+ switch (lang) {
15
+ case dictionary_1.LANG.FR.toString():
16
+ return new fr_1.FrDictionary();
17
+ default:
18
+ return new en_1.EnDictionary();
19
+ }
20
+ }
@@ -0,0 +1,13 @@
1
+ export declare abstract class AccessibleRole {
2
+ id: string;
3
+ name: string;
4
+ shouldGenerateClickSentence: boolean;
5
+ shouldGenerateTypeSentence: boolean;
6
+ shouldGenerateContainsSentence: boolean;
7
+ shouldGenerateKeyboardSentence: boolean;
8
+ shouldGenerateCheckedSentence: boolean;
9
+ abstract getDefiniteArticle(): string;
10
+ abstract getIndefiniteArticle(): string;
11
+ abstract getOfDefiniteArticle(): string;
12
+ abstract namedAdjective(): string;
13
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccessibleRole = void 0;
4
+ class AccessibleRole {
5
+ id;
6
+ name;
7
+ shouldGenerateClickSentence;
8
+ shouldGenerateTypeSentence;
9
+ shouldGenerateContainsSentence;
10
+ shouldGenerateKeyboardSentence = false;
11
+ shouldGenerateCheckedSentence = false;
12
+ }
13
+ exports.AccessibleRole = AccessibleRole;
@@ -0,0 +1,32 @@
1
+ import { AccessibleRole } from "./accessible-role";
2
+ export declare enum LANG {
3
+ FR = "fr",
4
+ EN = "en"
5
+ }
6
+ export type BaseSentence = {
7
+ key: string;
8
+ description: string;
9
+ wording: string;
10
+ };
11
+ export type RoleBasedSentenceTemplate = BaseSentence & {
12
+ section: string;
13
+ };
14
+ export type RoleBasedSentence = RoleBasedSentenceTemplate & {
15
+ role: string;
16
+ };
17
+ export type ComputeSentenceInput = {
18
+ sentence: BaseSentence;
19
+ mock?: string;
20
+ accessibleRole: string;
21
+ parameters: string[];
22
+ };
23
+ export declare abstract class Dictionary {
24
+ protected baseSentences: BaseSentence[];
25
+ protected roleBasedSentencesTemplate: RoleBasedSentenceTemplate[];
26
+ protected roles: AccessibleRole[];
27
+ getBaseSentences(): BaseSentence[];
28
+ getRoleBasedSentencesTemplate(): RoleBasedSentenceTemplate[];
29
+ getDefinedRoles(): AccessibleRole[];
30
+ getRoleBasedSentences(): RoleBasedSentence[];
31
+ computeSentence(input: ComputeSentenceInput): string;
32
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dictionary = exports.LANG = void 0;
4
+ var LANG;
5
+ (function (LANG) {
6
+ LANG["FR"] = "fr";
7
+ LANG["EN"] = "en";
8
+ })(LANG || (exports.LANG = LANG = {}));
9
+ class Dictionary {
10
+ baseSentences;
11
+ roleBasedSentencesTemplate;
12
+ roles;
13
+ getBaseSentences() {
14
+ return this.baseSentences;
15
+ }
16
+ getRoleBasedSentencesTemplate() {
17
+ return this.roleBasedSentencesTemplate;
18
+ }
19
+ getDefinedRoles() {
20
+ return this.roles;
21
+ }
22
+ getRoleBasedSentences() {
23
+ const result = [];
24
+ this.roles.forEach(role => {
25
+ this.roleBasedSentencesTemplate
26
+ .filter(sentence => sentence.section === "general" ||
27
+ (sentence.section === "keyboard" && role.shouldGenerateKeyboardSentence) ||
28
+ (sentence.section === "click" && role.shouldGenerateClickSentence) ||
29
+ (sentence.section === "contains" && role.shouldGenerateContainsSentence) ||
30
+ (sentence.section === "type" && role.shouldGenerateTypeSentence) ||
31
+ (sentence.section === "checkable" && role.shouldGenerateCheckedSentence))
32
+ .map(sentence => {
33
+ return {
34
+ ...sentence,
35
+ role: role.name,
36
+ key: `${sentence.key}.role.${role.name.toLowerCase()}`,
37
+ wording: sentence.wording
38
+ .replaceAll("(n)", "")
39
+ .replaceAll("$roleName", role.name)
40
+ .replaceAll("$definiteArticle", role.getDefiniteArticle())
41
+ .replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
42
+ .replaceAll("$namedAdjective", role.namedAdjective())
43
+ .replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle()),
44
+ };
45
+ })
46
+ .forEach(sentence => {
47
+ result.push(sentence);
48
+ });
49
+ });
50
+ return result;
51
+ }
52
+ computeSentence(input) {
53
+ const targetRole = this.getDefinedRoles().filter(role => role.id === input.accessibleRole)[0];
54
+ let resultSentence = input.sentence.wording;
55
+ if (input.mock) {
56
+ resultSentence = resultSentence.replace("{string}", `"${input.mock}"`);
57
+ }
58
+ resultSentence = resultSentence
59
+ .replaceAll("(n)", "")
60
+ .replaceAll("$roleName", targetRole?.name ?? input.accessibleRole)
61
+ .replaceAll("$definiteArticle", targetRole?.getDefiniteArticle())
62
+ .replaceAll("$indefiniteArticle", targetRole?.getIndefiniteArticle())
63
+ .replaceAll("$namedAdjective", targetRole?.namedAdjective())
64
+ .replaceAll("$ofDefiniteArticle", targetRole?.getOfDefiniteArticle());
65
+ input.parameters.forEach(param => {
66
+ resultSentence = resultSentence.replace("{string}", `"${param}"`);
67
+ });
68
+ return resultSentence;
69
+ }
70
+ }
71
+ exports.Dictionary = Dictionary;
@@ -0,0 +1,106 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { AccessibleRole } from "../../accessible-role";
2
+ export declare const EN_ROLES: AccessibleRole[];
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EN_ROLES = void 0;
4
+ const accessible_role_1 = require("../../accessible-role");
5
+ var DEFINITE_ARTICLE;
6
+ (function (DEFINITE_ARTICLE) {
7
+ DEFINITE_ARTICLE["THE"] = "the";
8
+ })(DEFINITE_ARTICLE || (DEFINITE_ARTICLE = {}));
9
+ var INDEFINITE_ARTICLE;
10
+ (function (INDEFINITE_ARTICLE) {
11
+ INDEFINITE_ARTICLE["A"] = "a";
12
+ INDEFINITE_ARTICLE["AN"] = "an";
13
+ })(INDEFINITE_ARTICLE || (INDEFINITE_ARTICLE = {}));
14
+ class EnAccessibleRole extends accessible_role_1.AccessibleRole {
15
+ id;
16
+ name;
17
+ definiteArticle;
18
+ indefiniteArticle;
19
+ shouldGenerateClickSentence;
20
+ shouldGenerateTypeSentence;
21
+ shouldGenerateContainsSentence;
22
+ shouldGenerateKeyboardSentence;
23
+ shouldGenerateCheckedSentence;
24
+ constructor(id, name, definiteArticle = DEFINITE_ARTICLE.THE, indefiniteArticle = INDEFINITE_ARTICLE.A, shouldGenerateClickSentence = false, shouldGenerateTypeSentence = true, shouldGenerateContainsSentence = true, shouldGenerateKeyboardSentence = false, shouldGenerateCheckedSentence = false) {
25
+ super();
26
+ this.id = id;
27
+ this.name = name;
28
+ this.definiteArticle = definiteArticle;
29
+ this.indefiniteArticle = indefiniteArticle;
30
+ this.shouldGenerateClickSentence = shouldGenerateClickSentence;
31
+ this.shouldGenerateTypeSentence = shouldGenerateTypeSentence;
32
+ this.shouldGenerateContainsSentence = shouldGenerateContainsSentence;
33
+ this.shouldGenerateKeyboardSentence = shouldGenerateKeyboardSentence;
34
+ this.shouldGenerateCheckedSentence = shouldGenerateCheckedSentence;
35
+ }
36
+ static from(input) {
37
+ return new EnAccessibleRole(input.id, input.name, input.definiteArticle, input.indefiniteArticle, input.shouldGenerateClickSentence, input.shouldGenerateTypeSentence, input.shouldGenerateContainsSentence, input.shouldGenerateKeyboardSentence, input.shouldGenerateCheckedSentence);
38
+ }
39
+ getDefiniteArticle() {
40
+ return this.definiteArticle.toString();
41
+ }
42
+ getIndefiniteArticle() {
43
+ return this.indefiniteArticle.toString();
44
+ }
45
+ getOfDefiniteArticle() {
46
+ return `of ${this.definiteArticle}`;
47
+ }
48
+ namedAdjective() {
49
+ return "named";
50
+ }
51
+ }
52
+ exports.EN_ROLES = [
53
+ { id: "alert", name: "alert", indefiniteArticle: INDEFINITE_ARTICLE.AN },
54
+ { id: "alertdialog", name: "alert dialog", indefiniteArticle: INDEFINITE_ARTICLE.AN },
55
+ { id: "application", name: "application", indefiniteArticle: INDEFINITE_ARTICLE.AN },
56
+ { id: "article", name: "article", indefiniteArticle: INDEFINITE_ARTICLE.AN },
57
+ { id: "banner", name: "banner" },
58
+ { id: "button", name: "button", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
59
+ { id: "cell", name: "cell" },
60
+ { id: "checkbox", name: "checkbox", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true, shouldGenerateClickSentence: true },
61
+ { id: "columnheader", name: "column header" },
62
+ { id: "combobox", name: "combo box", shouldGenerateTypeSentence: false, shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
63
+ { id: "command", name: "command" },
64
+ { id: "comment", name: "comment" },
65
+ { id: "complementary", name: "complementary" },
66
+ { id: "composite", name: "composite" },
67
+ { id: "contentinfo", name: "contentinfo" },
68
+ { id: "definition", name: "definition" },
69
+ { id: "dialog", name: "dialog" },
70
+ { id: "directory", name: "directory" },
71
+ { id: "document", name: "document" },
72
+ { id: "feed", name: "flow" },
73
+ { id: "figure", name: "figure" },
74
+ { id: "form", name: "form" },
75
+ { id: "generic", name: "generic" },
76
+ { id: "grid", name: "grid" },
77
+ { id: "gridcell", name: "grid cell" },
78
+ { id: "group", name: "group" },
79
+ { id: "heading", name: "title" },
80
+ { id: "img", name: "image", indefiniteArticle: INDEFINITE_ARTICLE.AN },
81
+ { id: "landmark", name: "landmark" },
82
+ { id: "link", name: "link", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
83
+ { id: "list", name: "list", shouldGenerateContainsSentence: false, shouldGenerateTypeSentence: false },
84
+ { id: "listbox", name: "list box", shouldGenerateKeyboardSentence: true },
85
+ { id: "listitem", name: "list item", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
86
+ { id: "log", name: "log" },
87
+ { id: "main", name: "main" },
88
+ { id: "mark", name: "mark" },
89
+ { id: "math", name: "math" },
90
+ { id: "menu", name: "menu" },
91
+ { id: "menubar", name: "menubar" },
92
+ { id: "menuitem", name: "menuitem", shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
93
+ { id: "menuitemcheckbox", name: "menuitemcheckbox", shouldGenerateKeyboardSentence: true },
94
+ { id: "menuitemradio", name: "menuitemradio", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true },
95
+ { id: "meter", name: "counter" },
96
+ { id: "navigation", name: "navigation" },
97
+ { id: "none", name: "no" },
98
+ { id: "note", name: "note" },
99
+ { id: "option", name: "option", indefiniteArticle: INDEFINITE_ARTICLE.AN, shouldGenerateKeyboardSentence: true, shouldGenerateClickSentence: true },
100
+ { id: "presentation", name: "presentation" },
101
+ { id: "progressbar", name: "progress bar" },
102
+ { id: "radio", name: "radio", shouldGenerateKeyboardSentence: true, shouldGenerateCheckedSentence: true, shouldGenerateClickSentence: true },
103
+ { id: "radiogroup", name: "radio group" },
104
+ { id: "range", name: "range" },
105
+ { id: "region", name: "region" },
106
+ { id: "roletype", name: "role type" },
107
+ { id: "row", name: "row" },
108
+ { id: "rowgroup", name: "row group" },
109
+ { id: "rowheader", name: "row header" },
110
+ { id: "scrollbar", name: "scroll bar" },
111
+ { id: "search", name: "search", shouldGenerateKeyboardSentence: true },
112
+ { id: "searchbox", name: "search box", shouldGenerateKeyboardSentence: true },
113
+ { id: "section", name: "section" },
114
+ { id: "sectionhead", name: "section header" },
115
+ { id: "select", name: "select", shouldGenerateKeyboardSentence: true },
116
+ { id: "separator", name: "separator" },
117
+ { id: "slider", name: "slider", shouldGenerateKeyboardSentence: true },
118
+ { id: "spinbutton", name: "spin button", shouldGenerateKeyboardSentence: true },
119
+ { id: "status", name: "status" },
120
+ { id: "structure", name: "structure" },
121
+ { id: "suggestion", name: "suggestion" },
122
+ { id: "switch", name: "switch", shouldGenerateKeyboardSentence: true },
123
+ { id: "tab", name: "tab", shouldGenerateKeyboardSentence: true },
124
+ { id: "table", name: "table" },
125
+ { id: "tablist", name: "tablist" },
126
+ { id: "tabpanel", name: "tabpanel" },
127
+ { id: "term", name: "term" },
128
+ { id: "textbox", name: "text box", shouldGenerateKeyboardSentence: true },
129
+ { id: "timer", name: "timer" },
130
+ { id: "toolbar", name: "toolbar" },
131
+ { id: "tooltip", name: "tooltip" },
132
+ { id: "tree", name: "tree" },
133
+ { id: "treegrid", name: "tree grid" },
134
+ { id: "treeitem", name: "tree item" },
135
+ { id: "widget", name: "widget", shouldGenerateKeyboardSentence: true },
136
+ { id: "window", name: "window" }
137
+ ].map(role => EnAccessibleRole.from(role));