@uuv/assistant 2.73.2 → 2.74.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/dist/launcher/conf.json +1 -1
- package/dist/src/translator/abstract-translator.d.ts +1 -1
- package/dist/src/translator/abstract-translator.js +2 -1
- package/dist/src/translator/click-translator.d.ts +1 -1
- package/dist/src/translator/click-translator.js +2 -2
- package/dist/src/translator/expect-translator.d.ts +1 -1
- package/dist/src/translator/expect-translator.js +2 -2
- package/dist/src/translator/keyboard-navigation-translator.d.ts +1 -1
- package/dist/src/translator/keyboard-navigation-translator.js +2 -2
- package/dist/src/translator/type-translator.d.ts +3 -1
- package/dist/src/translator/type-translator.js +26 -16
- package/dist/src/translator/within-translator.d.ts +1 -1
- package/dist/src/translator/within-translator.js +2 -2
- package/dist/uuv-assistant-resources.bundle.js +32 -32
- package/package.json +5 -5
package/dist/launcher/conf.json
CHANGED
|
@@ -16,7 +16,7 @@ export declare abstract class Translator {
|
|
|
16
16
|
protected dictionary: EnDictionary;
|
|
17
17
|
protected selectedHtmlElem: HTMLElement | SVGElement;
|
|
18
18
|
translate(htmlElem: HTMLElement | SVGElement): Promise<TranslateSentences>;
|
|
19
|
-
abstract getSentenceFromDomSelector(
|
|
19
|
+
abstract getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
20
20
|
abstract getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
21
21
|
abstract getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
22
22
|
static getSelector(element: any): string;
|
|
@@ -54,7 +54,8 @@ class Translator {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
|
|
57
|
+
const domSelector = Translator.getSelector(htmlElem);
|
|
58
|
+
response = this.getSentenceFromDomSelector(domSelector, htmlElem);
|
|
58
59
|
response.suggestion = new model_1.Suggestion();
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -15,7 +15,7 @@ import { TranslateSentences } from "./model";
|
|
|
15
15
|
export declare class ClickTranslator extends Translator {
|
|
16
16
|
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
17
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
-
getSentenceFromDomSelector(
|
|
18
|
+
getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
19
19
|
private buildSentencesWithRoleAndName;
|
|
20
20
|
private buildWording;
|
|
21
21
|
}
|
|
@@ -25,10 +25,10 @@ class ClickTranslator extends abstract_translator_1.Translator {
|
|
|
25
25
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole, accessibleName, content) {
|
|
26
26
|
return this.getSentenceFromAccessibleRoleAndName(accessibleRole, accessibleName);
|
|
27
27
|
}
|
|
28
|
-
getSentenceFromDomSelector(htmlElem) {
|
|
28
|
+
getSentenceFromDomSelector(domSelector, htmlElem) {
|
|
29
29
|
const response = this.initResponse();
|
|
30
30
|
const computedKey = "key.when.withinElement.selector";
|
|
31
|
-
const sentence = this.computeSentenceFromKeyAndSelector(computedKey,
|
|
31
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, domSelector);
|
|
32
32
|
const clickSentence = this.getSentenceFromKey("key.when.click.withContext");
|
|
33
33
|
response.sentences = [stepCase + sentence, model_1.StepCaseEnum.THEN + clickSentence.wording];
|
|
34
34
|
return response;
|
|
@@ -16,7 +16,7 @@ export declare class ExpectTranslator extends Translator {
|
|
|
16
16
|
private buildResponse;
|
|
17
17
|
getSentenceFromAccessibleRoleAndName(role: string, name: string): TranslateSentences;
|
|
18
18
|
getSentenceFromAccessibleRoleAndNameAndContent(role: string, name: string, content: string): TranslateSentences;
|
|
19
|
-
getSentenceFromDomSelector(
|
|
19
|
+
getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
20
20
|
computeTableSentenceFromKeyNameAndContent(sentenceKey: string, indefiniteArticle: string, roleName: string, accessibleName: string, headers: HTMLElement, rows: HTMLElement[], cellRoleName: string): string;
|
|
21
21
|
computeDialogSentenceFromKeyNameAndContent(sentenceKey: string, accessibleName: string, row: HTMLElement): Promise<string[]>;
|
|
22
22
|
private formatMarkdownTable;
|
|
@@ -79,9 +79,9 @@ class ExpectTranslator extends abstract_translator_1.Translator {
|
|
|
79
79
|
const sentence = this.computeSentenceFromKeyRoleNameAndContent(key, role, name, content);
|
|
80
80
|
return this.buildResponse([sentence]);
|
|
81
81
|
}
|
|
82
|
-
getSentenceFromDomSelector(htmlElem) {
|
|
82
|
+
getSentenceFromDomSelector(domSelector, htmlElem) {
|
|
83
83
|
const key = "key.then.element.withSelector";
|
|
84
|
-
const sentence = this.computeSentenceFromKeyAndSelector(key,
|
|
84
|
+
const sentence = this.computeSentenceFromKeyAndSelector(key, domSelector);
|
|
85
85
|
return this.buildResponse([sentence]);
|
|
86
86
|
}
|
|
87
87
|
computeTableSentenceFromKeyNameAndContent(sentenceKey, indefiniteArticle, roleName, accessibleName, headers, rows, cellRoleName) {
|
|
@@ -15,5 +15,5 @@ import { TranslateSentences } from "./model";
|
|
|
15
15
|
export declare class KeyboardNavigationTranslator extends Translator {
|
|
16
16
|
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
17
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
-
getSentenceFromDomSelector(
|
|
18
|
+
getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
19
19
|
}
|
|
@@ -27,10 +27,10 @@ class KeyboardNavigationTranslator extends abstract_translator_1.Translator {
|
|
|
27
27
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole, accessibleName, content) {
|
|
28
28
|
return this.getSentenceFromAccessibleRoleAndName(accessibleRole, accessibleName);
|
|
29
29
|
}
|
|
30
|
-
getSentenceFromDomSelector(htmlElem) {
|
|
30
|
+
getSentenceFromDomSelector(domSelector, htmlElem) {
|
|
31
31
|
const response = this.initResponse();
|
|
32
32
|
const computedKey = "key.then.element.withSelectorFocused";
|
|
33
|
-
const sentence = this.computeSentenceFromKeyAndSelector(computedKey,
|
|
33
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, domSelector);
|
|
34
34
|
const nextFocusedElementSentence = this.dictionary.getBaseSentences().find((el) => el.key === "key.when.keyboard.nextElement");
|
|
35
35
|
response.sentences = [
|
|
36
36
|
stepCase + (nextFocusedElementSentence === null || nextFocusedElementSentence === void 0 ? void 0 : nextFocusedElementSentence.wording),
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
import { Translator } from "./abstract-translator";
|
|
14
14
|
import { TranslateSentences } from "./model";
|
|
15
15
|
export declare class TypeTranslator extends Translator {
|
|
16
|
+
private _useValueAsMockData;
|
|
17
|
+
set useValueAsMockData(value: boolean);
|
|
16
18
|
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
19
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
-
getSentenceFromDomSelector(
|
|
20
|
+
getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
19
21
|
computeSentenceFromKeyRoleNameAndContent(computedKey: string, accessibleRole: string, accessibleName: string, content: string): string;
|
|
20
22
|
private buildSentencesWithRoleAndName;
|
|
21
23
|
private buildWording;
|
|
@@ -17,9 +17,16 @@ const abstract_translator_1 = require("./abstract-translator");
|
|
|
17
17
|
const model_1 = require("./model");
|
|
18
18
|
const stepCase = model_1.StepCaseEnum.WHEN;
|
|
19
19
|
class TypeTranslator extends abstract_translator_1.Translator {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this._useValueAsMockData = true;
|
|
23
|
+
}
|
|
24
|
+
set useValueAsMockData(value) {
|
|
25
|
+
this._useValueAsMockData = value;
|
|
26
|
+
}
|
|
20
27
|
getSentenceFromAccessibleRoleAndName(accessibleRole, accessibleName) {
|
|
21
28
|
const response = this.initResponse();
|
|
22
|
-
response.sentences = this.buildSentencesWithRoleAndName(accessibleRole, accessibleName);
|
|
29
|
+
response.sentences = this.buildSentencesWithRoleAndName(accessibleRole, accessibleName, this._useValueAsMockData);
|
|
23
30
|
return response;
|
|
24
31
|
}
|
|
25
32
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole, accessibleName, content) {
|
|
@@ -31,18 +38,18 @@ class TypeTranslator extends abstract_translator_1.Translator {
|
|
|
31
38
|
];
|
|
32
39
|
return response;
|
|
33
40
|
}
|
|
34
|
-
getSentenceFromDomSelector(htmlElem) {
|
|
41
|
+
getSentenceFromDomSelector(domSelector, htmlElem) {
|
|
35
42
|
var _a, _b, _c;
|
|
36
43
|
const response = this.initResponse();
|
|
37
44
|
const computedKey = "key.when.withinElement.selector";
|
|
38
|
-
const sentence = this.computeSentenceFromKeyAndSelector(computedKey,
|
|
45
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, domSelector);
|
|
39
46
|
const clickSentence = this.getSentenceFromKey("key.when.type.withContext");
|
|
40
47
|
const resetContextSentence = this.getSentenceFromKey("key.when.resetContext");
|
|
41
48
|
const isInputHtmlorTextArea = htmlElem instanceof HTMLInputElement || htmlElem instanceof HTMLTextAreaElement;
|
|
42
49
|
const content = isInputHtmlorTextArea ?
|
|
43
50
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
44
51
|
htmlElem.value :
|
|
45
|
-
(_a = htmlElem.getAttribute("value")) !== null && _a !== void 0 ? _a : (_c = (_b = htmlElem.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
52
|
+
(_a = htmlElem === null || htmlElem === void 0 ? void 0 : htmlElem.getAttribute("value")) !== null && _a !== void 0 ? _a : (_c = (_b = htmlElem === null || htmlElem === void 0 ? void 0 : htmlElem.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
46
53
|
response.sentences = [
|
|
47
54
|
stepCase + sentence,
|
|
48
55
|
model_1.StepCaseEnum.AND + clickSentence.wording.replace("{string}", this.getMockedDataForHtmlElement(htmlElem, content)),
|
|
@@ -61,33 +68,36 @@ class TypeTranslator extends abstract_translator_1.Translator {
|
|
|
61
68
|
});
|
|
62
69
|
})[0];
|
|
63
70
|
}
|
|
64
|
-
buildSentencesWithRoleAndName(accessibleRole, accessibleName) {
|
|
71
|
+
buildSentencesWithRoleAndName(accessibleRole, accessibleName, useValueAsMockData = true) {
|
|
65
72
|
const sentenceKey = accessibleRole === "textbox" ? "key.when.type" : "key.when.enter";
|
|
66
|
-
const wording = this.buildWording(sentenceKey, accessibleRole, accessibleName);
|
|
73
|
+
const wording = this.buildWording(sentenceKey, accessibleRole, accessibleName, useValueAsMockData);
|
|
67
74
|
return [stepCase + wording];
|
|
68
75
|
}
|
|
69
76
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
70
|
-
buildWording(computedKey, accessibleRole, accessibleName) {
|
|
77
|
+
buildWording(computedKey, accessibleRole, accessibleName, useValueAsMockData = true) {
|
|
71
78
|
const typeSentence = [
|
|
72
79
|
...this.dictionary.getRoleBasedSentencesTemplate(),
|
|
73
80
|
...this.dictionary.getBaseSentences()
|
|
74
81
|
].find((el) => (el.key === computedKey));
|
|
75
82
|
return this.dictionary.computeSentence({
|
|
76
|
-
mock: this.getMockedDataForAccessibleRole(accessibleRole),
|
|
83
|
+
mock: this.getMockedDataForAccessibleRole(accessibleRole, useValueAsMockData),
|
|
77
84
|
sentence: typeSentence,
|
|
78
85
|
accessibleRole,
|
|
79
86
|
parameters: [accessibleName]
|
|
80
87
|
});
|
|
81
88
|
}
|
|
82
|
-
getMockedDataForAccessibleRole(accessibleRole) {
|
|
89
|
+
getMockedDataForAccessibleRole(accessibleRole, useValueAsMockData = true) {
|
|
83
90
|
var _a, _b, _c;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
let content;
|
|
92
|
+
if (useValueAsMockData) {
|
|
93
|
+
const isInputHtmlOrTextArea = this.selectedHtmlElem instanceof HTMLInputElement || this.selectedHtmlElem instanceof HTMLTextAreaElement;
|
|
94
|
+
content = isInputHtmlOrTextArea ?
|
|
95
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
96
|
+
this.selectedHtmlElem.value :
|
|
97
|
+
(_a = this.selectedHtmlElem.getAttribute("value")) !== null && _a !== void 0 ? _a : (_c = (_b = this.selectedHtmlElem.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
98
|
+
if (!content) {
|
|
99
|
+
content = undefined;
|
|
100
|
+
}
|
|
91
101
|
}
|
|
92
102
|
if (accessibleRole === "spinbutton") {
|
|
93
103
|
return content !== null && content !== void 0 ? content : "123";
|
|
@@ -15,5 +15,5 @@ import { TranslateSentences } from "./model";
|
|
|
15
15
|
export declare class WithinTranslator extends Translator {
|
|
16
16
|
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
17
|
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
-
getSentenceFromDomSelector(
|
|
18
|
+
getSentenceFromDomSelector(domSelector: string, htmlElem?: HTMLElement | SVGElement): TranslateSentences;
|
|
19
19
|
}
|
|
@@ -31,10 +31,10 @@ class WithinTranslator extends abstract_translator_1.Translator {
|
|
|
31
31
|
response.sentences = [stepCase + sentence];
|
|
32
32
|
return response;
|
|
33
33
|
}
|
|
34
|
-
getSentenceFromDomSelector(htmlElem) {
|
|
34
|
+
getSentenceFromDomSelector(domSelector, htmlElem) {
|
|
35
35
|
const response = this.initResponse();
|
|
36
36
|
const computedKey = "key.when.withinElement.selector";
|
|
37
|
-
const sentence = this.computeSentenceFromKeyAndSelector(computedKey,
|
|
37
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, domSelector);
|
|
38
38
|
response.sentences = [stepCase + sentence];
|
|
39
39
|
return response;
|
|
40
40
|
}
|