@skbkontur/playwright-react-ui-components 1.13.2 → 1.14.0-beta.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.
Files changed (208) hide show
  1. package/build/src/assertions/AutocompleteAssertions.js +10 -10
  2. package/build/src/assertions/BaseComponentAssertions.js +11 -11
  3. package/build/src/assertions/ButtonAssertions.js +9 -9
  4. package/build/src/assertions/CheckboxAssertions.js +13 -13
  5. package/build/src/assertions/ComboBoxAssertions.js +17 -111
  6. package/build/src/assertions/ComponentListAssertions.js +6 -6
  7. package/build/src/assertions/CurrencyInputAssertions.js +11 -61
  8. package/build/src/assertions/DateInputAssertions.js +9 -9
  9. package/build/src/assertions/DatePickerAssertions.js +9 -9
  10. package/build/src/assertions/DateRangePickerAssertions.js +4 -25
  11. package/build/src/assertions/DropdownAssertions.js +13 -63
  12. package/build/src/assertions/DropdownMenuAssertions.js +11 -61
  13. package/build/src/assertions/FileUploaderAssertions.d.ts +1 -3
  14. package/build/src/assertions/FileUploaderAssertions.js +5 -22
  15. package/build/src/assertions/FxInputAssertions.js +11 -14
  16. package/build/src/assertions/InputAssertions.js +10 -10
  17. package/build/src/assertions/KebabAssertions.js +7 -58
  18. package/build/src/assertions/LabelAssertions.js +7 -7
  19. package/build/src/assertions/LinkAssertions.js +11 -12
  20. package/build/src/assertions/LoaderAssertions.js +2 -2
  21. package/build/src/assertions/MenuItemAssertations.js +5 -5
  22. package/build/src/assertions/PagingAssertions.js +5 -40
  23. package/build/src/assertions/PortalAssertions.js +3 -3
  24. package/build/src/assertions/RadioAssertions.js +13 -13
  25. package/build/src/assertions/RadioGroupAssertions.js +10 -81
  26. package/build/src/assertions/SelectAssertions.js +15 -64
  27. package/build/src/assertions/SpinnerAssertions.js +2 -2
  28. package/build/src/assertions/TabAssertions.js +11 -12
  29. package/build/src/assertions/TabsAssertions.js +4 -32
  30. package/build/src/assertions/TextareaAssertions.js +9 -9
  31. package/build/src/assertions/ToastAssertions.js +2 -2
  32. package/build/src/assertions/ToggleAssertions.js +11 -11
  33. package/build/src/assertions/TokenAssertions.js +8 -14
  34. package/build/src/assertions/TokenInputAssertions.js +8 -28
  35. package/build/src/assertions/TooltipAssertions.js +5 -5
  36. package/build/src/components/Autocomplete.d.ts +4 -0
  37. package/build/src/components/Autocomplete.js +52 -50
  38. package/build/src/components/BaseComponent.d.ts +4 -0
  39. package/build/src/components/BaseComponent.js +37 -30
  40. package/build/src/components/Button.d.ts +4 -0
  41. package/build/src/components/Button.js +25 -19
  42. package/build/src/components/Checkbox.d.ts +6 -0
  43. package/build/src/components/Checkbox.js +28 -36
  44. package/build/src/components/ComboBox.d.ts +8 -2
  45. package/build/src/components/ComboBox.js +67 -54
  46. package/build/src/components/ComponentList.d.ts +6 -3
  47. package/build/src/components/ComponentList.js +39 -50
  48. package/build/src/components/CurrencyInput.d.ts +4 -0
  49. package/build/src/components/CurrencyInput.js +39 -37
  50. package/build/src/components/DateInput.d.ts +4 -0
  51. package/build/src/components/DateInput.js +34 -32
  52. package/build/src/components/DatePicker.d.ts +4 -0
  53. package/build/src/components/DatePicker.js +35 -33
  54. package/build/src/components/DateRangePicker.d.ts +2 -0
  55. package/build/src/components/DateRangePicker.js +14 -10
  56. package/build/src/components/Dropdown.d.ts +7 -2
  57. package/build/src/components/Dropdown.js +68 -65
  58. package/build/src/components/DropdownMenu.d.ts +6 -2
  59. package/build/src/components/DropdownMenu.js +67 -65
  60. package/build/src/components/FileUploader.d.ts +3 -1
  61. package/build/src/components/FileUploader.js +39 -39
  62. package/build/src/components/FxInput.d.ts +4 -0
  63. package/build/src/components/FxInput.js +44 -42
  64. package/build/src/components/Input.d.ts +4 -0
  65. package/build/src/components/Input.js +37 -35
  66. package/build/src/components/Kebab.d.ts +5 -2
  67. package/build/src/components/Kebab.js +49 -48
  68. package/build/src/components/Label.d.ts +2 -0
  69. package/build/src/components/Label.js +9 -13
  70. package/build/src/components/Link.d.ts +4 -0
  71. package/build/src/components/Link.js +19 -25
  72. package/build/src/components/Loader.d.ts +2 -0
  73. package/build/src/components/Loader.js +15 -10
  74. package/build/src/components/MenuComponent.d.ts +10 -0
  75. package/build/src/components/MenuComponent.js +79 -0
  76. package/build/src/components/MenuItem.d.ts +2 -0
  77. package/build/src/components/MenuItem.js +7 -3
  78. package/build/src/components/Paging.d.ts +2 -0
  79. package/build/src/components/Paging.js +59 -52
  80. package/build/src/components/Portal.d.ts +2 -0
  81. package/build/src/components/Portal.js +14 -10
  82. package/build/src/components/Radio.d.ts +6 -0
  83. package/build/src/components/Radio.js +31 -27
  84. package/build/src/components/RadioGroup.d.ts +2 -0
  85. package/build/src/components/RadioGroup.js +51 -47
  86. package/build/src/components/Select.d.ts +5 -0
  87. package/build/src/components/Select.js +92 -76
  88. package/build/src/components/Spinner.d.ts +2 -0
  89. package/build/src/components/Spinner.js +13 -9
  90. package/build/src/components/Tab.d.ts +4 -0
  91. package/build/src/components/Tab.js +17 -27
  92. package/build/src/components/Textarea.d.ts +4 -0
  93. package/build/src/components/Textarea.js +33 -39
  94. package/build/src/components/Toast.d.ts +2 -0
  95. package/build/src/components/Toast.js +7 -3
  96. package/build/src/components/Toggle.d.ts +5 -0
  97. package/build/src/components/Toggle.js +24 -33
  98. package/build/src/components/Token.d.ts +3 -0
  99. package/build/src/components/Token.js +14 -9
  100. package/build/src/components/TokenInput.d.ts +4 -0
  101. package/build/src/components/TokenInput.js +61 -59
  102. package/build/src/components/Tooltip.d.ts +2 -0
  103. package/build/src/components/Tooltip.js +9 -9
  104. package/build/src/components/index.d.ts +1 -0
  105. package/build/src/components/index.js +3 -1
  106. package/build/src/extensions/index.d.ts +1 -0
  107. package/build/src/extensions/index.js +17 -0
  108. package/build/src/extensions/mergedExpects.d.ts +5 -0
  109. package/build/src/extensions/mergedExpects.js +7 -0
  110. package/build/src/index.d.ts +2 -0
  111. package/build/src/index.js +2 -0
  112. package/build/src/matchers/component/LocatorSymbols.d.ts +43 -0
  113. package/build/src/matchers/component/LocatorSymbols.js +13 -0
  114. package/build/src/matchers/component/toBeActiveTab.d.ts +3 -0
  115. package/build/src/matchers/component/toBeActiveTab.js +56 -0
  116. package/build/src/matchers/component/toBeAutoMode.d.ts +3 -0
  117. package/build/src/matchers/component/toBeAutoMode.js +62 -0
  118. package/build/src/matchers/component/toBeCheckedByIndex.d.ts +3 -0
  119. package/build/src/matchers/component/toBeCheckedByIndex.js +62 -0
  120. package/build/src/matchers/component/toBeCheckedByText.d.ts +3 -0
  121. package/build/src/matchers/component/toBeCheckedByText.js +62 -0
  122. package/build/src/matchers/component/toBeCheckedByValue.d.ts +3 -0
  123. package/build/src/matchers/component/toBeCheckedByValue.js +62 -0
  124. package/build/src/matchers/component/toBeCheckedEx.d.ts +3 -0
  125. package/build/src/matchers/component/toBeCheckedEx.js +56 -0
  126. package/build/src/matchers/component/toBeDisabledEx.d.ts +3 -0
  127. package/build/src/matchers/component/toBeDisabledEx.js +171 -0
  128. package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
  129. package/build/src/matchers/component/toBeEmptyEx.js +136 -0
  130. package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
  131. package/build/src/matchers/component/toBeEnabledEx.js +196 -0
  132. package/build/src/matchers/component/toBeFocusedEx.d.ts +3 -0
  133. package/build/src/matchers/component/toBeFocusedEx.js +56 -0
  134. package/build/src/matchers/component/toBeHiddenEx.d.ts +3 -0
  135. package/build/src/matchers/component/toBeHiddenEx.js +67 -0
  136. package/build/src/matchers/component/toBeInactiveTab.d.ts +3 -0
  137. package/build/src/matchers/component/toBeInactiveTab.js +56 -0
  138. package/build/src/matchers/component/toBeUnchecked.d.ts +3 -0
  139. package/build/src/matchers/component/toBeUnchecked.js +56 -0
  140. package/build/src/matchers/component/toBeUncheckedByIndex.d.ts +3 -0
  141. package/build/src/matchers/component/toBeUncheckedByIndex.js +62 -0
  142. package/build/src/matchers/component/toBeUncheckedByText.d.ts +3 -0
  143. package/build/src/matchers/component/toBeUncheckedByText.js +57 -0
  144. package/build/src/matchers/component/toBeUncheckedByValue.d.ts +3 -0
  145. package/build/src/matchers/component/toBeUncheckedByValue.js +57 -0
  146. package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
  147. package/build/src/matchers/component/toBeVisibleEx.js +67 -0
  148. package/build/src/matchers/component/toContainFormattedText.d.ts +3 -0
  149. package/build/src/matchers/component/toContainFormattedText.js +55 -0
  150. package/build/src/matchers/component/toContainItem.d.ts +4 -0
  151. package/build/src/matchers/component/toContainItem.js +78 -0
  152. package/build/src/matchers/component/toContainItems.d.ts +3 -0
  153. package/build/src/matchers/component/toContainItems.js +63 -0
  154. package/build/src/matchers/component/toContainSelectValue.d.ts +3 -0
  155. package/build/src/matchers/component/toContainSelectValue.js +55 -0
  156. package/build/src/matchers/component/toContainTabs.d.ts +3 -0
  157. package/build/src/matchers/component/toContainTabs.js +80 -0
  158. package/build/src/matchers/component/toContainTextEx.d.ts +3 -0
  159. package/build/src/matchers/component/toContainTextEx.js +56 -0
  160. package/build/src/matchers/component/toContainTokens.d.ts +4 -0
  161. package/build/src/matchers/component/toContainTokens.js +80 -0
  162. package/build/src/matchers/component/toContainUploadedFiles.d.ts +4 -0
  163. package/build/src/matchers/component/toContainUploadedFiles.js +75 -0
  164. package/build/src/matchers/component/toHaveActivePage.d.ts +4 -0
  165. package/build/src/matchers/component/toHaveActivePage.js +78 -0
  166. package/build/src/matchers/component/toHaveActiveTab.d.ts +2 -0
  167. package/build/src/matchers/component/toHaveActiveTab.js +62 -0
  168. package/build/src/matchers/component/toHaveAttributeEx.d.ts +3 -0
  169. package/build/src/matchers/component/toHaveAttributeEx.js +62 -0
  170. package/build/src/matchers/component/toHaveCountEx.d.ts +3 -0
  171. package/build/src/matchers/component/toHaveCountEx.js +56 -0
  172. package/build/src/matchers/component/toHaveError.d.ts +3 -0
  173. package/build/src/matchers/component/toHaveError.js +57 -0
  174. package/build/src/matchers/component/toHaveFormattedText.d.ts +3 -0
  175. package/build/src/matchers/component/toHaveFormattedText.js +56 -0
  176. package/build/src/matchers/component/toHaveFormattedValue.d.ts +3 -0
  177. package/build/src/matchers/component/toHaveFormattedValue.js +56 -0
  178. package/build/src/matchers/component/toHaveHref.d.ts +3 -0
  179. package/build/src/matchers/component/toHaveHref.js +55 -0
  180. package/build/src/matchers/component/toHaveItems.d.ts +3 -0
  181. package/build/src/matchers/component/toHaveItems.js +63 -0
  182. package/build/src/matchers/component/toHavePageCount.d.ts +4 -0
  183. package/build/src/matchers/component/toHavePageCount.js +71 -0
  184. package/build/src/matchers/component/toHaveTextEx.d.ts +3 -0
  185. package/build/src/matchers/component/toHaveTextEx.js +56 -0
  186. package/build/src/matchers/component/toHaveValueEx.d.ts +6 -0
  187. package/build/src/matchers/component/toHaveValueEx.js +197 -0
  188. package/build/src/matchers/component/toHaveWarning.d.ts +3 -0
  189. package/build/src/matchers/component/toHaveWarning.js +57 -0
  190. package/build/src/matchers/componentMatchers.d.ts +104 -0
  191. package/build/src/matchers/componentMatchers.js +89 -0
  192. package/build/src/matchers/createAsyncMatcher.d.ts +72 -0
  193. package/build/src/matchers/createAsyncMatcher.js +180 -0
  194. package/build/src/matchers/formattedMatchers.d.ts +15 -31
  195. package/build/src/matchers/formattedMatchers.js +19 -15
  196. package/build/src/matchers/index.d.ts +1 -1
  197. package/build/src/matchers/index.js +1 -3
  198. package/build/src/utils/getMarcherResult.d.ts +13 -0
  199. package/build/src/utils/getMarcherResult.js +13 -0
  200. package/build/src/utils/index.d.ts +3 -0
  201. package/build/src/utils/index.js +3 -0
  202. package/build/src/utils/makeMatcher.d.ts +5 -0
  203. package/build/src/utils/makeMatcher.js +65 -0
  204. package/build/src/utils/toMatchMessage.d.ts +23 -0
  205. package/build/src/utils/toMatchMessage.js +89 -0
  206. package/package.json +1 -1
  207. package/build/src/matchers/mergedExpects.d.ts +0 -15
  208. package/build/src/matchers/mergedExpects.js +0 -6
@@ -50,12 +50,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
+ var _a, _b, _c;
53
54
  Object.defineProperty(exports, "__esModule", { value: true });
54
55
  exports.Button = void 0;
55
56
  var test_1 = require("@playwright/test");
56
57
  var BaseComponent_1 = require("./BaseComponent");
57
58
  var assertions_1 = require("../assertions");
58
59
  var utils_1 = require("../utils");
60
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
59
61
  /**
60
62
  * Button можно использовать как для @skbkontur/react-ui, так и для react
61
63
  * Но часть функциональности (проверка на Error / Warning) не будет работать с button из react
@@ -65,37 +67,40 @@ var Button = /** @class */ (function (_super) {
65
67
  function Button(rootLocator) {
66
68
  var _this = _super.call(this, rootLocator) || this;
67
69
  _this.rootLocator = rootLocator;
70
+ _this[_a] = function () { return _this.buttonLocator; };
71
+ _this[_b] = function () { return _this.buttonLocator; };
72
+ _this[_c] = function () { return _this.buttonLocator; };
68
73
  // or(rootLocator).Last сделан для кнопки из react (не react-ui)
69
74
  _this.buttonLocator = rootLocator.locator('button').or(rootLocator).last();
70
75
  return _this;
71
76
  }
72
77
  Button.prototype.isDisabled = function (options) {
73
78
  return __awaiter(this, void 0, void 0, function () {
74
- return __generator(this, function (_a) {
75
- switch (_a.label) {
79
+ return __generator(this, function (_d) {
80
+ switch (_d.label) {
76
81
  case 0: return [4 /*yield*/, this.buttonLocator.isDisabled(options)];
77
- case 1: return [2 /*return*/, _a.sent()];
82
+ case 1: return [2 /*return*/, _d.sent()];
78
83
  }
79
84
  });
80
85
  });
81
86
  };
82
87
  Button.prototype.getText = function (options) {
83
88
  return __awaiter(this, void 0, void 0, function () {
84
- return __generator(this, function (_a) {
85
- switch (_a.label) {
89
+ return __generator(this, function (_d) {
90
+ switch (_d.label) {
86
91
  case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
87
- case 1: return [2 /*return*/, _a.sent()];
92
+ case 1: return [2 /*return*/, _d.sent()];
88
93
  }
89
94
  });
90
95
  });
91
96
  };
92
97
  Button.prototype.click = function (options) {
93
98
  return __awaiter(this, void 0, void 0, function () {
94
- return __generator(this, function (_a) {
95
- switch (_a.label) {
99
+ return __generator(this, function (_d) {
100
+ switch (_d.label) {
96
101
  case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
97
102
  case 1:
98
- _a.sent();
103
+ _d.sent();
99
104
  return [2 /*return*/];
100
105
  }
101
106
  });
@@ -103,14 +108,14 @@ var Button = /** @class */ (function (_super) {
103
108
  };
104
109
  Button.prototype.focus = function (options) {
105
110
  return __awaiter(this, void 0, void 0, function () {
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
111
+ return __generator(this, function (_d) {
112
+ switch (_d.label) {
108
113
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
109
114
  case 1:
110
- _a.sent();
115
+ _d.sent();
111
116
  return [4 /*yield*/, this.buttonLocator.focus(options)];
112
117
  case 2:
113
- _a.sent();
118
+ _d.sent();
114
119
  return [2 /*return*/];
115
120
  }
116
121
  });
@@ -118,11 +123,11 @@ var Button = /** @class */ (function (_super) {
118
123
  };
119
124
  Button.prototype.blur = function (options) {
120
125
  return __awaiter(this, void 0, void 0, function () {
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
126
+ return __generator(this, function (_d) {
127
+ switch (_d.label) {
123
128
  case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
124
129
  case 1:
125
- _a.sent();
130
+ _d.sent();
126
131
  return [2 /*return*/];
127
132
  }
128
133
  });
@@ -130,10 +135,10 @@ var Button = /** @class */ (function (_super) {
130
135
  };
131
136
  Button.prototype.getTooltip = function (type) {
132
137
  return __awaiter(this, void 0, void 0, function () {
133
- return __generator(this, function (_a) {
134
- switch (_a.label) {
138
+ return __generator(this, function (_d) {
139
+ switch (_d.label) {
135
140
  case 0: return [4 /*yield*/, (0, utils_1.getTooltip)(type, this)];
136
- case 1: return [2 /*return*/, _a.sent()];
141
+ case 1: return [2 /*return*/, _d.sent()];
137
142
  }
138
143
  });
139
144
  });
@@ -144,3 +149,4 @@ var Button = /** @class */ (function (_super) {
144
149
  return Button;
145
150
  }(BaseComponent_1.BaseComponent));
146
151
  exports.Button = Button;
152
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
@@ -4,9 +4,15 @@ import { CheckboxAssertions } from '../assertions';
4
4
  import type { TooltipType } from '../utils';
5
5
  import type { BlurOptions, FocusOptions, InnerTextOptions, InputValueOptions, IsCheckedOptions, IsDisabledOptions, UncheckOptions } from '../options';
6
6
  import type { CheckOptions } from '../options';
7
+ import { toControlElementLocator, toCheckableElementLocator, toFocusableElementLocator, toTextElementLocator, toValueElementLocator } from '../matchers/component/LocatorSymbols';
7
8
  export declare class Checkbox extends BaseComponent {
8
9
  readonly rootLocator: Locator;
9
10
  readonly inputLocator: Locator;
11
+ readonly [toControlElementLocator]: () => Locator;
12
+ readonly [toCheckableElementLocator]: () => Locator;
13
+ readonly [toValueElementLocator]: () => Locator;
14
+ readonly [toTextElementLocator]: () => Locator;
15
+ readonly [toFocusableElementLocator]: () => Locator;
10
16
  constructor(rootLocator: Locator);
11
17
  isDisabled(options?: IsDisabledOptions): Promise<boolean>;
12
18
  isChecked(options?: IsCheckedOptions): Promise<boolean>;
@@ -50,58 +50,53 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
+ var _a, _b, _c, _d, _e;
53
54
  Object.defineProperty(exports, "__esModule", { value: true });
54
55
  exports.Checkbox = void 0;
55
56
  var test_1 = require("@playwright/test");
56
57
  var BaseComponent_1 = require("./BaseComponent");
57
58
  var assertions_1 = require("../assertions");
58
59
  var utils_1 = require("../utils");
60
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
59
61
  var Checkbox = /** @class */ (function (_super) {
60
62
  __extends(Checkbox, _super);
61
63
  function Checkbox(rootLocator) {
62
64
  var _this = _super.call(this, rootLocator) || this;
63
65
  _this.rootLocator = rootLocator;
66
+ _this[_a] = function () { return _this.inputLocator; };
67
+ _this[_b] = function () { return _this.inputLocator; };
68
+ _this[_c] = function () { return _this.inputLocator; };
69
+ _this[_d] = function () { return _this.rootLocator; };
70
+ _this[_e] = function () { return _this.inputLocator; };
64
71
  _this.inputLocator = rootLocator.locator('input');
65
72
  return _this;
66
73
  }
67
74
  Checkbox.prototype.isDisabled = function (options) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- return [2 /*return*/, this.inputLocator.isDisabled(options)];
71
- });
72
- });
75
+ return this.inputLocator.isDisabled(options);
73
76
  };
74
77
  Checkbox.prototype.isChecked = function (options) {
75
- return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- return [2 /*return*/, this.inputLocator.isChecked(options)];
78
- });
79
- });
78
+ return this.inputLocator.isChecked(options);
80
79
  };
81
80
  Checkbox.prototype.getText = function (options) {
82
- return __awaiter(this, void 0, void 0, function () {
83
- return __generator(this, function (_a) {
84
- return [2 /*return*/, this.rootLocator.innerText(options)];
85
- });
86
- });
81
+ return this.rootLocator.innerText(options);
87
82
  };
88
83
  Checkbox.prototype.getValue = function (options) {
89
84
  return __awaiter(this, void 0, void 0, function () {
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
85
+ return __generator(this, function (_f) {
86
+ switch (_f.label) {
92
87
  case 0: return [4 /*yield*/, this.inputLocator.inputValue(options)];
93
- case 1: return [2 /*return*/, _a.sent()];
88
+ case 1: return [2 /*return*/, _f.sent()];
94
89
  }
95
90
  });
96
91
  });
97
92
  };
98
93
  Checkbox.prototype.check = function (options) {
99
94
  return __awaiter(this, void 0, void 0, function () {
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
95
+ return __generator(this, function (_f) {
96
+ switch (_f.label) {
102
97
  case 0: return [4 /*yield*/, this.rootLocator.check(options)];
103
98
  case 1:
104
- _a.sent();
99
+ _f.sent();
105
100
  return [2 /*return*/];
106
101
  }
107
102
  });
@@ -109,11 +104,11 @@ var Checkbox = /** @class */ (function (_super) {
109
104
  };
110
105
  Checkbox.prototype.uncheck = function (options) {
111
106
  return __awaiter(this, void 0, void 0, function () {
112
- return __generator(this, function (_a) {
113
- switch (_a.label) {
107
+ return __generator(this, function (_f) {
108
+ switch (_f.label) {
114
109
  case 0: return [4 /*yield*/, this.rootLocator.uncheck(options)];
115
110
  case 1:
116
- _a.sent();
111
+ _f.sent();
117
112
  return [2 /*return*/];
118
113
  }
119
114
  });
@@ -121,14 +116,14 @@ var Checkbox = /** @class */ (function (_super) {
121
116
  };
122
117
  Checkbox.prototype.focus = function (options) {
123
118
  return __awaiter(this, void 0, void 0, function () {
124
- return __generator(this, function (_a) {
125
- switch (_a.label) {
119
+ return __generator(this, function (_f) {
120
+ switch (_f.label) {
126
121
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled()];
127
122
  case 1:
128
- _a.sent();
123
+ _f.sent();
129
124
  return [4 /*yield*/, this.inputLocator.focus(options)];
130
125
  case 2:
131
- _a.sent();
126
+ _f.sent();
132
127
  return [2 /*return*/];
133
128
  }
134
129
  });
@@ -136,22 +131,18 @@ var Checkbox = /** @class */ (function (_super) {
136
131
  };
137
132
  Checkbox.prototype.blur = function (options) {
138
133
  return __awaiter(this, void 0, void 0, function () {
139
- return __generator(this, function (_a) {
140
- switch (_a.label) {
134
+ return __generator(this, function (_f) {
135
+ switch (_f.label) {
141
136
  case 0: return [4 /*yield*/, this.inputLocator.blur(options)];
142
137
  case 1:
143
- _a.sent();
138
+ _f.sent();
144
139
  return [2 /*return*/];
145
140
  }
146
141
  });
147
142
  });
148
143
  };
149
144
  Checkbox.prototype.getTooltip = function (type) {
150
- return __awaiter(this, void 0, void 0, function () {
151
- return __generator(this, function (_a) {
152
- return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
153
- });
154
- });
145
+ return (0, utils_1.getTooltip)(type, this);
155
146
  };
156
147
  Checkbox.prototype.expect = function () {
157
148
  return new assertions_1.CheckboxAssertions(this);
@@ -159,3 +150,4 @@ var Checkbox = /** @class */ (function (_super) {
159
150
  return Checkbox;
160
151
  }(BaseComponent_1.BaseComponent));
161
152
  exports.Checkbox = Checkbox;
153
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toCheckableElementLocator, _c = LocatorSymbols_1.toValueElementLocator, _d = LocatorSymbols_1.toTextElementLocator, _e = LocatorSymbols_1.toFocusableElementLocator;
@@ -1,16 +1,22 @@
1
1
  import type { Locator } from '@playwright/test';
2
- import { BaseComponent } from './BaseComponent';
3
2
  import { ComboBoxAssertions } from '../assertions';
4
3
  import type { TooltipType } from '../utils';
5
4
  import { ComponentList } from './ComponentList';
6
5
  import { MenuItem } from './MenuItem';
7
6
  import type { BlurOptions, ClearOptions, ClickOptions, FillOptions, FocusOptions, GetAttributeOptions, IsDisabledOptions } from '../options';
8
- export declare class ComboBox extends BaseComponent {
7
+ import { MenuComponent } from './MenuComponent';
8
+ import { toControlElementLocator, toValueElementLocator, toFocusableElementLocator, toItemsElementLocator } from '../matchers/component/LocatorSymbols';
9
+ export declare class ComboBox extends MenuComponent {
9
10
  readonly rootLocator: Locator;
10
11
  readonly nativeInputLocator: Locator;
11
12
  readonly inputLikeTextLocator: Locator;
12
13
  private readonly portal;
14
+ readonly [toControlElementLocator]: () => Locator;
15
+ readonly [toValueElementLocator]: () => Promise<Locator>;
16
+ readonly [toItemsElementLocator]: () => Promise<Locator>;
17
+ readonly [toFocusableElementLocator]: () => Locator;
13
18
  constructor(rootLocator: Locator);
19
+ private getInputLocator;
14
20
  isDisabled(options?: IsDisabledOptions): Promise<boolean>;
15
21
  isFocused(options?: GetAttributeOptions): Promise<boolean>;
16
22
  getSelectedValue(): Promise<string>;
@@ -50,6 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
+ var _a, _b, _c, _d;
53
54
  Object.defineProperty(exports, "__esModule", { value: true });
54
55
  exports.ComboBox = void 0;
55
56
  var test_1 = require("@playwright/test");
@@ -59,53 +60,68 @@ var MenuFooter_1 = require("@skbkontur/react-ui/components/MenuFooter");
59
60
  var InputLikeText_1 = require("@skbkontur/react-ui/internal/InputLikeText");
60
61
  var MenuMessage_1 = require("@skbkontur/react-ui/internal/MenuMessage");
61
62
  var Portal_1 = require("./Portal");
62
- var BaseComponent_1 = require("./BaseComponent");
63
63
  var assertions_1 = require("../assertions");
64
64
  var utils_1 = require("../utils");
65
65
  var ComponentList_1 = require("./ComponentList");
66
66
  var MenuItem_1 = require("./MenuItem");
67
67
  var dataTidSelector_1 = require("../utils/dataTidSelector");
68
+ var MenuComponent_1 = require("./MenuComponent");
69
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
68
70
  var ComboBox = /** @class */ (function (_super) {
69
71
  __extends(ComboBox, _super);
70
72
  function ComboBox(rootLocator) {
71
73
  var _this = _super.call(this, rootLocator) || this;
72
74
  _this.rootLocator = rootLocator;
75
+ _this[_a] = function () { return _this.nativeInputLocator; };
76
+ _this[_b] = function () { return _this.getInputLocator(); };
77
+ _this[_c] = function () { return _this.getItemsLocator(); };
78
+ _this[_d] = function () { return _this.nativeInputLocator; };
73
79
  _this.nativeInputLocator = rootLocator.locator('input');
74
80
  _this.inputLikeTextLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(InputLikeText_1.InputLikeTextDataTids.input));
75
81
  _this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
76
82
  return _this;
77
83
  }
84
+ ComboBox.prototype.getInputLocator = function () {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ return __generator(this, function (_e) {
87
+ switch (_e.label) {
88
+ case 0: return [4 /*yield*/, this.isDisabled()];
89
+ case 1: return [2 /*return*/, !(_e.sent()) ? this.nativeInputLocator : this.inputLikeTextLocator];
90
+ }
91
+ });
92
+ });
93
+ };
78
94
  ComboBox.prototype.isDisabled = function (options) {
79
95
  return __awaiter(this, void 0, void 0, function () {
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
96
+ return __generator(this, function (_e) {
97
+ switch (_e.label) {
82
98
  case 0: return [4 /*yield*/, this.nativeInputLocator.isDisabled(options)];
83
- case 1: return [2 /*return*/, _a.sent()];
99
+ case 1: return [2 /*return*/, _e.sent()];
84
100
  }
85
101
  });
86
102
  });
87
103
  };
88
104
  ComboBox.prototype.isFocused = function (options) {
89
105
  return __awaiter(this, void 0, void 0, function () {
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
106
+ return __generator(this, function (_e) {
107
+ switch (_e.label) {
92
108
  case 0: return [4 /*yield*/, this.nativeInputLocator.getAttribute('type', options)];
93
- case 1: return [2 /*return*/, (_a.sent()) !== 'hidden'];
109
+ case 1: return [2 /*return*/, (_e.sent()) !== 'hidden'];
94
110
  }
95
111
  });
96
112
  });
97
113
  };
98
114
  ComboBox.prototype.getSelectedValue = function () {
99
115
  return __awaiter(this, void 0, void 0, function () {
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
116
+ return __generator(this, function (_e) {
117
+ switch (_e.label) {
102
118
  case 0: return [4 /*yield*/, this.isFocused()];
103
119
  case 1:
104
- if (!_a.sent()) return [3 /*break*/, 3];
120
+ if (!_e.sent()) return [3 /*break*/, 3];
105
121
  return [4 /*yield*/, this.nativeInputLocator.inputValue()];
106
- case 2: return [2 /*return*/, _a.sent()];
122
+ case 2: return [2 /*return*/, _e.sent()];
107
123
  case 3: return [4 /*yield*/, this.inputLikeTextLocator.innerText()];
108
- case 4: return [2 /*return*/, _a.sent()];
124
+ case 4: return [2 /*return*/, _e.sent()];
109
125
  }
110
126
  });
111
127
  });
@@ -117,14 +133,14 @@ var ComboBox = /** @class */ (function (_super) {
117
133
  ComboBox.prototype.selectFirst = function (value, options) {
118
134
  return __awaiter(this, void 0, void 0, function () {
119
135
  var items;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
136
+ return __generator(this, function (_e) {
137
+ switch (_e.label) {
122
138
  case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
123
139
  case 1:
124
- items = _a.sent();
140
+ items = _e.sent();
125
141
  return [4 /*yield*/, items.first().click(options)];
126
142
  case 2:
127
- _a.sent();
143
+ _e.sent();
128
144
  return [2 /*return*/];
129
145
  }
130
146
  });
@@ -133,17 +149,17 @@ var ComboBox = /** @class */ (function (_super) {
133
149
  ComboBox.prototype.select = function (value, options) {
134
150
  return __awaiter(this, void 0, void 0, function () {
135
151
  var items;
136
- return __generator(this, function (_a) {
137
- switch (_a.label) {
152
+ return __generator(this, function (_e) {
153
+ switch (_e.label) {
138
154
  case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
139
155
  case 1:
140
- items = _a.sent();
156
+ items = _e.sent();
141
157
  return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1)];
142
158
  case 2:
143
- _a.sent();
159
+ _e.sent();
144
160
  return [4 /*yield*/, items.click(options)];
145
161
  case 3:
146
- _a.sent();
162
+ _e.sent();
147
163
  return [2 /*return*/];
148
164
  }
149
165
  });
@@ -151,14 +167,14 @@ var ComboBox = /** @class */ (function (_super) {
151
167
  };
152
168
  ComboBox.prototype.fill = function (value, options) {
153
169
  return __awaiter(this, void 0, void 0, function () {
154
- return __generator(this, function (_a) {
155
- switch (_a.label) {
170
+ return __generator(this, function (_e) {
171
+ switch (_e.label) {
156
172
  case 0: return [4 /*yield*/, this.focus()];
157
173
  case 1:
158
- _a.sent();
174
+ _e.sent();
159
175
  return [4 /*yield*/, this.nativeInputLocator.fill(value, options)];
160
176
  case 2:
161
- _a.sent();
177
+ _e.sent();
162
178
  return [2 /*return*/];
163
179
  }
164
180
  });
@@ -166,14 +182,14 @@ var ComboBox = /** @class */ (function (_super) {
166
182
  };
167
183
  ComboBox.prototype.clear = function (options) {
168
184
  return __awaiter(this, void 0, void 0, function () {
169
- return __generator(this, function (_a) {
170
- switch (_a.label) {
185
+ return __generator(this, function (_e) {
186
+ switch (_e.label) {
171
187
  case 0: return [4 /*yield*/, this.focus()];
172
188
  case 1:
173
- _a.sent();
189
+ _e.sent();
174
190
  return [4 /*yield*/, this.nativeInputLocator.clear(options)];
175
191
  case 2:
176
- _a.sent();
192
+ _e.sent();
177
193
  return [2 /*return*/];
178
194
  }
179
195
  });
@@ -181,17 +197,17 @@ var ComboBox = /** @class */ (function (_super) {
181
197
  };
182
198
  ComboBox.prototype.focus = function (options) {
183
199
  return __awaiter(this, void 0, void 0, function () {
184
- return __generator(this, function (_a) {
185
- switch (_a.label) {
200
+ return __generator(this, function (_e) {
201
+ switch (_e.label) {
186
202
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
187
203
  case 1:
188
- _a.sent();
204
+ _e.sent();
189
205
  return [4 /*yield*/, this.rootLocator
190
206
  .locator('input[type="text"]')
191
207
  .or(this.rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(InputLikeText_1.InputLikeTextDataTids.root)))
192
208
  .focus(options)];
193
209
  case 2:
194
- _a.sent();
210
+ _e.sent();
195
211
  return [2 /*return*/];
196
212
  }
197
213
  });
@@ -199,11 +215,11 @@ var ComboBox = /** @class */ (function (_super) {
199
215
  };
200
216
  ComboBox.prototype.blur = function (options) {
201
217
  return __awaiter(this, void 0, void 0, function () {
202
- return __generator(this, function (_a) {
203
- switch (_a.label) {
218
+ return __generator(this, function (_e) {
219
+ switch (_e.label) {
204
220
  case 0: return [4 /*yield*/, this.nativeInputLocator.press('Tab', { timeout: options === null || options === void 0 ? void 0 : options.timeout })];
205
221
  case 1:
206
- _a.sent();
222
+ _e.sent();
207
223
  return [2 /*return*/];
208
224
  }
209
225
  });
@@ -211,28 +227,24 @@ var ComboBox = /** @class */ (function (_super) {
211
227
  };
212
228
  ComboBox.prototype.click = function () {
213
229
  return __awaiter(this, void 0, void 0, function () {
214
- return __generator(this, function (_a) {
215
- switch (_a.label) {
230
+ return __generator(this, function (_e) {
231
+ switch (_e.label) {
216
232
  case 0:
217
233
  // NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
218
234
  return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
219
235
  case 1:
220
236
  // NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
221
- _a.sent();
237
+ _e.sent();
222
238
  return [4 /*yield*/, _super.prototype.click.call(this)];
223
239
  case 2:
224
- _a.sent();
240
+ _e.sent();
225
241
  return [2 /*return*/];
226
242
  }
227
243
  });
228
244
  });
229
245
  };
230
246
  ComboBox.prototype.getTooltip = function (type) {
231
- return __awaiter(this, void 0, void 0, function () {
232
- return __generator(this, function (_a) {
233
- return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
234
- });
235
- });
247
+ return (0, utils_1.getTooltip)(type, this);
236
248
  };
237
249
  /**
238
250
  * Возвращает список меню по data-tid'ам из react-ui:
@@ -246,17 +258,17 @@ var ComboBox = /** @class */ (function (_super) {
246
258
  ComboBox.prototype.getMenuItems = function () {
247
259
  return __awaiter(this, void 0, void 0, function () {
248
260
  var container;
249
- return __generator(this, function (_a) {
250
- switch (_a.label) {
261
+ return __generator(this, function (_e) {
262
+ switch (_e.label) {
251
263
  case 0: return [4 /*yield*/, this.focus()];
252
264
  case 1:
253
- _a.sent();
265
+ _e.sent();
254
266
  return [4 /*yield*/, this.portal.getContainer()];
255
267
  case 2:
256
- container = _a.sent();
268
+ container = _e.sent();
257
269
  return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
258
270
  case 3:
259
- _a.sent();
271
+ _e.sent();
260
272
  return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
261
273
  return locator
262
274
  .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
@@ -276,11 +288,11 @@ var ComboBox = /** @class */ (function (_super) {
276
288
  ComboBox.prototype.getComboBoxMenuItemsLocator = function (byText) {
277
289
  return __awaiter(this, void 0, void 0, function () {
278
290
  var container, items;
279
- return __generator(this, function (_a) {
280
- switch (_a.label) {
291
+ return __generator(this, function (_e) {
292
+ switch (_e.label) {
281
293
  case 0: return [4 /*yield*/, this.portal.getContainer()];
282
294
  case 1:
283
- container = _a.sent();
295
+ container = _e.sent();
284
296
  items = container.locator((0, dataTidSelector_1.getDataTidSelector)(CustomComboBox_1.ComboBoxMenuDataTids.item));
285
297
  return [2 /*return*/, items.getByText(byText)];
286
298
  }
@@ -288,5 +300,6 @@ var ComboBox = /** @class */ (function (_super) {
288
300
  });
289
301
  };
290
302
  return ComboBox;
291
- }(BaseComponent_1.BaseComponent));
303
+ }(MenuComponent_1.MenuComponent));
292
304
  exports.ComboBox = ComboBox;
305
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toValueElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toFocusableElementLocator;
@@ -3,10 +3,13 @@ import { BaseComponent } from './BaseComponent';
3
3
  import { ComponentListAssertions } from '../assertions';
4
4
  import { type TooltipType } from '../utils';
5
5
  import type { IsVisibleOptions } from '../options';
6
+ import { toVisibleElementLocator, toValueElementLocator } from '../matchers/component/LocatorSymbols';
6
7
  export declare class ComponentList<TItem extends BaseComponent> extends BaseComponent {
7
8
  readonly rootLocator: Locator;
8
9
  private readonly itemFactory;
9
10
  readonly itemsLocator: Locator;
11
+ readonly [toVisibleElementLocator]: () => Locator;
12
+ readonly [toValueElementLocator]: () => Locator;
10
13
  constructor(rootLocator: Locator, itemsLocator: (rootLocator: Locator) => Locator, itemFactory: (locator: Locator) => TItem);
11
14
  isVisible(options?: IsVisibleOptions): Promise<boolean>;
12
15
  /**
@@ -20,15 +23,15 @@ export declare class ComponentList<TItem extends BaseComponent> extends BaseComp
20
23
  /**
21
24
  * Поведение метода идентично вызову locator.nth(0)
22
25
  */
23
- getFirstItem(): Promise<TItem>;
26
+ getFirstItem(): TItem;
24
27
  /**
25
28
  * Поведение метода идентично вызову locator.nth(-1)
26
29
  */
27
- getLastItem(): Promise<TItem>;
30
+ getLastItem(): TItem;
28
31
  /**
29
32
  * Поведение метода идентично вызову locator.nth(index)
30
33
  */
31
- getItemByIndex(index: number): Promise<TItem>;
34
+ getItemByIndex(index: number): TItem;
32
35
  getFirstItemByPredicate(predicate: (item: TItem) => Promise<boolean>): Promise<TItem>;
33
36
  getItemsByPredicate(predicate: (item: TItem) => Promise<boolean>): Promise<TItem[]>;
34
37
  /**