@progress/kendo-e2e 1.4.1 → 1.4.2
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.
|
@@ -20,7 +20,9 @@ function compareHtml(actualHtml, expectedHtml, options) {
|
|
|
20
20
|
const passed = [];
|
|
21
21
|
const missing = [];
|
|
22
22
|
const extra = [];
|
|
23
|
-
|
|
23
|
+
let actualSelectors = [];
|
|
24
|
+
let expectedSelectors = [];
|
|
25
|
+
const result = { passed, missing, extra, actualSelectors, expectedSelectors };
|
|
24
26
|
const config = {
|
|
25
27
|
allowedTags: false,
|
|
26
28
|
allowVulnerableTags: true,
|
|
@@ -28,18 +30,16 @@ function compareHtml(actualHtml, expectedHtml, options) {
|
|
|
28
30
|
};
|
|
29
31
|
const actualDom = new jsdom_1.default.JSDOM((0, sanitize_html_1.default)(actualHtml, config)).window.document.documentElement;
|
|
30
32
|
const expectedDom = new jsdom_1.default.JSDOM((0, sanitize_html_1.default)(expectedHtml, config)).window.document.documentElement;
|
|
31
|
-
let actualSelectors = [];
|
|
32
33
|
let parent = "";
|
|
33
34
|
parseDom(actualDom, actualSelectors, parent);
|
|
34
35
|
parent = "";
|
|
35
|
-
let expectedSelectors = [];
|
|
36
36
|
parseDom(expectedDom, expectedSelectors);
|
|
37
37
|
let actualWithoutExtra = [];
|
|
38
38
|
if ((options === null || options === void 0 ? void 0 : options.allowExtra) !== undefined) {
|
|
39
39
|
for (const selector of actualSelectors) {
|
|
40
40
|
let replacedSelector = selector;
|
|
41
41
|
for (const extraItem of options === null || options === void 0 ? void 0 : options.allowExtra) {
|
|
42
|
-
replacedSelector = replacedSelector.replace(extraItem, "").trim().
|
|
42
|
+
replacedSelector = replacedSelector.replace(extraItem, "").trim().replace(/ /gi, " ");
|
|
43
43
|
}
|
|
44
44
|
actualWithoutExtra.push(replacedSelector);
|
|
45
45
|
}
|
|
@@ -48,9 +48,25 @@ function compareHtml(actualHtml, expectedHtml, options) {
|
|
|
48
48
|
else {
|
|
49
49
|
actualWithoutExtra = actualSelectors;
|
|
50
50
|
}
|
|
51
|
+
let expectedSelectorsWithoutMissing = [];
|
|
52
|
+
if ((options === null || options === void 0 ? void 0 : options.allowMissing) !== undefined) {
|
|
53
|
+
for (const selector of expectedSelectors) {
|
|
54
|
+
let replacedSelector = selector;
|
|
55
|
+
for (const missingItem of options === null || options === void 0 ? void 0 : options.allowMissing) {
|
|
56
|
+
replacedSelector = replacedSelector.replace(missingItem, "").trim().replace(/ /gi, " ");
|
|
57
|
+
}
|
|
58
|
+
expectedSelectorsWithoutMissing.push(replacedSelector);
|
|
59
|
+
}
|
|
60
|
+
expectedSelectorsWithoutMissing = [...new Set(expectedSelectorsWithoutMissing)];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
expectedSelectorsWithoutMissing = expectedSelectors;
|
|
64
|
+
}
|
|
51
65
|
result.passed = actualWithoutExtra.filter((element) => expectedSelectors.includes(element));
|
|
52
|
-
result.extra = actualSelectors.filter((element) => !
|
|
66
|
+
result.extra = actualSelectors.filter((element) => !expectedSelectorsWithoutMissing.includes(element));
|
|
53
67
|
result.missing = expectedSelectors.filter((element) => !actualWithoutExtra.includes(element));
|
|
68
|
+
result.actualSelectors = actualSelectors;
|
|
69
|
+
result.expectedSelectors = expectedSelectors;
|
|
54
70
|
if ((options === null || options === void 0 ? void 0 : options.allowMissing) !== undefined) {
|
|
55
71
|
for (const missingItem of options === null || options === void 0 ? void 0 : options.allowMissing) {
|
|
56
72
|
result.missing = result.missing.filter((item) => !item.includes(missingItem));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-comparer.js","sourceRoot":"","sources":["../../src/rendering/html-comparer.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAiC;AACjC,kEAAyC;AACzC,kDAA0B;
|
|
1
|
+
{"version":3,"file":"html-comparer.js","sourceRoot":"","sources":["../../src/rendering/html-comparer.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAiC;AACjC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