expect-webdriverio 4.12.2 → 4.14.0
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.
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
import { toHaveAttributeAndValue } from './toHaveAttribute.js';
|
|
2
|
-
import { waitUntil, enhanceError, executeCommand, wrapExpectedWithArray, compareText, isAsymmeyricMatcher } from '../../utils.js';
|
|
3
1
|
import { DEFAULT_OPTIONS } from '../../constants.js';
|
|
2
|
+
import { compareText, compareTextWithArray, enhanceError, executeCommand, isAsymmeyricMatcher, waitUntil, wrapExpectedWithArray } from '../../utils.js';
|
|
3
|
+
import { toHaveAttributeAndValue } from './toHaveAttribute.js';
|
|
4
4
|
async function condition(el, attribute, value, options) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
if (typeof attr !== 'string') {
|
|
5
|
+
const actualClass = await (await el).getAttribute(attribute);
|
|
6
|
+
if (typeof actualClass !== 'string') {
|
|
8
7
|
return { result: false };
|
|
9
8
|
}
|
|
10
|
-
if (trim) {
|
|
11
|
-
attr = attr.trim();
|
|
12
|
-
}
|
|
13
|
-
if (ignoreCase) {
|
|
14
|
-
attr = attr.toLowerCase();
|
|
15
|
-
if (typeof value === 'string') {
|
|
16
|
-
value = value.toLowerCase();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
9
|
if (isAsymmeyricMatcher(value)) {
|
|
20
|
-
return compareText(
|
|
10
|
+
return compareText(actualClass, value, options);
|
|
21
11
|
}
|
|
22
|
-
const classes =
|
|
23
|
-
const
|
|
24
|
-
return value
|
|
25
|
-
?
|
|
26
|
-
:
|
|
27
|
-
? t.includes(value)
|
|
28
|
-
: compareText(t, value, options).result;
|
|
12
|
+
const classes = actualClass.split(' ');
|
|
13
|
+
const isValueInClasses = classes.some((t) => {
|
|
14
|
+
return Array.isArray(value)
|
|
15
|
+
? compareTextWithArray(t, value, options).result
|
|
16
|
+
: compareText(t, value, options).result;
|
|
29
17
|
});
|
|
30
18
|
return {
|
|
31
|
-
value:
|
|
32
|
-
result:
|
|
19
|
+
value: actualClass,
|
|
20
|
+
result: isValueInClasses
|
|
33
21
|
};
|
|
34
22
|
}
|
|
35
23
|
export function toHaveClass(...args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
5
5
|
"description": "WebdriverIO Assertion Library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": [
|
|
25
25
|
{
|
|
26
|
-
"types": "./types/
|
|
26
|
+
"types": "./types/standalone.d.ts",
|
|
27
27
|
"import": "./lib/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./lib/index.js"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"./types": "./types/jest-global.d.ts"
|
|
37
37
|
},
|
|
38
|
-
"types": "./types/
|
|
38
|
+
"types": "./types/standalone.d.ts",
|
|
39
39
|
"typeScriptVersion": "3.8.3",
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=16 || >=18 || >=20"
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
"c8": "^9.1.0",
|
|
69
69
|
"eslint": "^8.56.0",
|
|
70
70
|
"eslint-plugin-import": "^2.29.1",
|
|
71
|
-
"eslint-plugin-unicorn": "^
|
|
71
|
+
"eslint-plugin-unicorn": "^53.0.0",
|
|
72
72
|
"husky": "^9.0.7",
|
|
73
|
-
"npm-run-
|
|
73
|
+
"npm-run-all2": "^6.1.2",
|
|
74
74
|
"release-it": "^17.0.3",
|
|
75
75
|
"rimraf": "^5.0.5",
|
|
76
76
|
"shelljs": "^0.8.5",
|
|
77
77
|
"typescript": "^5.3.3",
|
|
78
|
-
"vitest": "1.
|
|
79
|
-
"webdriverio": "8.
|
|
78
|
+
"vitest": "1.6.0",
|
|
79
|
+
"webdriverio": "8.38.0"
|
|
80
80
|
},
|
|
81
81
|
"optionalDependencies": {
|
|
82
82
|
"@wdio/globals": "^8.29.3",
|