@skbkontur/playwright-react-ui-components 1.14.2 → 1.15.0-beta.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/build/src/assertions/AutocompleteAssertions.js +9 -9
- package/build/src/assertions/ButtonAssertions.js +8 -8
- package/build/src/assertions/CheckboxAssertions.js +11 -11
- package/build/src/assertions/ComboBoxAssertions.js +8 -8
- package/build/src/assertions/ComponentListAssertions.js +5 -5
- package/build/src/assertions/CurrencyInputAssertions.js +8 -8
- package/build/src/assertions/DateInputAssertions.js +8 -8
- package/build/src/assertions/DatePickerAssertions.js +8 -8
- package/build/src/assertions/DateRangePickerAssertions.js +2 -2
- package/build/src/assertions/DropdownAssertions.js +8 -8
- package/build/src/assertions/DropdownMenuAssertions.js +4 -4
- package/build/src/assertions/FileUploaderAssertions.js +2 -2
- package/build/src/assertions/FxInputAssertions.js +8 -8
- package/build/src/assertions/InputAssertions.js +9 -9
- package/build/src/assertions/KebabAssertions.js +2 -2
- package/build/src/assertions/LabelAssertions.js +6 -6
- package/build/src/assertions/LinkAssertions.js +8 -8
- package/build/src/assertions/LoaderAssertions.js +1 -1
- package/build/src/assertions/MenuItemAssertations.js +4 -4
- package/build/src/assertions/PagingAssertions.js +2 -2
- package/build/src/assertions/PortalAssertions.js +2 -2
- package/build/src/assertions/RadioAssertions.js +12 -12
- package/build/src/assertions/RadioGroupAssertions.js +2 -2
- package/build/src/assertions/SelectAssertions.js +6 -6
- package/build/src/assertions/SpinnerAssertions.js +1 -1
- package/build/src/assertions/TabAssertions.js +8 -8
- package/build/src/assertions/TextareaAssertions.js +8 -8
- package/build/src/assertions/ToastAssertions.js +1 -1
- package/build/src/assertions/ToggleAssertions.js +10 -10
- package/build/src/assertions/TokenAssertions.js +7 -7
- package/build/src/assertions/TokenInputAssertions.js +6 -6
- package/build/src/assertions/TooltipAssertions.js +4 -4
- package/build/src/extensions/mergedExpects.d.ts +1 -2
- package/build/src/extensions/mergedExpects.js +1 -2
- package/build/src/matchers/component/toBeChecked.d.ts +3 -0
- package/build/src/matchers/component/{toBeCheckedEx.js → toBeChecked.js} +2 -2
- package/build/src/matchers/component/toBeCheckedByIndex.js +2 -2
- package/build/src/matchers/component/toBeCheckedByText.js +2 -2
- package/build/src/matchers/component/toBeCheckedByValue.js +2 -2
- package/build/src/matchers/component/toBeDisabled.d.ts +3 -0
- package/build/src/matchers/component/{toBeDisabledEx.js → toBeDisabled.js} +5 -5
- package/build/src/matchers/component/toBeEmpty.d.ts +3 -0
- package/build/src/matchers/component/{toBeEmptyEx.js → toBeEmpty.js} +4 -4
- package/build/src/matchers/component/toBeEnabled.d.ts +3 -0
- package/build/src/matchers/component/{toBeEnabledEx.js → toBeEnabled.js} +4 -4
- package/build/src/matchers/component/toBeFocused.d.ts +3 -0
- package/build/src/matchers/component/{toBeFocusedEx.js → toBeFocused.js} +2 -2
- package/build/src/matchers/component/toBeHidden.d.ts +3 -0
- package/build/src/matchers/component/{toBeHiddenEx.js → toBeHidden.js} +2 -2
- package/build/src/matchers/component/toBeUnchecked.js +1 -1
- package/build/src/matchers/component/toBeVisible.d.ts +3 -0
- package/build/src/matchers/component/{toBeVisibleEx.js → toBeVisible.js} +2 -2
- package/build/src/matchers/component/toContainFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toContainFormattedText.js +77 -0
- package/build/src/matchers/component/toContainItem.d.ts +1 -1
- package/build/src/matchers/component/toContainItem.js +2 -1
- package/build/src/matchers/component/toContainItems.js +1 -1
- package/build/src/matchers/component/toContainTabs.js +2 -2
- package/build/src/matchers/component/toContainText.d.ts +3 -0
- package/build/src/matchers/component/{toContainTextEx.js → toContainText.js} +2 -2
- package/build/src/matchers/component/toContainTokens.js +2 -2
- package/build/src/matchers/component/toContainUploadedFiles.js +2 -2
- package/build/src/matchers/component/toHaveAttribute.d.ts +3 -0
- package/build/src/matchers/component/{toHaveAttributeEx.js → toHaveAttribute.js} +2 -2
- package/build/src/matchers/component/toHaveCount.d.ts +3 -0
- package/build/src/matchers/component/{toHaveCountEx.js → toHaveCount.js} +2 -2
- package/build/src/matchers/component/toHaveError.js +1 -1
- package/build/src/matchers/component/toHaveFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedText.js +77 -0
- package/build/src/matchers/component/toHaveFormattedValue.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedValue.js +77 -0
- package/build/src/matchers/component/toHaveItems.js +1 -1
- package/build/src/matchers/component/toHaveText.d.ts +3 -0
- package/build/src/matchers/component/{toHaveTextEx.js → toHaveText.js} +2 -2
- package/build/src/matchers/component/{toHaveValueEx.d.ts → toHaveValue.d.ts} +1 -1
- package/build/src/matchers/component/{toHaveValueEx.js → toHaveValue.js} +6 -6
- package/build/src/matchers/component/toHaveWarning.js +1 -1
- package/build/src/matchers/componentMatchers.d.ts +36 -36
- package/build/src/matchers/componentMatchers.js +42 -48
- package/build/src/matchers/createAsyncMatcher.d.ts +10 -10
- package/build/src/matchers/createAsyncMatcher.js +26 -19
- package/build/src/matchers/index.d.ts +0 -1
- package/build/src/matchers/index.js +0 -1
- package/build/src/options/AssertionOptions.d.ts +1 -1
- package/build/src/utils/removeSpaces.d.ts +6 -0
- package/build/src/utils/removeSpaces.js +10 -0
- package/package.json +2 -2
- package/build/src/matchers/component/toBeCheckedEx.d.ts +0 -3
- package/build/src/matchers/component/toBeDisabledEx.d.ts +0 -3
- package/build/src/matchers/component/toBeEmptyEx.d.ts +0 -3
- package/build/src/matchers/component/toBeEnabledEx.d.ts +0 -3
- package/build/src/matchers/component/toBeFocusedEx.d.ts +0 -3
- package/build/src/matchers/component/toBeHiddenEx.d.ts +0 -3
- package/build/src/matchers/component/toBeVisibleEx.d.ts +0 -3
- package/build/src/matchers/component/toContainFormattedTextEx.d.ts +0 -3
- package/build/src/matchers/component/toContainFormattedTextEx.js +0 -55
- package/build/src/matchers/component/toContainTextEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveAttributeEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveCountEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedTextEx.js +0 -56
- package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedValueEx.js +0 -56
- package/build/src/matchers/component/toHaveTextEx.d.ts +0 -3
- package/build/src/matchers/formattedMatchers.d.ts +0 -21
- package/build/src/matchers/formattedMatchers.js +0 -129
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TransformOptions } from '../../options';
|
|
2
|
-
import type { ToTextElementLocator } from './LocatorSymbols';
|
|
3
|
-
export declare const toHaveFormattedTextEx: (this: import("playwright/test").ExpectMatcherState, component: ToTextElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.toHaveFormattedTextEx = void 0;
|
|
40
|
-
var extensions_1 = require("../../extensions");
|
|
41
|
-
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
42
|
-
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
|
-
exports.toHaveFormattedTextEx = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveFormattedTextEx', function (component) { return component[LocatorSymbols_1.toTextElementLocator](); }, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
44
|
-
var expectation;
|
|
45
|
-
var isNot = _b.isNot, locator = _b.locator;
|
|
46
|
-
return __generator(this, function (_c) {
|
|
47
|
-
switch (_c.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
expectation = isNot ? (0, extensions_1.expect)(locator).not : (0, extensions_1.expect)(locator);
|
|
50
|
-
return [4 /*yield*/, expectation.toHaveFormattedText(expected, options)];
|
|
51
|
-
case 1:
|
|
52
|
-
_c.sent();
|
|
53
|
-
return [2 /*return*/];
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}); });
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TransformOptions } from '../../options';
|
|
2
|
-
import { type ToWithValueElementLocator } from './LocatorSymbols';
|
|
3
|
-
export declare const toHaveFormattedValueEx: (this: import("playwright/test").ExpectMatcherState, component: ToWithValueElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.toHaveFormattedValueEx = void 0;
|
|
40
|
-
var extensions_1 = require("../../extensions");
|
|
41
|
-
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
42
|
-
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
|
-
exports.toHaveFormattedValueEx = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveFormattedValueEx', function (component) { return component[LocatorSymbols_1.toValueElementLocator](); }, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
44
|
-
var expectation;
|
|
45
|
-
var isNot = _b.isNot, locator = _b.locator;
|
|
46
|
-
return __generator(this, function (_c) {
|
|
47
|
-
switch (_c.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
expectation = isNot ? (0, extensions_1.expect)(locator).not : (0, extensions_1.expect)(locator);
|
|
50
|
-
return [4 /*yield*/, expectation.toHaveFormattedValue(expected, options)];
|
|
51
|
-
case 1:
|
|
52
|
-
_c.sent();
|
|
53
|
-
return [2 /*return*/];
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}); });
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ToTextElementLocator } from './LocatorSymbols';
|
|
2
|
-
import type { TextOptions } from '../../options';
|
|
3
|
-
export declare const toHaveTextEx: (this: import("@playwright/test").ExpectMatcherState, component: ToTextElementLocator, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Locator, ExpectMatcherState, MatcherReturnType } from '@playwright/test';
|
|
2
|
-
import type { TransformOptions } from '../options';
|
|
3
|
-
export type Transform = (value: string) => string;
|
|
4
|
-
declare const matchers: {
|
|
5
|
-
readonly toHaveFormattedValue: typeof toHaveFormattedValue;
|
|
6
|
-
readonly toHaveFormattedText: typeof toHaveFormattedText;
|
|
7
|
-
readonly toContainFormattedText: typeof toContainFormattedText;
|
|
8
|
-
};
|
|
9
|
-
export type FormattedMatchers = typeof matchers;
|
|
10
|
-
/**
|
|
11
|
-
* Набор проверок, которые игнорируют форматирование значения. По-умолчанию игнорируют пробелы.
|
|
12
|
-
*/
|
|
13
|
-
export declare const formattedMatchers: import("@playwright/test").Expect<{
|
|
14
|
-
readonly toHaveFormattedValue: typeof toHaveFormattedValue;
|
|
15
|
-
readonly toHaveFormattedText: typeof toHaveFormattedText;
|
|
16
|
-
readonly toContainFormattedText: typeof toContainFormattedText;
|
|
17
|
-
}>;
|
|
18
|
-
declare function toHaveFormattedValue(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
19
|
-
declare function toHaveFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
20
|
-
declare function toContainFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
21
|
-
export {};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.formattedMatchers = void 0;
|
|
40
|
-
var test_1 = require("@playwright/test");
|
|
41
|
-
var removeSpaces = function (value) { return value.replace(/\s/g, ''); };
|
|
42
|
-
var matchers = {
|
|
43
|
-
toHaveFormattedValue: toHaveFormattedValue,
|
|
44
|
-
toHaveFormattedText: toHaveFormattedText,
|
|
45
|
-
toContainFormattedText: toContainFormattedText,
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Набор проверок, которые игнорируют форматирование значения. По-умолчанию игнорируют пробелы.
|
|
49
|
-
*/
|
|
50
|
-
exports.formattedMatchers = test_1.expect.extend(matchers);
|
|
51
|
-
function toHaveFormattedValue(locator, expected, options) {
|
|
52
|
-
return toHaveFormatted(this, 'toHaveFormattedValue', function (locator) { return locator.inputValue(); })(locator, expected, options);
|
|
53
|
-
}
|
|
54
|
-
function toHaveFormattedText(locator, expected, options) {
|
|
55
|
-
return toHaveFormatted(this, 'toHaveFormattedText', function (locator) { return locator.textContent(); })(locator, expected, options);
|
|
56
|
-
}
|
|
57
|
-
function toContainFormattedText(locator, expected, options) {
|
|
58
|
-
return toHaveFormatted(this, 'toContainFormattedText', function (locator) { return locator.textContent(); }, false)(locator, expected, options);
|
|
59
|
-
}
|
|
60
|
-
function toHaveFormatted(context, matcherName, getter, strictExpect) {
|
|
61
|
-
var _this = this;
|
|
62
|
-
if (strictExpect === void 0) { strictExpect = true; }
|
|
63
|
-
return function (locator, expected, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
-
function pollAndTransform() {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var value, transformedValue;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0: return [4 /*yield*/, getter(locator)];
|
|
70
|
-
case 1:
|
|
71
|
-
value = _a.sent();
|
|
72
|
-
transformedValue = value ? transform(value) : value;
|
|
73
|
-
actual = transformedValue;
|
|
74
|
-
return [2 /*return*/, transformedValue];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
var _a, timeout, _b, transform, pass, actual, _c, message;
|
|
80
|
-
return __generator(this, function (_d) {
|
|
81
|
-
switch (_d.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
_a = options || {}, timeout = _a.timeout, _b = _a.transform, transform = _b === void 0 ? removeSpaces : _b;
|
|
84
|
-
_d.label = 1;
|
|
85
|
-
case 1:
|
|
86
|
-
_d.trys.push([1, 6, , 7]);
|
|
87
|
-
if (!strictExpect) return [3 /*break*/, 3];
|
|
88
|
-
return [4 /*yield*/, test_1.expect.poll(pollAndTransform, { timeout: timeout }).toEqual(transform(expected))];
|
|
89
|
-
case 2:
|
|
90
|
-
_d.sent();
|
|
91
|
-
return [3 /*break*/, 5];
|
|
92
|
-
case 3: return [4 /*yield*/, test_1.expect.poll(pollAndTransform, { timeout: timeout }).toContain(transform(expected))];
|
|
93
|
-
case 4:
|
|
94
|
-
_d.sent();
|
|
95
|
-
_d.label = 5;
|
|
96
|
-
case 5:
|
|
97
|
-
pass = true;
|
|
98
|
-
return [3 /*break*/, 7];
|
|
99
|
-
case 6:
|
|
100
|
-
_c = _d.sent();
|
|
101
|
-
pass = false;
|
|
102
|
-
return [3 /*break*/, 7];
|
|
103
|
-
case 7:
|
|
104
|
-
message = pass
|
|
105
|
-
? function () {
|
|
106
|
-
return context.utils.matcherHint(matcherName, undefined, undefined, { isNot: context.isNot }) +
|
|
107
|
-
'\n\n' +
|
|
108
|
-
"Locator: ".concat(locator, "\n") +
|
|
109
|
-
"Expected: ".concat(context.isNot ? 'not' : '').concat(context.utils.printExpected(expected), "\n") +
|
|
110
|
-
(actual ? "Received: ".concat(context.utils.printReceived(actual)) : '');
|
|
111
|
-
}
|
|
112
|
-
: function () {
|
|
113
|
-
return context.utils.matcherHint(matcherName, undefined, undefined, { isNot: context.isNot }) +
|
|
114
|
-
'\n\n' +
|
|
115
|
-
"Locator: ".concat(locator, "\n") +
|
|
116
|
-
"Expected: ".concat(context.utils.printExpected(expected), "\n") +
|
|
117
|
-
(actual ? "Received: ".concat(context.utils.printReceived(actual)) : '');
|
|
118
|
-
};
|
|
119
|
-
return [2 /*return*/, {
|
|
120
|
-
message: message,
|
|
121
|
-
pass: pass,
|
|
122
|
-
name: matcherName,
|
|
123
|
-
expected: expected,
|
|
124
|
-
actual: actual,
|
|
125
|
-
}];
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}); };
|
|
129
|
-
}
|