@skbkontur/playwright-react-ui-components 1.13.1 → 1.14.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.
Files changed (210) 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 +9 -2
  45. package/build/src/components/ComboBox.js +68 -54
  46. package/build/src/components/ComponentList.d.ts +25 -3
  47. package/build/src/components/ComponentList.js +58 -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 +8 -2
  57. package/build/src/components/Dropdown.js +69 -65
  58. package/build/src/components/DropdownMenu.d.ts +7 -2
  59. package/build/src/components/DropdownMenu.js +68 -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 +6 -2
  67. package/build/src/components/Kebab.js +50 -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 +9 -0
  75. package/build/src/components/MenuComponent.js +78 -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/toBeActiveEx.d.ts +3 -0
  115. package/build/src/matchers/component/toBeActiveEx.js +56 -0
  116. package/build/src/matchers/component/toBeAutoEx.d.ts +3 -0
  117. package/build/src/matchers/component/toBeAutoEx.js +62 -0
  118. package/build/src/matchers/component/toBeCheckedByIndexEx.d.ts +3 -0
  119. package/build/src/matchers/component/toBeCheckedByIndexEx.js +62 -0
  120. package/build/src/matchers/component/toBeCheckedByTextEx.d.ts +3 -0
  121. package/build/src/matchers/component/toBeCheckedByTextEx.js +62 -0
  122. package/build/src/matchers/component/toBeCheckedByValueEx.d.ts +3 -0
  123. package/build/src/matchers/component/toBeCheckedByValueEx.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 +172 -0
  128. package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
  129. package/build/src/matchers/component/toBeEmptyEx.js +137 -0
  130. package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
  131. package/build/src/matchers/component/toBeEnabledEx.js +206 -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 +68 -0
  136. package/build/src/matchers/component/toBeInactiveEx.d.ts +3 -0
  137. package/build/src/matchers/component/toBeInactiveEx.js +56 -0
  138. package/build/src/matchers/component/toBeUncheckedByIndexEx.d.ts +3 -0
  139. package/build/src/matchers/component/toBeUncheckedByIndexEx.js +62 -0
  140. package/build/src/matchers/component/toBeUncheckedByTextEx.d.ts +3 -0
  141. package/build/src/matchers/component/toBeUncheckedByTextEx.js +57 -0
  142. package/build/src/matchers/component/toBeUncheckedByValueEx.d.ts +3 -0
  143. package/build/src/matchers/component/toBeUncheckedByValueEx.js +57 -0
  144. package/build/src/matchers/component/toBeUncheckedEx.d.ts +3 -0
  145. package/build/src/matchers/component/toBeUncheckedEx.js +56 -0
  146. package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
  147. package/build/src/matchers/component/toBeVisibleEx.js +68 -0
  148. package/build/src/matchers/component/toContainFormattedTextEx.d.ts +3 -0
  149. package/build/src/matchers/component/toContainFormattedTextEx.js +55 -0
  150. package/build/src/matchers/component/toContainItemEx.d.ts +4 -0
  151. package/build/src/matchers/component/toContainItemEx.js +79 -0
  152. package/build/src/matchers/component/toContainItemsEx.d.ts +3 -0
  153. package/build/src/matchers/component/toContainItemsEx.js +63 -0
  154. package/build/src/matchers/component/toContainTabsEx.d.ts +3 -0
  155. package/build/src/matchers/component/toContainTabsEx.js +80 -0
  156. package/build/src/matchers/component/toContainTextEx.d.ts +3 -0
  157. package/build/src/matchers/component/toContainTextEx.js +56 -0
  158. package/build/src/matchers/component/toContainTokensEx.d.ts +4 -0
  159. package/build/src/matchers/component/toContainTokensEx.js +80 -0
  160. package/build/src/matchers/component/toContainUploadedFilesEx.d.ts +4 -0
  161. package/build/src/matchers/component/toContainUploadedFilesEx.js +75 -0
  162. package/build/src/matchers/component/toContainValueEx.d.ts +3 -0
  163. package/build/src/matchers/component/toContainValueEx.js +55 -0
  164. package/build/src/matchers/component/toHaveActivePageEx.d.ts +4 -0
  165. package/build/src/matchers/component/toHaveActivePageEx.js +78 -0
  166. package/build/src/matchers/component/toHaveActiveTabEx.d.ts +2 -0
  167. package/build/src/matchers/component/toHaveActiveTabEx.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/toHaveErrorEx.d.ts +3 -0
  173. package/build/src/matchers/component/toHaveErrorEx.js +57 -0
  174. package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +3 -0
  175. package/build/src/matchers/component/toHaveFormattedTextEx.js +56 -0
  176. package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +3 -0
  177. package/build/src/matchers/component/toHaveFormattedValueEx.js +56 -0
  178. package/build/src/matchers/component/toHaveHrefEx.d.ts +3 -0
  179. package/build/src/matchers/component/toHaveHrefEx.js +55 -0
  180. package/build/src/matchers/component/toHaveItemsEx.d.ts +3 -0
  181. package/build/src/matchers/component/toHaveItemsEx.js +63 -0
  182. package/build/src/matchers/component/toHavePageCountEx.d.ts +4 -0
  183. package/build/src/matchers/component/toHavePageCountEx.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 +198 -0
  188. package/build/src/matchers/component/toHaveWarningEx.d.ts +3 -0
  189. package/build/src/matchers/component/toHaveWarningEx.js +57 -0
  190. package/build/src/matchers/componentMatchers.d.ts +104 -0
  191. package/build/src/matchers/componentMatchers.js +83 -0
  192. package/build/src/matchers/createAsyncMatcher.d.ts +47 -0
  193. package/build/src/matchers/createAsyncMatcher.js +155 -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/is.d.ts +3 -0
  203. package/build/src/utils/is.js +5 -0
  204. package/build/src/utils/makeMatcher.d.ts +5 -0
  205. package/build/src/utils/makeMatcher.js +65 -0
  206. package/build/src/utils/toMatchMessage.d.ts +12 -0
  207. package/build/src/utils/toMatchMessage.js +78 -0
  208. package/package.json +1 -1
  209. package/build/src/matchers/mergedExpects.d.ts +0 -15
  210. package/build/src/matchers/mergedExpects.js +0 -6
@@ -61,6 +61,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
61
61
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
62
  }
63
63
  };
64
+ var _a, _b, _c;
64
65
  Object.defineProperty(exports, "__esModule", { value: true });
65
66
  exports.DatePicker = void 0;
66
67
  var test_1 = require("@playwright/test");
@@ -69,11 +70,15 @@ var BaseComponent_1 = require("./BaseComponent");
69
70
  var utils_1 = require("../utils");
70
71
  var assertions_1 = require("../assertions");
71
72
  var dataTidSelector_1 = require("../utils/dataTidSelector");
73
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
72
74
  var DatePicker = /** @class */ (function (_super) {
73
75
  __extends(DatePicker, _super);
74
76
  function DatePicker(rootLocator) {
75
77
  var _this = _super.call(this, rootLocator) || this;
76
78
  _this.rootLocator = rootLocator;
79
+ _this[_a] = function () { return _this.nativeInputLocator; };
80
+ _this[_b] = function () { return _this.nativeInputLocator; };
81
+ _this[_c] = function () { return _this.datePickerInputLocator; };
77
82
  _this.nativeInputLocator = rootLocator.locator('input');
78
83
  _this.datePickerInputLocator = rootLocator
79
84
  .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.DatePickerDataTids.input))
@@ -83,37 +88,37 @@ var DatePicker = /** @class */ (function (_super) {
83
88
  }
84
89
  DatePicker.prototype.isDisabled = function (options) {
85
90
  return __awaiter(this, void 0, void 0, function () {
86
- return __generator(this, function (_a) {
87
- switch (_a.label) {
91
+ return __generator(this, function (_d) {
92
+ switch (_d.label) {
88
93
  case 0: return [4 /*yield*/, this.nativeInputLocator.isDisabled(options)];
89
- case 1: return [2 /*return*/, _a.sent()];
94
+ case 1: return [2 /*return*/, _d.sent()];
90
95
  }
91
96
  });
92
97
  });
93
98
  };
94
99
  DatePicker.prototype.getValue = function (options) {
95
100
  return __awaiter(this, void 0, void 0, function () {
96
- return __generator(this, function (_a) {
97
- switch (_a.label) {
101
+ return __generator(this, function (_d) {
102
+ switch (_d.label) {
98
103
  case 0: return [4 /*yield*/, this.nativeInputLocator.inputValue(options)];
99
- case 1: return [2 /*return*/, _a.sent()];
104
+ case 1: return [2 /*return*/, _d.sent()];
100
105
  }
101
106
  });
102
107
  });
103
108
  };
104
109
  DatePicker.prototype.fill = function (value, 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*/, this.clear()];
109
114
  case 1:
110
- _a.sent();
115
+ _d.sent();
111
116
  return [4 /*yield*/, this.nativeInputLocator.pressSequentially(value, options)];
112
117
  case 2:
113
- _a.sent();
118
+ _d.sent();
114
119
  return [4 /*yield*/, this.blur()];
115
120
  case 3:
116
- _a.sent();
121
+ _d.sent();
117
122
  return [2 /*return*/];
118
123
  }
119
124
  });
@@ -121,20 +126,20 @@ var DatePicker = /** @class */ (function (_super) {
121
126
  };
122
127
  DatePicker.prototype.clear = function (options) {
123
128
  return __awaiter(this, void 0, void 0, function () {
124
- return __generator(this, function (_a) {
125
- switch (_a.label) {
129
+ return __generator(this, function (_d) {
130
+ switch (_d.label) {
126
131
  case 0: return [4 /*yield*/, this.focus()];
127
132
  case 1:
128
- _a.sent();
133
+ _d.sent();
129
134
  return [4 /*yield*/, this.nativeInputLocator.press('Control+A', options)];
130
135
  case 2:
131
- _a.sent();
136
+ _d.sent();
132
137
  return [4 /*yield*/, this.nativeInputLocator.press('Meta+A', options)];
133
138
  case 3:
134
- _a.sent();
139
+ _d.sent();
135
140
  return [4 /*yield*/, this.nativeInputLocator.press('Backspace', options)];
136
141
  case 4:
137
- _a.sent();
142
+ _d.sent();
138
143
  return [2 /*return*/];
139
144
  }
140
145
  });
@@ -142,14 +147,14 @@ var DatePicker = /** @class */ (function (_super) {
142
147
  };
143
148
  DatePicker.prototype.focus = function (options) {
144
149
  return __awaiter(this, void 0, void 0, function () {
145
- return __generator(this, function (_a) {
146
- switch (_a.label) {
150
+ return __generator(this, function (_d) {
151
+ switch (_d.label) {
147
152
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
148
153
  case 1:
149
- _a.sent();
154
+ _d.sent();
150
155
  return [4 /*yield*/, this.datePickerInputLocator.focus(options)];
151
156
  case 2:
152
- _a.sent();
157
+ _d.sent();
153
158
  return [2 /*return*/];
154
159
  }
155
160
  });
@@ -157,11 +162,11 @@ var DatePicker = /** @class */ (function (_super) {
157
162
  };
158
163
  DatePicker.prototype.blur = function (options) {
159
164
  return __awaiter(this, void 0, void 0, function () {
160
- return __generator(this, function (_a) {
161
- switch (_a.label) {
165
+ return __generator(this, function (_d) {
166
+ switch (_d.label) {
162
167
  case 0: return [4 /*yield*/, this.datePickerInputLocator.blur(options)];
163
168
  case 1:
164
- _a.sent();
169
+ _d.sent();
165
170
  return [2 /*return*/];
166
171
  }
167
172
  });
@@ -169,14 +174,14 @@ var DatePicker = /** @class */ (function (_super) {
169
174
  };
170
175
  DatePicker.prototype.click = function (options) {
171
176
  return __awaiter(this, void 0, void 0, function () {
172
- return __generator(this, function (_a) {
173
- switch (_a.label) {
177
+ return __generator(this, function (_d) {
178
+ switch (_d.label) {
174
179
  case 0:
175
180
  // NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
176
181
  return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
177
182
  case 1:
178
183
  // NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
179
- _a.sent();
184
+ _d.sent();
180
185
  // NOTE: обычный клик по rootLocator может кликать в середину DatePicker, в результате курсор оказывается во второй ячейке
181
186
  return [4 /*yield*/, this.rootLocator
182
187
  .locator('span[data-fragment]')
@@ -184,18 +189,14 @@ var DatePicker = /** @class */ (function (_super) {
184
189
  .click(__assign(__assign({}, options), { force: true }))];
185
190
  case 2:
186
191
  // NOTE: обычный клик по rootLocator может кликать в середину DatePicker, в результате курсор оказывается во второй ячейке
187
- _a.sent();
192
+ _d.sent();
188
193
  return [2 /*return*/];
189
194
  }
190
195
  });
191
196
  });
192
197
  };
193
198
  DatePicker.prototype.getTooltip = function (type) {
194
- return __awaiter(this, void 0, void 0, function () {
195
- return __generator(this, function (_a) {
196
- return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
197
- });
198
- });
199
+ return (0, utils_1.getTooltip)(type, this);
199
200
  };
200
201
  DatePicker.prototype.expect = function () {
201
202
  return new assertions_1.DatePickerAssertions(this);
@@ -203,3 +204,4 @@ var DatePicker = /** @class */ (function (_super) {
203
204
  return DatePicker;
204
205
  }(BaseComponent_1.BaseComponent));
205
206
  exports.DatePicker = DatePicker;
207
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toValueElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
@@ -3,10 +3,12 @@ import { BaseComponent } from './BaseComponent';
3
3
  import { DatePicker } from './DatePicker';
4
4
  import { DateRangePickerAssertions } from '../assertions';
5
5
  import type { ClearOptions } from '../options';
6
+ import { toValueElementLocator } from '../matchers/component/LocatorSymbols';
6
7
  export declare class DateRangePicker extends BaseComponent {
7
8
  readonly rootLocator: Locator;
8
9
  readonly datePickerStart: DatePicker;
9
10
  readonly datePickerEnd: DatePicker;
11
+ readonly [toValueElementLocator]: () => Locator;
10
12
  constructor(rootLocator: Locator);
11
13
  fill(values: {
12
14
  start: string;
@@ -50,17 +50,20 @@ 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;
53
54
  Object.defineProperty(exports, "__esModule", { value: true });
54
55
  exports.DateRangePicker = void 0;
55
56
  var BaseComponent_1 = require("./BaseComponent");
56
57
  var DatePicker_1 = require("./DatePicker");
57
58
  var assertions_1 = require("../assertions");
58
59
  var dataTidSelector_1 = require("../utils/dataTidSelector");
60
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
59
61
  var DateRangePicker = /** @class */ (function (_super) {
60
62
  __extends(DateRangePicker, _super);
61
63
  function DateRangePicker(rootLocator) {
62
64
  var _this = _super.call(this, rootLocator) || this;
63
65
  _this.rootLocator = rootLocator;
66
+ _this[_a] = function () { return _this.rootLocator; };
64
67
  _this.datePickerStart = new DatePicker_1.DatePicker(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)('DateRangePicker__start')));
65
68
  _this.datePickerEnd = new DatePicker_1.DatePicker(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)('DateRangePicker__end')));
66
69
  return _this;
@@ -68,21 +71,21 @@ var DateRangePicker = /** @class */ (function (_super) {
68
71
  DateRangePicker.prototype.fill = function (values) {
69
72
  return __awaiter(this, void 0, void 0, function () {
70
73
  var start, end;
71
- return __generator(this, function (_a) {
72
- switch (_a.label) {
74
+ return __generator(this, function (_b) {
75
+ switch (_b.label) {
73
76
  case 0:
74
77
  start = values.start, end = values.end;
75
78
  if (!start) return [3 /*break*/, 2];
76
79
  return [4 /*yield*/, this.datePickerStart.fill(start)];
77
80
  case 1:
78
- _a.sent();
79
- _a.label = 2;
81
+ _b.sent();
82
+ _b.label = 2;
80
83
  case 2:
81
84
  if (!end) return [3 /*break*/, 4];
82
85
  return [4 /*yield*/, this.datePickerEnd.fill(end)];
83
86
  case 3:
84
- _a.sent();
85
- _a.label = 4;
87
+ _b.sent();
88
+ _b.label = 4;
86
89
  case 4: return [2 /*return*/];
87
90
  }
88
91
  });
@@ -90,14 +93,14 @@ var DateRangePicker = /** @class */ (function (_super) {
90
93
  };
91
94
  DateRangePicker.prototype.clear = function (options) {
92
95
  return __awaiter(this, void 0, void 0, function () {
93
- return __generator(this, function (_a) {
94
- switch (_a.label) {
96
+ return __generator(this, function (_b) {
97
+ switch (_b.label) {
95
98
  case 0: return [4 /*yield*/, this.datePickerStart.clear(options)];
96
99
  case 1:
97
- _a.sent();
100
+ _b.sent();
98
101
  return [4 /*yield*/, this.datePickerEnd.clear(options)];
99
102
  case 2:
100
- _a.sent();
103
+ _b.sent();
101
104
  return [2 /*return*/];
102
105
  }
103
106
  });
@@ -109,3 +112,4 @@ var DateRangePicker = /** @class */ (function (_super) {
109
112
  return DateRangePicker;
110
113
  }(BaseComponent_1.BaseComponent));
111
114
  exports.DateRangePicker = DateRangePicker;
115
+ _a = LocatorSymbols_1.toValueElementLocator;
@@ -1,14 +1,20 @@
1
1
  import { type Locator } from '@playwright/test';
2
- import { BaseComponent } from './BaseComponent';
3
2
  import { type TooltipType } from '../utils';
4
3
  import { DropdownAssertions } from '../assertions';
5
4
  import { ComponentList } from './ComponentList';
6
5
  import { MenuItem } from './MenuItem';
7
6
  import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions, IsDisabledOptions } from '../options';
8
- export declare class Dropdown extends BaseComponent {
7
+ import { MenuComponent } from './MenuComponent';
8
+ import { toControlElementLocator, toFocusableElementLocator, toContainItemElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
9
+ export declare class Dropdown extends MenuComponent {
9
10
  readonly rootLocator: Locator;
10
11
  readonly buttonLocator: Locator;
11
12
  private readonly portal;
13
+ readonly [toControlElementLocator]: () => Locator;
14
+ readonly [toTextElementLocator]: () => Locator;
15
+ readonly [toItemsElementLocator]: () => Promise<Locator>;
16
+ readonly [toContainItemElementLocator]: () => Locator;
17
+ readonly [toFocusableElementLocator]: () => Locator;
12
18
  constructor(rootLocator: Locator);
13
19
  isDisabled(options?: IsDisabledOptions): Promise<boolean>;
14
20
  isMenuOpened(): Promise<boolean>;
@@ -50,56 +50,63 @@ 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.Dropdown = void 0;
55
56
  var test_1 = require("@playwright/test");
56
57
  var react_ui_1 = require("@skbkontur/react-ui");
57
58
  var MenuFooter_1 = require("@skbkontur/react-ui/components/MenuFooter");
58
- var BaseComponent_1 = require("./BaseComponent");
59
59
  var Portal_1 = require("./Portal");
60
60
  var utils_1 = require("../utils");
61
61
  var assertions_1 = require("../assertions");
62
62
  var ComponentList_1 = require("./ComponentList");
63
63
  var MenuItem_1 = require("./MenuItem");
64
64
  var dataTidSelector_1 = require("../utils/dataTidSelector");
65
+ var MenuComponent_1 = require("./MenuComponent");
66
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
65
67
  var Dropdown = /** @class */ (function (_super) {
66
68
  __extends(Dropdown, _super);
67
69
  function Dropdown(rootLocator) {
68
70
  var _this = _super.call(this, rootLocator) || this;
69
71
  _this.rootLocator = rootLocator;
72
+ _this[_a] = function () { return _this.buttonLocator; };
73
+ _this[_b] = function () { return _this.buttonLocator; };
74
+ _this[_c] = function () { return _this.getItemsLocator(); };
75
+ _this[_d] = function () { return _this.rootLocator; };
76
+ _this[_e] = function () { return _this.buttonLocator; };
70
77
  _this.buttonLocator = rootLocator.locator('button');
71
78
  _this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
72
79
  return _this;
73
80
  }
74
81
  Dropdown.prototype.isDisabled = function (options) {
75
82
  return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
83
+ return __generator(this, function (_f) {
84
+ switch (_f.label) {
78
85
  case 0: return [4 /*yield*/, this.buttonLocator.isDisabled(options)];
79
- case 1: return [2 /*return*/, _a.sent()];
86
+ case 1: return [2 /*return*/, _f.sent()];
80
87
  }
81
88
  });
82
89
  });
83
90
  };
84
91
  Dropdown.prototype.isMenuOpened = function () {
85
92
  return __awaiter(this, void 0, void 0, function () {
86
- return __generator(this, function (_a) {
87
- switch (_a.label) {
93
+ return __generator(this, function (_f) {
94
+ switch (_f.label) {
88
95
  case 0: return [4 /*yield*/, this.waitFor()];
89
96
  case 1:
90
- _a.sent();
97
+ _f.sent();
91
98
  return [4 /*yield*/, this.portal.isVisible()];
92
- case 2: return [2 /*return*/, _a.sent()];
99
+ case 2: return [2 /*return*/, _f.sent()];
93
100
  }
94
101
  });
95
102
  });
96
103
  };
97
104
  Dropdown.prototype.getText = function (options) {
98
105
  return __awaiter(this, void 0, void 0, function () {
99
- return __generator(this, function (_a) {
100
- switch (_a.label) {
106
+ return __generator(this, function (_f) {
107
+ switch (_f.label) {
101
108
  case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
102
- case 1: return [2 /*return*/, _a.sent()];
109
+ case 1: return [2 /*return*/, _f.sent()];
103
110
  }
104
111
  });
105
112
  });
@@ -107,19 +114,19 @@ var Dropdown = /** @class */ (function (_super) {
107
114
  Dropdown.prototype.selectFirstByText = function (text, options) {
108
115
  return __awaiter(this, void 0, void 0, function () {
109
116
  var items;
110
- return __generator(this, function (_a) {
111
- switch (_a.label) {
117
+ return __generator(this, function (_f) {
118
+ switch (_f.label) {
112
119
  case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
113
120
  case 1:
114
- items = _a.sent();
121
+ items = _f.sent();
115
122
  return [4 /*yield*/, items.first().click(options)];
116
123
  case 2:
117
- _a.sent();
124
+ _f.sent();
118
125
  // note: ожидание закрытия меню, чтобы не было гонок
119
126
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
120
127
  case 3:
121
128
  // note: ожидание закрытия меню, чтобы не было гонок
122
- _a.sent();
129
+ _f.sent();
123
130
  return [2 /*return*/];
124
131
  }
125
132
  });
@@ -128,19 +135,19 @@ var Dropdown = /** @class */ (function (_super) {
128
135
  Dropdown.prototype.selectByIndex = function (index, options) {
129
136
  return __awaiter(this, void 0, void 0, function () {
130
137
  var items;
131
- return __generator(this, function (_a) {
132
- switch (_a.label) {
138
+ return __generator(this, function (_f) {
139
+ switch (_f.label) {
133
140
  case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
134
141
  case 1:
135
- items = _a.sent();
142
+ items = _f.sent();
136
143
  return [4 /*yield*/, items.nth(index).click(options)];
137
144
  case 2:
138
- _a.sent();
145
+ _f.sent();
139
146
  // note: ожидание закрытия меню, чтобы не было гонок
140
147
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
141
148
  case 3:
142
149
  // note: ожидание закрытия меню, чтобы не было гонок
143
- _a.sent();
150
+ _f.sent();
144
151
  return [2 /*return*/];
145
152
  }
146
153
  });
@@ -149,25 +156,25 @@ var Dropdown = /** @class */ (function (_super) {
149
156
  Dropdown.prototype.selectByDataTid = function (dataTid, options) {
150
157
  return __awaiter(this, void 0, void 0, function () {
151
158
  var container, item;
152
- return __generator(this, function (_a) {
153
- switch (_a.label) {
159
+ return __generator(this, function (_f) {
160
+ switch (_f.label) {
154
161
  case 0: return [4 /*yield*/, this.getPortalContainer()];
155
162
  case 1:
156
- container = _a.sent();
163
+ container = _f.sent();
157
164
  item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
158
165
  return [4 /*yield*/, item.count()];
159
166
  case 2:
160
- if ((_a.sent()) > 1) {
167
+ if ((_f.sent()) > 1) {
161
168
  throw Error('DataTid должен быть уникальным');
162
169
  }
163
170
  return [4 /*yield*/, item.click(options)];
164
171
  case 3:
165
- _a.sent();
172
+ _f.sent();
166
173
  // note: ожидание закрытия меню, чтобы не было гонок
167
174
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
168
175
  case 4:
169
176
  // note: ожидание закрытия меню, чтобы не было гонок
170
- _a.sent();
177
+ _f.sent();
171
178
  return [2 /*return*/];
172
179
  }
173
180
  });
@@ -175,33 +182,29 @@ var Dropdown = /** @class */ (function (_super) {
175
182
  };
176
183
  Dropdown.prototype.click = function (options) {
177
184
  return __awaiter(this, void 0, void 0, function () {
178
- return __generator(this, function (_a) {
179
- switch (_a.label) {
185
+ return __generator(this, function (_f) {
186
+ switch (_f.label) {
180
187
  case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
181
188
  case 1:
182
- _a.sent();
189
+ _f.sent();
183
190
  return [2 /*return*/];
184
191
  }
185
192
  });
186
193
  });
187
194
  };
188
195
  Dropdown.prototype.getTooltip = function (type) {
189
- return __awaiter(this, void 0, void 0, function () {
190
- return __generator(this, function (_a) {
191
- return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
192
- });
193
- });
196
+ return (0, utils_1.getTooltip)(type, this);
194
197
  };
195
198
  Dropdown.prototype.focus = function (options) {
196
199
  return __awaiter(this, void 0, void 0, function () {
197
- return __generator(this, function (_a) {
198
- switch (_a.label) {
200
+ return __generator(this, function (_f) {
201
+ switch (_f.label) {
199
202
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
200
203
  case 1:
201
- _a.sent();
204
+ _f.sent();
202
205
  return [4 /*yield*/, this.buttonLocator.focus(options)];
203
206
  case 2:
204
- _a.sent();
207
+ _f.sent();
205
208
  return [2 /*return*/];
206
209
  }
207
210
  });
@@ -209,11 +212,11 @@ var Dropdown = /** @class */ (function (_super) {
209
212
  };
210
213
  Dropdown.prototype.blur = function (options) {
211
214
  return __awaiter(this, void 0, void 0, function () {
212
- return __generator(this, function (_a) {
213
- switch (_a.label) {
215
+ return __generator(this, function (_f) {
216
+ switch (_f.label) {
214
217
  case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
215
218
  case 1:
216
- _a.sent();
219
+ _f.sent();
217
220
  return [2 /*return*/];
218
221
  }
219
222
  });
@@ -228,14 +231,14 @@ var Dropdown = /** @class */ (function (_super) {
228
231
  Dropdown.prototype.getMenuItems = function () {
229
232
  return __awaiter(this, void 0, void 0, function () {
230
233
  var container;
231
- return __generator(this, function (_a) {
232
- switch (_a.label) {
234
+ return __generator(this, function (_f) {
235
+ switch (_f.label) {
233
236
  case 0: return [4 /*yield*/, this.getPortalContainer()];
234
237
  case 1:
235
- container = _a.sent();
238
+ container = _f.sent();
236
239
  return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
237
240
  case 2:
238
- _a.sent();
241
+ _f.sent();
239
242
  return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
240
243
  return locator
241
244
  .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
@@ -250,23 +253,23 @@ var Dropdown = /** @class */ (function (_super) {
250
253
  return __awaiter(this, void 0, void 0, function () {
251
254
  var items;
252
255
  var _this = this;
253
- return __generator(this, function (_a) {
254
- switch (_a.label) {
256
+ return __generator(this, function (_f) {
257
+ switch (_f.label) {
255
258
  case 0: return [4 /*yield*/, this.getMenuItems()];
256
259
  case 1:
257
- items = _a.sent();
260
+ items = _f.sent();
258
261
  return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
259
262
  var itemText;
260
- return __generator(this, function (_a) {
261
- switch (_a.label) {
263
+ return __generator(this, function (_f) {
264
+ switch (_f.label) {
262
265
  case 0: return [4 /*yield*/, item.getText()];
263
266
  case 1:
264
- itemText = _a.sent();
267
+ itemText = _f.sent();
265
268
  return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
266
269
  }
267
270
  });
268
271
  }); })];
269
- case 2: return [2 /*return*/, _a.sent()];
272
+ case 2: return [2 /*return*/, _f.sent()];
270
273
  }
271
274
  });
272
275
  });
@@ -274,11 +277,11 @@ var Dropdown = /** @class */ (function (_super) {
274
277
  Dropdown.prototype.getMenuItemByIndex = function (index) {
275
278
  return __awaiter(this, void 0, void 0, function () {
276
279
  var items;
277
- return __generator(this, function (_a) {
278
- switch (_a.label) {
280
+ return __generator(this, function (_f) {
281
+ switch (_f.label) {
279
282
  case 0: return [4 /*yield*/, this.getMenuItems()];
280
283
  case 1:
281
- items = _a.sent();
284
+ items = _f.sent();
282
285
  return [2 /*return*/, items.getItemByIndex(index)];
283
286
  }
284
287
  });
@@ -290,11 +293,11 @@ var Dropdown = /** @class */ (function (_super) {
290
293
  Dropdown.prototype.getMenuItemsLocator = function (byText) {
291
294
  return __awaiter(this, void 0, void 0, function () {
292
295
  var container, items;
293
- return __generator(this, function (_a) {
294
- switch (_a.label) {
296
+ return __generator(this, function (_f) {
297
+ switch (_f.label) {
295
298
  case 0: return [4 /*yield*/, this.getPortalContainer()];
296
299
  case 1:
297
- container = _a.sent();
300
+ container = _f.sent();
298
301
  items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
299
302
  return [2 /*return*/, !byText ? items : items.getByText(byText)];
300
303
  }
@@ -303,20 +306,21 @@ var Dropdown = /** @class */ (function (_super) {
303
306
  };
304
307
  Dropdown.prototype.getPortalContainer = function () {
305
308
  return __awaiter(this, void 0, void 0, function () {
306
- return __generator(this, function (_a) {
307
- switch (_a.label) {
309
+ return __generator(this, function (_f) {
310
+ switch (_f.label) {
308
311
  case 0: return [4 /*yield*/, this.isMenuOpened()];
309
312
  case 1:
310
- if (!!(_a.sent())) return [3 /*break*/, 3];
313
+ if (!!(_f.sent())) return [3 /*break*/, 3];
311
314
  return [4 /*yield*/, this.buttonLocator.click()];
312
315
  case 2:
313
- _a.sent();
314
- _a.label = 3;
316
+ _f.sent();
317
+ _f.label = 3;
315
318
  case 3: return [2 /*return*/, this.portal.getContainer()];
316
319
  }
317
320
  });
318
321
  });
319
322
  };
320
323
  return Dropdown;
321
- }(BaseComponent_1.BaseComponent));
324
+ }(MenuComponent_1.MenuComponent));
322
325
  exports.Dropdown = Dropdown;
326
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toContainItemElementLocator, _e = LocatorSymbols_1.toFocusableElementLocator;
@@ -1,14 +1,19 @@
1
1
  import type { Locator } from '@playwright/test';
2
- import { BaseComponent } from './BaseComponent';
3
2
  import type { TooltipType } from '../utils';
4
3
  import { DropdownMenuAssertions } from '../assertions';
5
4
  import { ComponentList } from './ComponentList';
6
5
  import { MenuItem } from './MenuItem';
7
6
  import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions } from '../options';
8
- export declare class DropdownMenu extends BaseComponent {
7
+ import { MenuComponent } from './MenuComponent';
8
+ import { toFocusableElementLocator, toContainItemElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
9
+ export declare class DropdownMenu extends MenuComponent {
9
10
  readonly rootLocator: Locator;
10
11
  readonly buttonLocator: Locator;
11
12
  private readonly portal;
13
+ readonly [toTextElementLocator]: () => Locator;
14
+ readonly [toItemsElementLocator]: () => Promise<Locator>;
15
+ readonly [toContainItemElementLocator]: () => Locator;
16
+ readonly [toFocusableElementLocator]: () => Locator;
12
17
  constructor(rootLocator: Locator);
13
18
  getText(options?: InnerTextOptions): Promise<string>;
14
19
  isMenuOpened(): Promise<boolean>;