@skbkontur/playwright-react-ui-components 1.14.0-beta.1 → 1.14.0-beta.3

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 (104) hide show
  1. package/build/src/assertions/CheckboxAssertions.js +1 -1
  2. package/build/src/assertions/ComboBoxAssertions.js +4 -4
  3. package/build/src/assertions/DropdownAssertions.js +4 -4
  4. package/build/src/assertions/DropdownMenuAssertions.js +4 -4
  5. package/build/src/assertions/FileUploaderAssertions.js +1 -1
  6. package/build/src/assertions/FxInputAssertions.js +2 -2
  7. package/build/src/assertions/KebabAssertions.js +4 -4
  8. package/build/src/assertions/LinkAssertions.js +2 -2
  9. package/build/src/assertions/PagingAssertions.js +2 -2
  10. package/build/src/assertions/RadioGroupAssertions.js +6 -6
  11. package/build/src/assertions/SelectAssertions.js +2 -2
  12. package/build/src/assertions/TabAssertions.js +2 -2
  13. package/build/src/assertions/TabsAssertions.js +3 -3
  14. package/build/src/assertions/TokenInputAssertions.js +1 -1
  15. package/build/src/components/ComboBox.d.ts +1 -2
  16. package/build/src/components/ComboBox.js +53 -54
  17. package/build/src/components/Dropdown.d.ts +1 -2
  18. package/build/src/components/Dropdown.js +61 -62
  19. package/build/src/components/DropdownMenu.d.ts +1 -2
  20. package/build/src/components/DropdownMenu.js +61 -62
  21. package/build/src/components/Kebab.d.ts +1 -2
  22. package/build/src/components/Kebab.js +43 -44
  23. package/build/src/components/MenuComponent.d.ts +2 -1
  24. package/build/src/components/MenuComponent.js +6 -5
  25. package/build/src/matchers/component/toBeActiveTab.d.ts +3 -0
  26. package/build/src/matchers/component/{toBeActiveEx.js → toBeActiveTab.js} +2 -2
  27. package/build/src/matchers/component/toBeAutoMode.d.ts +3 -0
  28. package/build/src/matchers/component/{toBeAutoEx.js → toBeAutoMode.js} +2 -2
  29. package/build/src/matchers/component/toBeCheckedByIndex.d.ts +3 -0
  30. package/build/src/matchers/component/{toBeUncheckedByIndexEx.js → toBeCheckedByIndex.js} +4 -4
  31. package/build/src/matchers/component/toBeCheckedByText.d.ts +3 -0
  32. package/build/src/matchers/component/{toBeCheckedByTextEx.js → toBeCheckedByText.js} +2 -2
  33. package/build/src/matchers/component/toBeCheckedByValue.d.ts +3 -0
  34. package/build/src/matchers/component/{toBeCheckedByValueEx.js → toBeCheckedByValue.js} +2 -2
  35. package/build/src/matchers/component/toBeDisabledEx.d.ts +1 -1
  36. package/build/src/matchers/component/toBeDisabledEx.js +7 -8
  37. package/build/src/matchers/component/toBeEmptyEx.d.ts +1 -1
  38. package/build/src/matchers/component/toBeEmptyEx.js +4 -5
  39. package/build/src/matchers/component/toBeEnabledEx.js +15 -25
  40. package/build/src/matchers/component/toBeHiddenEx.js +1 -2
  41. package/build/src/matchers/component/toBeInactiveTab.d.ts +3 -0
  42. package/build/src/matchers/component/{toBeInactiveEx.js → toBeInactiveTab.js} +2 -2
  43. package/build/src/matchers/component/toBeUnchecked.d.ts +3 -0
  44. package/build/src/matchers/component/{toBeUncheckedEx.js → toBeUnchecked.js} +2 -2
  45. package/build/src/matchers/component/{toBeCheckedByIndexEx.d.ts → toBeUncheckedByIndex.d.ts} +2 -2
  46. package/build/src/matchers/component/{toBeCheckedByIndexEx.js → toBeUncheckedByIndex.js} +4 -4
  47. package/build/src/matchers/component/{toBeCheckedByTextEx.d.ts → toBeUncheckedByText.d.ts} +2 -2
  48. package/build/src/matchers/component/{toBeUncheckedByTextEx.js → toBeUncheckedByText.js} +3 -3
  49. package/build/src/matchers/component/{toBeCheckedByValueEx.d.ts → toBeUncheckedByValue.d.ts} +2 -2
  50. package/build/src/matchers/component/{toBeUncheckedByValueEx.js → toBeUncheckedByValue.js} +3 -3
  51. package/build/src/matchers/component/toBeVisibleEx.js +1 -2
  52. package/build/src/matchers/component/toContainItem.d.ts +4 -0
  53. package/build/src/matchers/component/{toContainItemEx.js → toContainItem.js} +2 -3
  54. package/build/src/matchers/component/toContainItems.d.ts +3 -0
  55. package/build/src/matchers/component/{toContainItemsEx.js → toContainItems.js} +4 -4
  56. package/build/src/matchers/component/toContainSelectValue.d.ts +3 -0
  57. package/build/src/matchers/component/{toContainValueEx.js → toContainSelectValue.js} +2 -2
  58. package/build/src/matchers/component/toContainTabs.d.ts +3 -0
  59. package/build/src/matchers/component/{toContainTabsEx.js → toContainTabs.js} +2 -2
  60. package/build/src/matchers/component/{toContainTokensEx.d.ts → toContainTokens.d.ts} +1 -1
  61. package/build/src/matchers/component/{toContainTokensEx.js → toContainTokens.js} +2 -2
  62. package/build/src/matchers/component/toContainUploadedFiles.d.ts +4 -0
  63. package/build/src/matchers/component/{toContainUploadedFilesEx.js → toContainUploadedFiles.js} +2 -2
  64. package/build/src/matchers/component/{toHavePageCountEx.d.ts → toHaveActivePage.d.ts} +1 -1
  65. package/build/src/matchers/component/{toHaveActivePageEx.js → toHaveActivePage.js} +2 -2
  66. package/build/src/matchers/component/toHaveActiveTab.d.ts +2 -0
  67. package/build/src/matchers/component/{toHaveActiveTabEx.js → toHaveActiveTab.js} +4 -4
  68. package/build/src/matchers/component/toHaveError.d.ts +3 -0
  69. package/build/src/matchers/component/{toHaveWarningEx.js → toHaveError.js} +3 -3
  70. package/build/src/matchers/component/toHaveHref.d.ts +3 -0
  71. package/build/src/matchers/component/{toHaveHrefEx.js → toHaveHref.js} +2 -2
  72. package/build/src/matchers/component/toHaveItems.d.ts +3 -0
  73. package/build/src/matchers/component/{toHaveItemsEx.js → toHaveItems.js} +4 -4
  74. package/build/src/matchers/component/{toHaveActivePageEx.d.ts → toHavePageCount.d.ts} +1 -1
  75. package/build/src/matchers/component/{toHavePageCountEx.js → toHavePageCount.js} +2 -2
  76. package/build/src/matchers/component/toHaveValueEx.d.ts +1 -1
  77. package/build/src/matchers/component/toHaveValueEx.js +4 -5
  78. package/build/src/matchers/component/{toHaveErrorEx.d.ts → toHaveWarning.d.ts} +2 -2
  79. package/build/src/matchers/component/{toHaveErrorEx.js → toHaveWarning.js} +3 -3
  80. package/build/src/matchers/componentMatchers.d.ts +76 -76
  81. package/build/src/matchers/componentMatchers.js +56 -50
  82. package/build/src/matchers/createAsyncMatcher.d.ts +35 -10
  83. package/build/src/matchers/createAsyncMatcher.js +38 -13
  84. package/build/src/utils/toMatchMessage.d.ts +11 -0
  85. package/build/src/utils/toMatchMessage.js +11 -0
  86. package/package.json +1 -1
  87. package/build/src/matchers/component/toBeActiveEx.d.ts +0 -3
  88. package/build/src/matchers/component/toBeAutoEx.d.ts +0 -3
  89. package/build/src/matchers/component/toBeInactiveEx.d.ts +0 -3
  90. package/build/src/matchers/component/toBeUncheckedByIndexEx.d.ts +0 -3
  91. package/build/src/matchers/component/toBeUncheckedByTextEx.d.ts +0 -3
  92. package/build/src/matchers/component/toBeUncheckedByValueEx.d.ts +0 -3
  93. package/build/src/matchers/component/toBeUncheckedEx.d.ts +0 -3
  94. package/build/src/matchers/component/toContainItemEx.d.ts +0 -4
  95. package/build/src/matchers/component/toContainItemsEx.d.ts +0 -3
  96. package/build/src/matchers/component/toContainTabsEx.d.ts +0 -3
  97. package/build/src/matchers/component/toContainUploadedFilesEx.d.ts +0 -4
  98. package/build/src/matchers/component/toContainValueEx.d.ts +0 -3
  99. package/build/src/matchers/component/toHaveActiveTabEx.d.ts +0 -2
  100. package/build/src/matchers/component/toHaveHrefEx.d.ts +0 -3
  101. package/build/src/matchers/component/toHaveItemsEx.d.ts +0 -3
  102. package/build/src/matchers/component/toHaveWarningEx.d.ts +0 -3
  103. package/build/src/utils/is.d.ts +0 -3
  104. package/build/src/utils/is.js +0 -5
@@ -5,7 +5,7 @@ import { ComponentList } from './ComponentList';
5
5
  import { MenuItem } from './MenuItem';
6
6
  import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions, IsDisabledOptions } from '../options';
7
7
  import { MenuComponent } from './MenuComponent';
8
- import { toControlElementLocator, toFocusableElementLocator, toContainItemElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
8
+ import { toControlElementLocator, toFocusableElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
9
9
  export declare class Dropdown extends MenuComponent {
10
10
  readonly rootLocator: Locator;
11
11
  readonly buttonLocator: Locator;
@@ -13,7 +13,6 @@ export declare class Dropdown extends MenuComponent {
13
13
  readonly [toControlElementLocator]: () => Locator;
14
14
  readonly [toTextElementLocator]: () => Locator;
15
15
  readonly [toItemsElementLocator]: () => Promise<Locator>;
16
- readonly [toContainItemElementLocator]: () => Locator;
17
16
  readonly [toFocusableElementLocator]: () => Locator;
18
17
  constructor(rootLocator: Locator);
19
18
  isDisabled(options?: IsDisabledOptions): Promise<boolean>;
@@ -50,7 +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, _e;
53
+ var _a, _b, _c, _d;
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
55
  exports.Dropdown = void 0;
56
56
  var test_1 = require("@playwright/test");
@@ -72,41 +72,40 @@ var Dropdown = /** @class */ (function (_super) {
72
72
  _this[_a] = function () { return _this.buttonLocator; };
73
73
  _this[_b] = function () { return _this.buttonLocator; };
74
74
  _this[_c] = function () { return _this.getItemsLocator(); };
75
- _this[_d] = function () { return _this.rootLocator; };
76
- _this[_e] = function () { return _this.buttonLocator; };
75
+ _this[_d] = function () { return _this.buttonLocator; };
77
76
  _this.buttonLocator = rootLocator.locator('button');
78
77
  _this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
79
78
  return _this;
80
79
  }
81
80
  Dropdown.prototype.isDisabled = function (options) {
82
81
  return __awaiter(this, void 0, void 0, function () {
83
- return __generator(this, function (_f) {
84
- switch (_f.label) {
82
+ return __generator(this, function (_e) {
83
+ switch (_e.label) {
85
84
  case 0: return [4 /*yield*/, this.buttonLocator.isDisabled(options)];
86
- case 1: return [2 /*return*/, _f.sent()];
85
+ case 1: return [2 /*return*/, _e.sent()];
87
86
  }
88
87
  });
89
88
  });
90
89
  };
91
90
  Dropdown.prototype.isMenuOpened = function () {
92
91
  return __awaiter(this, void 0, void 0, function () {
93
- return __generator(this, function (_f) {
94
- switch (_f.label) {
92
+ return __generator(this, function (_e) {
93
+ switch (_e.label) {
95
94
  case 0: return [4 /*yield*/, this.waitFor()];
96
95
  case 1:
97
- _f.sent();
96
+ _e.sent();
98
97
  return [4 /*yield*/, this.portal.isVisible()];
99
- case 2: return [2 /*return*/, _f.sent()];
98
+ case 2: return [2 /*return*/, _e.sent()];
100
99
  }
101
100
  });
102
101
  });
103
102
  };
104
103
  Dropdown.prototype.getText = function (options) {
105
104
  return __awaiter(this, void 0, void 0, function () {
106
- return __generator(this, function (_f) {
107
- switch (_f.label) {
105
+ return __generator(this, function (_e) {
106
+ switch (_e.label) {
108
107
  case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
109
- case 1: return [2 /*return*/, _f.sent()];
108
+ case 1: return [2 /*return*/, _e.sent()];
110
109
  }
111
110
  });
112
111
  });
@@ -114,19 +113,19 @@ var Dropdown = /** @class */ (function (_super) {
114
113
  Dropdown.prototype.selectFirstByText = function (text, options) {
115
114
  return __awaiter(this, void 0, void 0, function () {
116
115
  var items;
117
- return __generator(this, function (_f) {
118
- switch (_f.label) {
116
+ return __generator(this, function (_e) {
117
+ switch (_e.label) {
119
118
  case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
120
119
  case 1:
121
- items = _f.sent();
120
+ items = _e.sent();
122
121
  return [4 /*yield*/, items.first().click(options)];
123
122
  case 2:
124
- _f.sent();
123
+ _e.sent();
125
124
  // note: ожидание закрытия меню, чтобы не было гонок
126
125
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
127
126
  case 3:
128
127
  // note: ожидание закрытия меню, чтобы не было гонок
129
- _f.sent();
128
+ _e.sent();
130
129
  return [2 /*return*/];
131
130
  }
132
131
  });
@@ -135,19 +134,19 @@ var Dropdown = /** @class */ (function (_super) {
135
134
  Dropdown.prototype.selectByIndex = function (index, options) {
136
135
  return __awaiter(this, void 0, void 0, function () {
137
136
  var items;
138
- return __generator(this, function (_f) {
139
- switch (_f.label) {
137
+ return __generator(this, function (_e) {
138
+ switch (_e.label) {
140
139
  case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
141
140
  case 1:
142
- items = _f.sent();
141
+ items = _e.sent();
143
142
  return [4 /*yield*/, items.nth(index).click(options)];
144
143
  case 2:
145
- _f.sent();
144
+ _e.sent();
146
145
  // note: ожидание закрытия меню, чтобы не было гонок
147
146
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
148
147
  case 3:
149
148
  // note: ожидание закрытия меню, чтобы не было гонок
150
- _f.sent();
149
+ _e.sent();
151
150
  return [2 /*return*/];
152
151
  }
153
152
  });
@@ -156,25 +155,25 @@ var Dropdown = /** @class */ (function (_super) {
156
155
  Dropdown.prototype.selectByDataTid = function (dataTid, options) {
157
156
  return __awaiter(this, void 0, void 0, function () {
158
157
  var container, item;
159
- return __generator(this, function (_f) {
160
- switch (_f.label) {
158
+ return __generator(this, function (_e) {
159
+ switch (_e.label) {
161
160
  case 0: return [4 /*yield*/, this.getPortalContainer()];
162
161
  case 1:
163
- container = _f.sent();
162
+ container = _e.sent();
164
163
  item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
165
164
  return [4 /*yield*/, item.count()];
166
165
  case 2:
167
- if ((_f.sent()) > 1) {
166
+ if ((_e.sent()) > 1) {
168
167
  throw Error('DataTid должен быть уникальным');
169
168
  }
170
169
  return [4 /*yield*/, item.click(options)];
171
170
  case 3:
172
- _f.sent();
171
+ _e.sent();
173
172
  // note: ожидание закрытия меню, чтобы не было гонок
174
173
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
175
174
  case 4:
176
175
  // note: ожидание закрытия меню, чтобы не было гонок
177
- _f.sent();
176
+ _e.sent();
178
177
  return [2 /*return*/];
179
178
  }
180
179
  });
@@ -182,11 +181,11 @@ var Dropdown = /** @class */ (function (_super) {
182
181
  };
183
182
  Dropdown.prototype.click = function (options) {
184
183
  return __awaiter(this, void 0, void 0, function () {
185
- return __generator(this, function (_f) {
186
- switch (_f.label) {
184
+ return __generator(this, function (_e) {
185
+ switch (_e.label) {
187
186
  case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
188
187
  case 1:
189
- _f.sent();
188
+ _e.sent();
190
189
  return [2 /*return*/];
191
190
  }
192
191
  });
@@ -197,14 +196,14 @@ var Dropdown = /** @class */ (function (_super) {
197
196
  };
198
197
  Dropdown.prototype.focus = function (options) {
199
198
  return __awaiter(this, void 0, void 0, function () {
200
- return __generator(this, function (_f) {
201
- switch (_f.label) {
199
+ return __generator(this, function (_e) {
200
+ switch (_e.label) {
202
201
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
203
202
  case 1:
204
- _f.sent();
203
+ _e.sent();
205
204
  return [4 /*yield*/, this.buttonLocator.focus(options)];
206
205
  case 2:
207
- _f.sent();
206
+ _e.sent();
208
207
  return [2 /*return*/];
209
208
  }
210
209
  });
@@ -212,11 +211,11 @@ var Dropdown = /** @class */ (function (_super) {
212
211
  };
213
212
  Dropdown.prototype.blur = function (options) {
214
213
  return __awaiter(this, void 0, void 0, function () {
215
- return __generator(this, function (_f) {
216
- switch (_f.label) {
214
+ return __generator(this, function (_e) {
215
+ switch (_e.label) {
217
216
  case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
218
217
  case 1:
219
- _f.sent();
218
+ _e.sent();
220
219
  return [2 /*return*/];
221
220
  }
222
221
  });
@@ -231,14 +230,14 @@ var Dropdown = /** @class */ (function (_super) {
231
230
  Dropdown.prototype.getMenuItems = function () {
232
231
  return __awaiter(this, void 0, void 0, function () {
233
232
  var container;
234
- return __generator(this, function (_f) {
235
- switch (_f.label) {
233
+ return __generator(this, function (_e) {
234
+ switch (_e.label) {
236
235
  case 0: return [4 /*yield*/, this.getPortalContainer()];
237
236
  case 1:
238
- container = _f.sent();
237
+ container = _e.sent();
239
238
  return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
240
239
  case 2:
241
- _f.sent();
240
+ _e.sent();
242
241
  return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
243
242
  return locator
244
243
  .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
@@ -253,23 +252,23 @@ var Dropdown = /** @class */ (function (_super) {
253
252
  return __awaiter(this, void 0, void 0, function () {
254
253
  var items;
255
254
  var _this = this;
256
- return __generator(this, function (_f) {
257
- switch (_f.label) {
255
+ return __generator(this, function (_e) {
256
+ switch (_e.label) {
258
257
  case 0: return [4 /*yield*/, this.getMenuItems()];
259
258
  case 1:
260
- items = _f.sent();
259
+ items = _e.sent();
261
260
  return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
262
261
  var itemText;
263
- return __generator(this, function (_f) {
264
- switch (_f.label) {
262
+ return __generator(this, function (_e) {
263
+ switch (_e.label) {
265
264
  case 0: return [4 /*yield*/, item.getText()];
266
265
  case 1:
267
- itemText = _f.sent();
266
+ itemText = _e.sent();
268
267
  return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
269
268
  }
270
269
  });
271
270
  }); })];
272
- case 2: return [2 /*return*/, _f.sent()];
271
+ case 2: return [2 /*return*/, _e.sent()];
273
272
  }
274
273
  });
275
274
  });
@@ -277,11 +276,11 @@ var Dropdown = /** @class */ (function (_super) {
277
276
  Dropdown.prototype.getMenuItemByIndex = function (index) {
278
277
  return __awaiter(this, void 0, void 0, function () {
279
278
  var items;
280
- return __generator(this, function (_f) {
281
- switch (_f.label) {
279
+ return __generator(this, function (_e) {
280
+ switch (_e.label) {
282
281
  case 0: return [4 /*yield*/, this.getMenuItems()];
283
282
  case 1:
284
- items = _f.sent();
283
+ items = _e.sent();
285
284
  return [2 /*return*/, items.getItemByIndex(index)];
286
285
  }
287
286
  });
@@ -293,11 +292,11 @@ var Dropdown = /** @class */ (function (_super) {
293
292
  Dropdown.prototype.getMenuItemsLocator = function (byText) {
294
293
  return __awaiter(this, void 0, void 0, function () {
295
294
  var container, items;
296
- return __generator(this, function (_f) {
297
- switch (_f.label) {
295
+ return __generator(this, function (_e) {
296
+ switch (_e.label) {
298
297
  case 0: return [4 /*yield*/, this.getPortalContainer()];
299
298
  case 1:
300
- container = _f.sent();
299
+ container = _e.sent();
301
300
  items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
302
301
  return [2 /*return*/, !byText ? items : items.getByText(byText)];
303
302
  }
@@ -306,15 +305,15 @@ var Dropdown = /** @class */ (function (_super) {
306
305
  };
307
306
  Dropdown.prototype.getPortalContainer = function () {
308
307
  return __awaiter(this, void 0, void 0, function () {
309
- return __generator(this, function (_f) {
310
- switch (_f.label) {
308
+ return __generator(this, function (_e) {
309
+ switch (_e.label) {
311
310
  case 0: return [4 /*yield*/, this.isMenuOpened()];
312
311
  case 1:
313
- if (!!(_f.sent())) return [3 /*break*/, 3];
312
+ if (!!(_e.sent())) return [3 /*break*/, 3];
314
313
  return [4 /*yield*/, this.buttonLocator.click()];
315
314
  case 2:
316
- _f.sent();
317
- _f.label = 3;
315
+ _e.sent();
316
+ _e.label = 3;
318
317
  case 3: return [2 /*return*/, this.portal.getContainer()];
319
318
  }
320
319
  });
@@ -323,4 +322,4 @@ var Dropdown = /** @class */ (function (_super) {
323
322
  return Dropdown;
324
323
  }(MenuComponent_1.MenuComponent));
325
324
  exports.Dropdown = Dropdown;
326
- _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toContainItemElementLocator, _e = LocatorSymbols_1.toFocusableElementLocator;
325
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toFocusableElementLocator;
@@ -5,14 +5,13 @@ import { ComponentList } from './ComponentList';
5
5
  import { MenuItem } from './MenuItem';
6
6
  import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions } from '../options';
7
7
  import { MenuComponent } from './MenuComponent';
8
- import { toFocusableElementLocator, toContainItemElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
8
+ import { toFocusableElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
9
9
  export declare class DropdownMenu extends MenuComponent {
10
10
  readonly rootLocator: Locator;
11
11
  readonly buttonLocator: Locator;
12
12
  private readonly portal;
13
13
  readonly [toTextElementLocator]: () => Locator;
14
14
  readonly [toItemsElementLocator]: () => Promise<Locator>;
15
- readonly [toContainItemElementLocator]: () => Locator;
16
15
  readonly [toFocusableElementLocator]: () => Locator;
17
16
  constructor(rootLocator: Locator);
18
17
  getText(options?: InnerTextOptions): Promise<string>;
@@ -50,7 +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
+ var _a, _b, _c;
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
55
  exports.DropdownMenu = void 0;
56
56
  var test_1 = require("@playwright/test");
@@ -71,31 +71,30 @@ var DropdownMenu = /** @class */ (function (_super) {
71
71
  _this.rootLocator = rootLocator;
72
72
  _this[_a] = function () { return _this.buttonLocator; };
73
73
  _this[_b] = function () { return _this.getItemsLocator(); };
74
- _this[_c] = function () { return _this.rootLocator; };
75
- _this[_d] = function () { return _this.buttonLocator; };
74
+ _this[_c] = function () { return _this.buttonLocator; };
76
75
  _this.buttonLocator = rootLocator.locator('button');
77
76
  _this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
78
77
  return _this;
79
78
  }
80
79
  DropdownMenu.prototype.getText = function (options) {
81
80
  return __awaiter(this, void 0, void 0, function () {
82
- return __generator(this, function (_e) {
83
- switch (_e.label) {
81
+ return __generator(this, function (_d) {
82
+ switch (_d.label) {
84
83
  case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
85
- case 1: return [2 /*return*/, _e.sent()];
84
+ case 1: return [2 /*return*/, _d.sent()];
86
85
  }
87
86
  });
88
87
  });
89
88
  };
90
89
  DropdownMenu.prototype.isMenuOpened = function () {
91
90
  return __awaiter(this, void 0, void 0, function () {
92
- return __generator(this, function (_e) {
93
- switch (_e.label) {
91
+ return __generator(this, function (_d) {
92
+ switch (_d.label) {
94
93
  case 0: return [4 /*yield*/, this.waitFor()];
95
94
  case 1:
96
- _e.sent();
95
+ _d.sent();
97
96
  return [4 /*yield*/, this.portal.isVisible()];
98
- case 2: return [2 /*return*/, _e.sent()];
97
+ case 2: return [2 /*return*/, _d.sent()];
99
98
  }
100
99
  });
101
100
  });
@@ -104,21 +103,21 @@ var DropdownMenu = /** @class */ (function (_super) {
104
103
  return __awaiter(this, arguments, void 0, function (text, options) {
105
104
  var items;
106
105
  if (options === void 0) { options = { closedAfterSelect: true }; }
107
- return __generator(this, function (_e) {
108
- switch (_e.label) {
106
+ return __generator(this, function (_d) {
107
+ switch (_d.label) {
109
108
  case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
110
109
  case 1:
111
- items = _e.sent();
110
+ items = _d.sent();
112
111
  return [4 /*yield*/, items.first().click()];
113
112
  case 2:
114
- _e.sent();
113
+ _d.sent();
115
114
  if (!options.closedAfterSelect) return [3 /*break*/, 4];
116
115
  // note: ожидание закрытия меню, чтобы не было гонок
117
116
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
118
117
  case 3:
119
118
  // note: ожидание закрытия меню, чтобы не было гонок
120
- _e.sent();
121
- _e.label = 4;
119
+ _d.sent();
120
+ _d.label = 4;
122
121
  case 4: return [2 /*return*/];
123
122
  }
124
123
  });
@@ -128,27 +127,27 @@ var DropdownMenu = /** @class */ (function (_super) {
128
127
  return __awaiter(this, arguments, void 0, function (dataTid, options) {
129
128
  var container, item;
130
129
  if (options === void 0) { options = { closedAfterSelect: true }; }
131
- return __generator(this, function (_e) {
132
- switch (_e.label) {
130
+ return __generator(this, function (_d) {
131
+ switch (_d.label) {
133
132
  case 0: return [4 /*yield*/, this.getPortalContainer()];
134
133
  case 1:
135
- container = _e.sent();
134
+ container = _d.sent();
136
135
  item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
137
136
  return [4 /*yield*/, item.count()];
138
137
  case 2:
139
- if ((_e.sent()) > 1) {
138
+ if ((_d.sent()) > 1) {
140
139
  throw Error('DataTid должен быть уникальным');
141
140
  }
142
141
  return [4 /*yield*/, item.click()];
143
142
  case 3:
144
- _e.sent();
143
+ _d.sent();
145
144
  if (!options.closedAfterSelect) return [3 /*break*/, 5];
146
145
  // note: ожидание закрытия меню, чтобы не было гонок
147
146
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
148
147
  case 4:
149
148
  // note: ожидание закрытия меню, чтобы не было гонок
150
- _e.sent();
151
- _e.label = 5;
149
+ _d.sent();
150
+ _d.label = 5;
152
151
  case 5: return [2 /*return*/];
153
152
  }
154
153
  });
@@ -158,21 +157,21 @@ var DropdownMenu = /** @class */ (function (_super) {
158
157
  return __awaiter(this, arguments, void 0, function (index, options) {
159
158
  var items;
160
159
  if (options === void 0) { options = { closedAfterSelect: true }; }
161
- return __generator(this, function (_e) {
162
- switch (_e.label) {
160
+ return __generator(this, function (_d) {
161
+ switch (_d.label) {
163
162
  case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
164
163
  case 1:
165
- items = _e.sent();
164
+ items = _d.sent();
166
165
  return [4 /*yield*/, items.nth(index).click()];
167
166
  case 2:
168
- _e.sent();
167
+ _d.sent();
169
168
  if (!options.closedAfterSelect) return [3 /*break*/, 4];
170
169
  // note: ожидание закрытия меню, чтобы не было гонок
171
170
  return [4 /*yield*/, this.portal.expect().toBeHidden()];
172
171
  case 3:
173
172
  // note: ожидание закрытия меню, чтобы не было гонок
174
- _e.sent();
175
- _e.label = 4;
173
+ _d.sent();
174
+ _d.label = 4;
176
175
  case 4: return [2 /*return*/];
177
176
  }
178
177
  });
@@ -180,11 +179,11 @@ var DropdownMenu = /** @class */ (function (_super) {
180
179
  };
181
180
  DropdownMenu.prototype.click = function (options) {
182
181
  return __awaiter(this, void 0, void 0, function () {
183
- return __generator(this, function (_e) {
184
- switch (_e.label) {
182
+ return __generator(this, function (_d) {
183
+ switch (_d.label) {
185
184
  case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
186
185
  case 1:
187
- _e.sent();
186
+ _d.sent();
188
187
  return [2 /*return*/];
189
188
  }
190
189
  });
@@ -192,14 +191,14 @@ var DropdownMenu = /** @class */ (function (_super) {
192
191
  };
193
192
  DropdownMenu.prototype.focus = function (options) {
194
193
  return __awaiter(this, void 0, void 0, function () {
195
- return __generator(this, function (_e) {
196
- switch (_e.label) {
194
+ return __generator(this, function (_d) {
195
+ switch (_d.label) {
197
196
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
198
197
  case 1:
199
- _e.sent();
198
+ _d.sent();
200
199
  return [4 /*yield*/, this.buttonLocator.focus(options)];
201
200
  case 2:
202
- _e.sent();
201
+ _d.sent();
203
202
  return [2 /*return*/];
204
203
  }
205
204
  });
@@ -207,11 +206,11 @@ var DropdownMenu = /** @class */ (function (_super) {
207
206
  };
208
207
  DropdownMenu.prototype.blur = function (options) {
209
208
  return __awaiter(this, void 0, void 0, function () {
210
- return __generator(this, function (_e) {
211
- switch (_e.label) {
209
+ return __generator(this, function (_d) {
210
+ switch (_d.label) {
212
211
  case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
213
212
  case 1:
214
- _e.sent();
213
+ _d.sent();
215
214
  return [2 /*return*/];
216
215
  }
217
216
  });
@@ -229,14 +228,14 @@ var DropdownMenu = /** @class */ (function (_super) {
229
228
  DropdownMenu.prototype.getMenuItems = function () {
230
229
  return __awaiter(this, void 0, void 0, function () {
231
230
  var container;
232
- return __generator(this, function (_e) {
233
- switch (_e.label) {
231
+ return __generator(this, function (_d) {
232
+ switch (_d.label) {
234
233
  case 0: return [4 /*yield*/, this.getPortalContainer()];
235
234
  case 1:
236
- container = _e.sent();
235
+ container = _d.sent();
237
236
  return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
238
237
  case 2:
239
- _e.sent();
238
+ _d.sent();
240
239
  return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
241
240
  return locator
242
241
  .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
@@ -251,23 +250,23 @@ var DropdownMenu = /** @class */ (function (_super) {
251
250
  return __awaiter(this, void 0, void 0, function () {
252
251
  var items;
253
252
  var _this = this;
254
- return __generator(this, function (_e) {
255
- switch (_e.label) {
253
+ return __generator(this, function (_d) {
254
+ switch (_d.label) {
256
255
  case 0: return [4 /*yield*/, this.getMenuItems()];
257
256
  case 1:
258
- items = _e.sent();
257
+ items = _d.sent();
259
258
  return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
260
259
  var itemText;
261
- return __generator(this, function (_e) {
262
- switch (_e.label) {
260
+ return __generator(this, function (_d) {
261
+ switch (_d.label) {
263
262
  case 0: return [4 /*yield*/, item.getText()];
264
263
  case 1:
265
- itemText = _e.sent();
264
+ itemText = _d.sent();
266
265
  return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
267
266
  }
268
267
  });
269
268
  }); })];
270
- case 2: return [2 /*return*/, _e.sent()];
269
+ case 2: return [2 /*return*/, _d.sent()];
271
270
  }
272
271
  });
273
272
  });
@@ -275,11 +274,11 @@ var DropdownMenu = /** @class */ (function (_super) {
275
274
  DropdownMenu.prototype.getMenuItemByIndex = function (index) {
276
275
  return __awaiter(this, void 0, void 0, function () {
277
276
  var items;
278
- return __generator(this, function (_e) {
279
- switch (_e.label) {
277
+ return __generator(this, function (_d) {
278
+ switch (_d.label) {
280
279
  case 0: return [4 /*yield*/, this.getMenuItems()];
281
280
  case 1:
282
- items = _e.sent();
281
+ items = _d.sent();
283
282
  return [2 /*return*/, items.getItemByIndex(index)];
284
283
  }
285
284
  });
@@ -291,11 +290,11 @@ var DropdownMenu = /** @class */ (function (_super) {
291
290
  DropdownMenu.prototype.getMenuItemsLocator = function (byText) {
292
291
  return __awaiter(this, void 0, void 0, function () {
293
292
  var container, items;
294
- return __generator(this, function (_e) {
295
- switch (_e.label) {
293
+ return __generator(this, function (_d) {
294
+ switch (_d.label) {
296
295
  case 0: return [4 /*yield*/, this.getPortalContainer()];
297
296
  case 1:
298
- container = _e.sent();
297
+ container = _d.sent();
299
298
  items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
300
299
  return [2 /*return*/, !byText ? items : items.getByText(byText)];
301
300
  }
@@ -304,15 +303,15 @@ var DropdownMenu = /** @class */ (function (_super) {
304
303
  };
305
304
  DropdownMenu.prototype.getPortalContainer = function () {
306
305
  return __awaiter(this, void 0, void 0, function () {
307
- return __generator(this, function (_e) {
308
- switch (_e.label) {
306
+ return __generator(this, function (_d) {
307
+ switch (_d.label) {
309
308
  case 0: return [4 /*yield*/, this.isMenuOpened()];
310
309
  case 1:
311
- if (!!(_e.sent())) return [3 /*break*/, 3];
310
+ if (!!(_d.sent())) return [3 /*break*/, 3];
312
311
  return [4 /*yield*/, this.buttonLocator.click()];
313
312
  case 2:
314
- _e.sent();
315
- _e.label = 3;
313
+ _d.sent();
314
+ _d.label = 3;
316
315
  case 3: return [2 /*return*/, this.portal.getContainer()];
317
316
  }
318
317
  });
@@ -321,4 +320,4 @@ var DropdownMenu = /** @class */ (function (_super) {
321
320
  return DropdownMenu;
322
321
  }(MenuComponent_1.MenuComponent));
323
322
  exports.DropdownMenu = DropdownMenu;
324
- _a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.toContainItemElementLocator, _d = LocatorSymbols_1.toFocusableElementLocator;
323
+ _a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
@@ -4,13 +4,12 @@ import { MenuItem } from './MenuItem';
4
4
  import { KebabAssertions } from '../assertions';
5
5
  import type { ClickOptions, GetAttributeOptions } from '../options';
6
6
  import { MenuComponent } from './MenuComponent';
7
- import { toControlElementLocator, toContainItemElementLocator, toItemsElementLocator } from '../matchers/component/LocatorSymbols';
7
+ import { toControlElementLocator, toItemsElementLocator } from '../matchers/component/LocatorSymbols';
8
8
  export declare class Kebab extends MenuComponent {
9
9
  private readonly portal;
10
10
  readonly captionLocator: Locator;
11
11
  readonly [toControlElementLocator]: () => Locator;
12
12
  readonly [toItemsElementLocator]: () => Promise<Locator>;
13
- readonly [toContainItemElementLocator]: () => Locator;
14
13
  constructor(rootLocator: Locator);
15
14
  isDisabled(options?: GetAttributeOptions): Promise<boolean>;
16
15
  isMenuOpened(): Promise<boolean>;