@elastic/eui-test-helpers 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/cjs/components/datagrid/selectors.d.ts +36 -0
- package/lib/cjs/components/datagrid/selectors.js +50 -0
- package/lib/cjs/components/form/super_select/selectors.d.ts +33 -0
- package/lib/cjs/components/form/super_select/selectors.js +47 -0
- package/lib/cjs/components/toast/selectors.d.ts +12 -0
- package/lib/cjs/components/toast/selectors.js +26 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.js +22 -1
- package/lib/cjs/playwright/components/datagrid/object.d.ts +51 -0
- package/lib/cjs/playwright/components/datagrid/object.js +119 -0
- package/lib/cjs/playwright/components/form/super_select/object.d.ts +40 -0
- package/lib/cjs/playwright/components/form/super_select/object.js +93 -0
- package/lib/cjs/playwright/components/toast/object.d.ts +24 -0
- package/lib/cjs/playwright/components/toast/object.js +55 -0
- package/lib/cjs/selectors.d.ts +3 -0
- package/lib/cjs/selectors.js +22 -1
- package/lib/esm/components/datagrid/selectors.d.ts +36 -0
- package/lib/esm/components/datagrid/selectors.js +44 -0
- package/lib/esm/components/datagrid/selectors.js.map +1 -0
- package/lib/esm/components/form/super_select/selectors.d.ts +33 -0
- package/lib/esm/components/form/super_select/selectors.js +41 -0
- package/lib/esm/components/form/super_select/selectors.js.map +1 -0
- package/lib/esm/components/toast/selectors.d.ts +12 -0
- package/lib/esm/components/toast/selectors.js +20 -0
- package/lib/esm/components/toast/selectors.js.map +1 -0
- package/lib/esm/index.d.ts +3 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/playwright/components/datagrid/object.d.ts +51 -0
- package/lib/esm/playwright/components/datagrid/object.js +99 -0
- package/lib/esm/playwright/components/datagrid/object.js.map +1 -0
- package/lib/esm/playwright/components/form/super_select/object.d.ts +40 -0
- package/lib/esm/playwright/components/form/super_select/object.js +76 -0
- package/lib/esm/playwright/components/form/super_select/object.js.map +1 -0
- package/lib/esm/playwright/components/toast/object.d.ts +24 -0
- package/lib/esm/playwright/components/toast/object.js +46 -0
- package/lib/esm/playwright/components/toast/object.js.map +1 -0
- package/lib/esm/selectors.d.ts +3 -0
- package/lib/esm/selectors.js +3 -0
- package/lib/esm/selectors.js.map +1 -1
- package/package.json +1 -1
- package/src/components/datagrid/README.md +25 -0
- package/src/components/form/super_select/README.md +25 -0
- package/src/components/toast/README.md +22 -0
package/lib/cjs/selectors.js
CHANGED
|
@@ -9,4 +9,25 @@ Object.defineProperty(exports, "EuiComboBoxSelectors", {
|
|
|
9
9
|
return _selectors.EuiComboBoxSelectors;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
Object.defineProperty(exports, "EuiDataGridSelectors", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _selectors2.EuiDataGridSelectors;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "EuiGlobalToastListSelectors", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _selectors4.EuiGlobalToastListSelectors;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "EuiSuperSelectSelectors", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _selectors3.EuiSuperSelectSelectors;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _selectors = require("./components/combo_box/selectors");
|
|
31
|
+
var _selectors2 = require("./components/datagrid/selectors");
|
|
32
|
+
var _selectors3 = require("./components/form/super_select/selectors");
|
|
33
|
+
var _selectors4 = require("./components/toast/selectors");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/data-grid|EuiDataGrid}.
|
|
4
|
+
* `*_SELECTOR` values are CSS; `*_TEST_SUBJ` values are `data-test-subj` names.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EuiDataGridSelectors: {
|
|
7
|
+
/** Root element (the `.euiDataGrid` div carrying the consumer's `data-test-subj`). */
|
|
8
|
+
ROOT_SELECTOR: string;
|
|
9
|
+
/** Root element only while fullscreen mode is active (state class set synchronously). */
|
|
10
|
+
FULL_SCREEN_ROOT_SELECTOR: string;
|
|
11
|
+
/** A rendered data row. Rows are virtualized — only a window is mounted. */
|
|
12
|
+
ROW_SELECTOR: string;
|
|
13
|
+
/**
|
|
14
|
+
* A rendered data cell. Cells carry `data-gridcell-column-id` (stable column
|
|
15
|
+
* id, unaffected by column order) and `data-gridcell-row-index`. Header cells
|
|
16
|
+
* carry `data-gridcell-column-id` too, so cell queries must include this
|
|
17
|
+
* class to exclude them.
|
|
18
|
+
*/
|
|
19
|
+
ROW_CELL_SELECTOR: string;
|
|
20
|
+
/** A column header cell (also carries `data-gridcell-column-id`). */
|
|
21
|
+
HEADER_CELL_SELECTOR: string;
|
|
22
|
+
/** The header cell's actions button, interactable on focus/hover. */
|
|
23
|
+
HEADER_ACTIONS_BUTTON_SELECTOR: string;
|
|
24
|
+
FULL_SCREEN_BUTTON_TEST_SUBJ: string;
|
|
25
|
+
/**
|
|
26
|
+
* A column's header actions menu. It renders in a portal, but EUI names it
|
|
27
|
+
* per column id, which keeps lookups safe when several grids coexist.
|
|
28
|
+
*/
|
|
29
|
+
headerActionsMenuFor: (columnId: string) => string;
|
|
30
|
+
/** A rendered data cell addressed by column id and row index. */
|
|
31
|
+
cellFor: (columnId: string, rowIndex: number) => string;
|
|
32
|
+
/** All rendered data cells of a column. */
|
|
33
|
+
columnCellsFor: (columnId: string) => string;
|
|
34
|
+
/** A column's header cell. */
|
|
35
|
+
headerCellFor: (columnId: string) => string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Stable selectors for
|
|
10
|
+
* {@link https://eui.elastic.co/docs/components/data-grid|EuiDataGrid}.
|
|
11
|
+
* `*_SELECTOR` values are CSS; `*_TEST_SUBJ` values are `data-test-subj` names.
|
|
12
|
+
*/
|
|
13
|
+
export const EuiDataGridSelectors = {
|
|
14
|
+
/** Root element (the `.euiDataGrid` div carrying the consumer's `data-test-subj`). */
|
|
15
|
+
ROOT_SELECTOR: '.euiDataGrid',
|
|
16
|
+
/** Root element only while fullscreen mode is active (state class set synchronously). */
|
|
17
|
+
FULL_SCREEN_ROOT_SELECTOR: '.euiDataGrid--fullScreen',
|
|
18
|
+
/** A rendered data row. Rows are virtualized — only a window is mounted. */
|
|
19
|
+
ROW_SELECTOR: '.euiDataGridRow',
|
|
20
|
+
/**
|
|
21
|
+
* A rendered data cell. Cells carry `data-gridcell-column-id` (stable column
|
|
22
|
+
* id, unaffected by column order) and `data-gridcell-row-index`. Header cells
|
|
23
|
+
* carry `data-gridcell-column-id` too, so cell queries must include this
|
|
24
|
+
* class to exclude them.
|
|
25
|
+
*/
|
|
26
|
+
ROW_CELL_SELECTOR: '.euiDataGridRowCell',
|
|
27
|
+
/** A column header cell (also carries `data-gridcell-column-id`). */
|
|
28
|
+
HEADER_CELL_SELECTOR: '.euiDataGridHeaderCell',
|
|
29
|
+
/** The header cell's actions button, interactable on focus/hover. */
|
|
30
|
+
HEADER_ACTIONS_BUTTON_SELECTOR: '.euiDataGridHeaderCell__button',
|
|
31
|
+
FULL_SCREEN_BUTTON_TEST_SUBJ: 'dataGridFullScreenButton',
|
|
32
|
+
/**
|
|
33
|
+
* A column's header actions menu. It renders in a portal, but EUI names it
|
|
34
|
+
* per column id, which keeps lookups safe when several grids coexist.
|
|
35
|
+
*/
|
|
36
|
+
headerActionsMenuFor: (columnId) => `[data-test-subj="dataGridHeaderCellActionGroup-${columnId}"]`,
|
|
37
|
+
/** A rendered data cell addressed by column id and row index. */
|
|
38
|
+
cellFor: (columnId, rowIndex) => `.euiDataGridRowCell[data-gridcell-column-id="${columnId}"][data-gridcell-row-index="${rowIndex}"]`,
|
|
39
|
+
/** All rendered data cells of a column. */
|
|
40
|
+
columnCellsFor: (columnId) => `.euiDataGridRowCell[data-gridcell-column-id="${columnId}"]`,
|
|
41
|
+
/** A column's header cell. */
|
|
42
|
+
headerCellFor: (columnId) => `.euiDataGridHeaderCell[data-gridcell-column-id="${columnId}"]`,
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/datagrid/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,sFAAsF;IACtF,aAAa,EAAE,cAAc;IAE7B,yFAAyF;IACzF,yBAAyB,EAAE,0BAA0B;IAErD,4EAA4E;IAC5E,YAAY,EAAE,iBAAiB;IAE/B;;;;;OAKG;IACH,iBAAiB,EAAE,qBAAqB;IAExC,qEAAqE;IACrE,oBAAoB,EAAE,wBAAwB;IAE9C,qEAAqE;IACrE,8BAA8B,EAAE,gCAAgC;IAEhE,4BAA4B,EAAE,0BAA0B;IAExD;;;OAGG;IACH,oBAAoB,EAAE,CAAC,QAAgB,EAAU,EAAE,CACjD,kDAAkD,QAAQ,IAAI;IAEhE,iEAAiE;IACjE,OAAO,EAAE,CAAC,QAAgB,EAAE,QAAgB,EAAU,EAAE,CACtD,gDAAgD,QAAQ,+BAA+B,QAAQ,IAAI;IAErG,2CAA2C;IAC3C,cAAc,EAAE,CAAC,QAAgB,EAAU,EAAE,CAC3C,gDAAgD,QAAQ,IAAI;IAE9D,8BAA8B;IAC9B,aAAa,EAAE,CAAC,QAAgB,EAAU,EAAE,CAC1C,mDAAmD,QAAQ,IAAI;CAClE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/forms/selection/super-select/|EuiSuperSelect}.
|
|
4
|
+
* `*_SELECTOR` values are CSS.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EuiSuperSelectSelectors: {
|
|
7
|
+
/**
|
|
8
|
+
* Root element (the control `<button>` carrying the consumer's
|
|
9
|
+
* `data-test-subj` — EUI spreads rest props onto it).
|
|
10
|
+
*/
|
|
11
|
+
ROOT_SELECTOR: string;
|
|
12
|
+
/**
|
|
13
|
+
* The popover wrapper around the control. The hidden form input holding the
|
|
14
|
+
* committed value is a sibling of the button inside it.
|
|
15
|
+
*/
|
|
16
|
+
WRAPPER_SELECTOR: string;
|
|
17
|
+
/**
|
|
18
|
+
* The options listbox. It renders in a popover portal, but EUI keeps at most
|
|
19
|
+
* one super-select dropdown open at a time, so a page-level lookup is safe.
|
|
20
|
+
*/
|
|
21
|
+
LISTBOX_SELECTOR: string;
|
|
22
|
+
/**
|
|
23
|
+
* The hidden form input holding the committed `value` — a direct child of
|
|
24
|
+
* the popover wrapper, scoped as such so hidden inputs a consumer might
|
|
25
|
+
* render inside prepend/append content are never matched.
|
|
26
|
+
*/
|
|
27
|
+
HIDDEN_INPUT_SELECTOR: string;
|
|
28
|
+
/**
|
|
29
|
+
* An option addressed by its `value` — EUI renders every option with
|
|
30
|
+
* `id={String(value)}`.
|
|
31
|
+
*/
|
|
32
|
+
optionByValue: (value: string) => string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Stable selectors for
|
|
10
|
+
* {@link https://eui.elastic.co/docs/components/forms/selection/super-select/|EuiSuperSelect}.
|
|
11
|
+
* `*_SELECTOR` values are CSS.
|
|
12
|
+
*/
|
|
13
|
+
export const EuiSuperSelectSelectors = {
|
|
14
|
+
/**
|
|
15
|
+
* Root element (the control `<button>` carrying the consumer's
|
|
16
|
+
* `data-test-subj` — EUI spreads rest props onto it).
|
|
17
|
+
*/
|
|
18
|
+
ROOT_SELECTOR: '.euiSuperSelectControl',
|
|
19
|
+
/**
|
|
20
|
+
* The popover wrapper around the control. The hidden form input holding the
|
|
21
|
+
* committed value is a sibling of the button inside it.
|
|
22
|
+
*/
|
|
23
|
+
WRAPPER_SELECTOR: '.euiSuperSelect',
|
|
24
|
+
/**
|
|
25
|
+
* The options listbox. It renders in a popover portal, but EUI keeps at most
|
|
26
|
+
* one super-select dropdown open at a time, so a page-level lookup is safe.
|
|
27
|
+
*/
|
|
28
|
+
LISTBOX_SELECTOR: '.euiSuperSelect__listbox[role="listbox"]',
|
|
29
|
+
/**
|
|
30
|
+
* The hidden form input holding the committed `value` — a direct child of
|
|
31
|
+
* the popover wrapper, scoped as such so hidden inputs a consumer might
|
|
32
|
+
* render inside prepend/append content are never matched.
|
|
33
|
+
*/
|
|
34
|
+
HIDDEN_INPUT_SELECTOR: ':scope > input[type="hidden"]',
|
|
35
|
+
/**
|
|
36
|
+
* An option addressed by its `value` — EUI renders every option with
|
|
37
|
+
* `id={String(value)}`.
|
|
38
|
+
*/
|
|
39
|
+
optionByValue: (value) => `[role="option"][id="${value}"]`,
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../../src/components/form/super_select/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;;OAGG;IACH,aAAa,EAAE,wBAAwB;IAEvC;;;OAGG;IACH,gBAAgB,EAAE,iBAAiB;IAEnC;;;OAGG;IACH,gBAAgB,EAAE,0CAA0C;IAE5D;;;;OAIG;IACH,qBAAqB,EAAE,+BAA+B;IAEtD;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,uBAAuB,KAAK,IAAI;CAC3E,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/display/toast/|EuiGlobalToastList}.
|
|
4
|
+
* `*_SELECTOR` values are CSS; `*_TEST_SUBJ` values are `data-test-subj` names.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EuiGlobalToastListSelectors: {
|
|
7
|
+
/** Root element (the list carrying the consumer's `data-test-subj`). */
|
|
8
|
+
ROOT_SELECTOR: string;
|
|
9
|
+
/** A toast inside the list. */
|
|
10
|
+
TOAST_SELECTOR: string;
|
|
11
|
+
CLOSE_BUTTON_TEST_SUBJ: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Stable selectors for
|
|
10
|
+
* {@link https://eui.elastic.co/docs/components/display/toast/|EuiGlobalToastList}.
|
|
11
|
+
* `*_SELECTOR` values are CSS; `*_TEST_SUBJ` values are `data-test-subj` names.
|
|
12
|
+
*/
|
|
13
|
+
export const EuiGlobalToastListSelectors = {
|
|
14
|
+
/** Root element (the list carrying the consumer's `data-test-subj`). */
|
|
15
|
+
ROOT_SELECTOR: '.euiGlobalToastList',
|
|
16
|
+
/** A toast inside the list. */
|
|
17
|
+
TOAST_SELECTOR: '.euiToast',
|
|
18
|
+
CLOSE_BUTTON_TEST_SUBJ: 'toastCloseButton',
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/toast/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,wEAAwE;IACxE,aAAa,EAAE,qBAAqB;IAEpC,+BAA+B;IAC/B,cAAc,EAAE,WAAW;IAE3B,sBAAsB,EAAE,kBAAkB;CAC3C,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { BaseObject, type ObjectScope } from './playwright/base_object';
|
|
2
2
|
export { EuiComboBoxObject } from './playwright/components/combo_box/object';
|
|
3
|
+
export { EuiDataGridObject } from './playwright/components/datagrid/object';
|
|
4
|
+
export { EuiSuperSelectObject } from './playwright/components/form/super_select/object';
|
|
5
|
+
export { EuiGlobalToastListObject } from './playwright/components/toast/object';
|
package/lib/esm/index.js
CHANGED
|
@@ -7,4 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { BaseObject } from './playwright/base_object';
|
|
9
9
|
export { EuiComboBoxObject } from './playwright/components/combo_box/object';
|
|
10
|
+
export { EuiDataGridObject } from './playwright/components/datagrid/object';
|
|
11
|
+
export { EuiSuperSelectObject } from './playwright/components/form/super_select/object';
|
|
12
|
+
export { EuiGlobalToastListObject } from './playwright/components/toast/object';
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
2
|
+
import { BaseObject, type ObjectScope } from '../../base_object';
|
|
3
|
+
/**
|
|
4
|
+
* Playwright Component Object for {@link
|
|
5
|
+
* https://eui.elastic.co/docs/components/data-grid EuiDataGrid}.
|
|
6
|
+
*
|
|
7
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
8
|
+
* `EuiDataGrid` itself (the component-type guard enforces it) — EUI toggles
|
|
9
|
+
* state classes (fullscreen) on that element. When the subj is not unique on
|
|
10
|
+
* the page (e.g. portal-rendered duplicates), narrow with the `scope`
|
|
11
|
+
* parameter instead of pointing the subj at a wrapper.
|
|
12
|
+
*/
|
|
13
|
+
export declare class EuiDataGridObject extends BaseObject {
|
|
14
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
15
|
+
/**
|
|
16
|
+
* The rows currently mounted in the DOM, as a `Locator` so callers keep
|
|
17
|
+
* Playwright auto-retry for count and content assertions
|
|
18
|
+
* (e.g. `expect(rows).toHaveCount(pageSize)`, `expect(rows).not.toHaveCount(0)`).
|
|
19
|
+
* For a paginated grid this is the current page's rows. Rows are virtualized,
|
|
20
|
+
* so on a grid too tall for its container this is only the visible window —
|
|
21
|
+
* never treat it as the full data set.
|
|
22
|
+
*/
|
|
23
|
+
get rows(): Locator;
|
|
24
|
+
/**
|
|
25
|
+
* A single data cell, addressed by row index and column id. Column order and
|
|
26
|
+
* virtualized horizontal scrolling do not affect the column id.
|
|
27
|
+
*/
|
|
28
|
+
cell(rowIndex: number, columnId: string): Locator;
|
|
29
|
+
/**
|
|
30
|
+
* All currently rendered data cells of a column. Rows are virtualized, so
|
|
31
|
+
* this is the rendered window, not necessarily every row.
|
|
32
|
+
*/
|
|
33
|
+
cells(columnId: string): Locator;
|
|
34
|
+
/**
|
|
35
|
+
* Opens the header actions of a column and clicks the given action.
|
|
36
|
+
* `columnId` is the grid column id (matched verbatim), `actionLabel` is the
|
|
37
|
+
* visible action label (e.g. 'Hide column', 'Sort A-Z').
|
|
38
|
+
*/
|
|
39
|
+
doActionOnColumn(columnId: string, actionLabel: string): Promise<void>;
|
|
40
|
+
/** Enters fullscreen mode via the toolbar button. */
|
|
41
|
+
openFullScreenMode(): Promise<void>;
|
|
42
|
+
/** Exits fullscreen mode via the toolbar button. */
|
|
43
|
+
closeFullScreenMode(): Promise<void>;
|
|
44
|
+
/** The grid element only while it carries the fullscreen state class. */
|
|
45
|
+
private get fullScreenGrid();
|
|
46
|
+
/**
|
|
47
|
+
* The fullscreen button sits in a tooltip wrapper and keeps focus after the
|
|
48
|
+
* click, which keeps the tooltip open over the grid — blur it right away.
|
|
49
|
+
*/
|
|
50
|
+
private clickFullScreenButton;
|
|
51
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseObject } from '../../base_object';
|
|
9
|
+
import { EuiDataGridSelectors } from '../../../components/datagrid/selectors';
|
|
10
|
+
/**
|
|
11
|
+
* Playwright Component Object for {@link
|
|
12
|
+
* https://eui.elastic.co/docs/components/data-grid EuiDataGrid}.
|
|
13
|
+
*
|
|
14
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
15
|
+
* `EuiDataGrid` itself (the component-type guard enforces it) — EUI toggles
|
|
16
|
+
* state classes (fullscreen) on that element. When the subj is not unique on
|
|
17
|
+
* the page (e.g. portal-rendered duplicates), narrow with the `scope`
|
|
18
|
+
* parameter instead of pointing the subj at a wrapper.
|
|
19
|
+
*/
|
|
20
|
+
export class EuiDataGridObject extends BaseObject {
|
|
21
|
+
constructor(scope, testSubj) {
|
|
22
|
+
super(scope, testSubj, EuiDataGridSelectors.ROOT_SELECTOR);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The rows currently mounted in the DOM, as a `Locator` so callers keep
|
|
26
|
+
* Playwright auto-retry for count and content assertions
|
|
27
|
+
* (e.g. `expect(rows).toHaveCount(pageSize)`, `expect(rows).not.toHaveCount(0)`).
|
|
28
|
+
* For a paginated grid this is the current page's rows. Rows are virtualized,
|
|
29
|
+
* so on a grid too tall for its container this is only the visible window —
|
|
30
|
+
* never treat it as the full data set.
|
|
31
|
+
*/
|
|
32
|
+
get rows() {
|
|
33
|
+
return this.root.locator(EuiDataGridSelectors.ROW_SELECTOR);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A single data cell, addressed by row index and column id. Column order and
|
|
37
|
+
* virtualized horizontal scrolling do not affect the column id.
|
|
38
|
+
*/
|
|
39
|
+
cell(rowIndex, columnId) {
|
|
40
|
+
return this.root.locator(EuiDataGridSelectors.cellFor(columnId, rowIndex));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* All currently rendered data cells of a column. Rows are virtualized, so
|
|
44
|
+
* this is the rendered window, not necessarily every row.
|
|
45
|
+
*/
|
|
46
|
+
cells(columnId) {
|
|
47
|
+
return this.root.locator(EuiDataGridSelectors.columnCellsFor(columnId));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Opens the header actions of a column and clicks the given action.
|
|
51
|
+
* `columnId` is the grid column id (matched verbatim), `actionLabel` is the
|
|
52
|
+
* visible action label (e.g. 'Hide column', 'Sort A-Z').
|
|
53
|
+
*/
|
|
54
|
+
async doActionOnColumn(columnId, actionLabel) {
|
|
55
|
+
const headerCell = this.root.locator(EuiDataGridSelectors.headerCellFor(columnId));
|
|
56
|
+
// The actions button only becomes interactable when the header cell is
|
|
57
|
+
// focused/hovered and inside the viewport.
|
|
58
|
+
await headerCell.scrollIntoViewIfNeeded();
|
|
59
|
+
await headerCell.focus();
|
|
60
|
+
await headerCell.hover();
|
|
61
|
+
await headerCell
|
|
62
|
+
.locator(EuiDataGridSelectors.HEADER_ACTIONS_BUTTON_SELECTOR)
|
|
63
|
+
.click();
|
|
64
|
+
const actionsMenu = this.root
|
|
65
|
+
.page()
|
|
66
|
+
.locator(EuiDataGridSelectors.headerActionsMenuFor(columnId));
|
|
67
|
+
await actionsMenu.waitFor({ state: 'visible' });
|
|
68
|
+
// Role+name query auto-escapes the label and matches the accessible name
|
|
69
|
+
// (Kibana's lint also forbids getByTitle in favor of role queries).
|
|
70
|
+
await actionsMenu
|
|
71
|
+
.getByRole('button', { name: actionLabel, exact: true })
|
|
72
|
+
.click();
|
|
73
|
+
await actionsMenu.waitFor({ state: 'hidden' });
|
|
74
|
+
}
|
|
75
|
+
/** Enters fullscreen mode via the toolbar button. */
|
|
76
|
+
async openFullScreenMode() {
|
|
77
|
+
await this.clickFullScreenButton();
|
|
78
|
+
await this.fullScreenGrid.waitFor({ state: 'visible' });
|
|
79
|
+
}
|
|
80
|
+
/** Exits fullscreen mode via the toolbar button. */
|
|
81
|
+
async closeFullScreenMode() {
|
|
82
|
+
await this.clickFullScreenButton();
|
|
83
|
+
await this.fullScreenGrid.waitFor({ state: 'detached' });
|
|
84
|
+
}
|
|
85
|
+
/** The grid element only while it carries the fullscreen state class. */
|
|
86
|
+
get fullScreenGrid() {
|
|
87
|
+
return this.root.and(this.root.page().locator(EuiDataGridSelectors.FULL_SCREEN_ROOT_SELECTOR));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The fullscreen button sits in a tooltip wrapper and keeps focus after the
|
|
91
|
+
* click, which keeps the tooltip open over the grid — blur it right away.
|
|
92
|
+
*/
|
|
93
|
+
async clickFullScreenButton() {
|
|
94
|
+
const button = this.root.getByTestId(EuiDataGridSelectors.FULL_SCREEN_BUTTON_TEST_SUBJ);
|
|
95
|
+
await button.click();
|
|
96
|
+
await button.blur();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/datagrid/object.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseObject, type ObjectScope } from '../../../base_object';
|
|
2
|
+
/**
|
|
3
|
+
* Playwright Component Object for {@link
|
|
4
|
+
* https://eui.elastic.co/docs/components/forms/selection/super-select/ EuiSuperSelect}.
|
|
5
|
+
*
|
|
6
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
7
|
+
* `<EuiSuperSelect>` — EUI spreads it onto the control `<button>`
|
|
8
|
+
* (`.euiSuperSelectControl`).
|
|
9
|
+
*/
|
|
10
|
+
export declare class EuiSuperSelectObject extends BaseObject {
|
|
11
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
12
|
+
/**
|
|
13
|
+
* Selects an option by its `value`. EUI renders every option with
|
|
14
|
+
* `id={String(value)}`, so this works for any EuiSuperSelect without extra
|
|
15
|
+
* test hooks and is the preferred method when the value is a stable code
|
|
16
|
+
* constant.
|
|
17
|
+
*/
|
|
18
|
+
selectOptionByValue(value: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Selects an option by its visible label. Use for dynamic, data-driven
|
|
21
|
+
* option content where the value is not known to the test. Note the dropdown
|
|
22
|
+
* shows `dropdownDisplay` when the consumer provides it, which can differ
|
|
23
|
+
* from the committed `inputDisplay` text.
|
|
24
|
+
*/
|
|
25
|
+
selectOptionByLabel(label: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* The committed selection's `value`, read from the hidden form input EUI
|
|
28
|
+
* renders next to the control (the visible button text shows the label, not
|
|
29
|
+
* the value).
|
|
30
|
+
*/
|
|
31
|
+
getSelectedValue(): Promise<string>;
|
|
32
|
+
/** Opens the dropdown if it is not already open. */
|
|
33
|
+
private open;
|
|
34
|
+
private get listbox();
|
|
35
|
+
/**
|
|
36
|
+
* The hidden input is a sibling of the control button; reach it through the
|
|
37
|
+
* `.euiSuperSelect` popover wrapper that contains this instance's button.
|
|
38
|
+
*/
|
|
39
|
+
private get hiddenInput();
|
|
40
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseObject } from '../../../base_object';
|
|
9
|
+
import { EuiSuperSelectSelectors } from '../../../../components/form/super_select/selectors';
|
|
10
|
+
/**
|
|
11
|
+
* Playwright Component Object for {@link
|
|
12
|
+
* https://eui.elastic.co/docs/components/forms/selection/super-select/ EuiSuperSelect}.
|
|
13
|
+
*
|
|
14
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
15
|
+
* `<EuiSuperSelect>` — EUI spreads it onto the control `<button>`
|
|
16
|
+
* (`.euiSuperSelectControl`).
|
|
17
|
+
*/
|
|
18
|
+
export class EuiSuperSelectObject extends BaseObject {
|
|
19
|
+
constructor(scope, testSubj) {
|
|
20
|
+
super(scope, testSubj, EuiSuperSelectSelectors.ROOT_SELECTOR);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Selects an option by its `value`. EUI renders every option with
|
|
24
|
+
* `id={String(value)}`, so this works for any EuiSuperSelect without extra
|
|
25
|
+
* test hooks and is the preferred method when the value is a stable code
|
|
26
|
+
* constant.
|
|
27
|
+
*/
|
|
28
|
+
async selectOptionByValue(value) {
|
|
29
|
+
await this.open();
|
|
30
|
+
await this.listbox
|
|
31
|
+
.locator(EuiSuperSelectSelectors.optionByValue(value))
|
|
32
|
+
.click();
|
|
33
|
+
await this.listbox.waitFor({ state: 'detached' });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Selects an option by its visible label. Use for dynamic, data-driven
|
|
37
|
+
* option content where the value is not known to the test. Note the dropdown
|
|
38
|
+
* shows `dropdownDisplay` when the consumer provides it, which can differ
|
|
39
|
+
* from the committed `inputDisplay` text.
|
|
40
|
+
*/
|
|
41
|
+
async selectOptionByLabel(label) {
|
|
42
|
+
await this.open();
|
|
43
|
+
await this.listbox.getByRole('option', { name: label }).click();
|
|
44
|
+
await this.listbox.waitFor({ state: 'detached' });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The committed selection's `value`, read from the hidden form input EUI
|
|
48
|
+
* renders next to the control (the visible button text shows the label, not
|
|
49
|
+
* the value).
|
|
50
|
+
*/
|
|
51
|
+
async getSelectedValue() {
|
|
52
|
+
return this.hiddenInput.inputValue();
|
|
53
|
+
}
|
|
54
|
+
/** Opens the dropdown if it is not already open. */
|
|
55
|
+
async open() {
|
|
56
|
+
if (await this.listbox.isVisible()) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
await this.root.click();
|
|
60
|
+
await this.listbox.waitFor({ state: 'visible' });
|
|
61
|
+
}
|
|
62
|
+
get listbox() {
|
|
63
|
+
return this.root.page().locator(EuiSuperSelectSelectors.LISTBOX_SELECTOR);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The hidden input is a sibling of the control button; reach it through the
|
|
67
|
+
* `.euiSuperSelect` popover wrapper that contains this instance's button.
|
|
68
|
+
*/
|
|
69
|
+
get hiddenInput() {
|
|
70
|
+
return this.scope
|
|
71
|
+
.locator(EuiSuperSelectSelectors.WRAPPER_SELECTOR)
|
|
72
|
+
.filter({ has: this.root })
|
|
73
|
+
.locator(EuiSuperSelectSelectors.HIDDEN_INPUT_SELECTOR);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../src/playwright/components/form/super_select/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CAAC,KAAa;QACrC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,OAAO;aACf,OAAO,CAAC,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aACrD,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CAAC,KAAa;QACrC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAChE,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAED,oDAAoD;IAC5C,KAAK,CAAC,IAAI;QAChB,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,IAAY,OAAO;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACH,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,KAAK;aACd,OAAO,CAAC,uBAAuB,CAAC,gBAAgB,CAAC;aACjD,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,OAAO,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Locator } from '@playwright/test';
|
|
2
|
+
import { BaseObject, type ObjectScope } from '../../base_object';
|
|
3
|
+
/**
|
|
4
|
+
* Playwright Component Object for {@link
|
|
5
|
+
* https://eui.elastic.co/docs/components/display/toast/ EuiGlobalToastList}.
|
|
6
|
+
*
|
|
7
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
8
|
+
* `<EuiGlobalToastList>` (the `.euiGlobalToastList` element). Toasts rendered
|
|
9
|
+
* outside the list (inline `EuiToast`) are not covered.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EuiGlobalToastListObject extends BaseObject {
|
|
12
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
13
|
+
/**
|
|
14
|
+
* The toasts currently in the list. Exposed as a `Locator` so callers keep
|
|
15
|
+
* Playwright auto-retry for count and content assertions
|
|
16
|
+
* (e.g. `expect(toasts).toHaveCount(1)`).
|
|
17
|
+
*/
|
|
18
|
+
get toasts(): Locator;
|
|
19
|
+
/**
|
|
20
|
+
* Closes every toast in the list and waits until none remain. No-op when the
|
|
21
|
+
* list is empty (dismissing "if present" is a common teardown need).
|
|
22
|
+
*/
|
|
23
|
+
closeAll(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { expect } from '@playwright/test';
|
|
9
|
+
import { BaseObject } from '../../base_object';
|
|
10
|
+
import { EuiGlobalToastListSelectors } from '../../../components/toast/selectors';
|
|
11
|
+
/**
|
|
12
|
+
* Playwright Component Object for {@link
|
|
13
|
+
* https://eui.elastic.co/docs/components/display/toast/ EuiGlobalToastList}.
|
|
14
|
+
*
|
|
15
|
+
* `testSubj` must match the `data-test-subj` set by the consumer on the
|
|
16
|
+
* `<EuiGlobalToastList>` (the `.euiGlobalToastList` element). Toasts rendered
|
|
17
|
+
* outside the list (inline `EuiToast`) are not covered.
|
|
18
|
+
*/
|
|
19
|
+
export class EuiGlobalToastListObject extends BaseObject {
|
|
20
|
+
constructor(scope, testSubj) {
|
|
21
|
+
super(scope, testSubj, EuiGlobalToastListSelectors.ROOT_SELECTOR);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The toasts currently in the list. Exposed as a `Locator` so callers keep
|
|
25
|
+
* Playwright auto-retry for count and content assertions
|
|
26
|
+
* (e.g. `expect(toasts).toHaveCount(1)`).
|
|
27
|
+
*/
|
|
28
|
+
get toasts() {
|
|
29
|
+
return this.root.locator(EuiGlobalToastListSelectors.TOAST_SELECTOR);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Closes every toast in the list and waits until none remain. No-op when the
|
|
33
|
+
* list is empty (dismissing "if present" is a common teardown need).
|
|
34
|
+
*/
|
|
35
|
+
async closeAll() {
|
|
36
|
+
const closeButtons = await this.root
|
|
37
|
+
.getByTestId(EuiGlobalToastListSelectors.CLOSE_BUTTON_TEST_SUBJ)
|
|
38
|
+
.all();
|
|
39
|
+
for (const closeButton of closeButtons) {
|
|
40
|
+
// A toast may auto-dismiss while iterating; ignore clicks that miss.
|
|
41
|
+
await closeButton.click({ timeout: 5000 }).catch(() => { });
|
|
42
|
+
}
|
|
43
|
+
await expect(this.toasts).toHaveCount(0);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/toast/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAgB,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,2BAA2B,CAAC,aAAa,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,cAAc,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,IAAI;aACjC,WAAW,CAAC,2BAA2B,CAAC,sBAAsB,CAAC;aAC/D,GAAG,EAAE,CAAC;QACT,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,qEAAqE;YACrE,MAAM,WAAW,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
package/lib/esm/selectors.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export { EuiComboBoxSelectors } from './components/combo_box/selectors';
|
|
2
|
+
export { EuiDataGridSelectors } from './components/datagrid/selectors';
|
|
3
|
+
export { EuiSuperSelectSelectors } from './components/form/super_select/selectors';
|
|
4
|
+
export { EuiGlobalToastListSelectors } from './components/toast/selectors';
|
package/lib/esm/selectors.js
CHANGED
|
@@ -6,4 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
export { EuiComboBoxSelectors } from './components/combo_box/selectors';
|
|
9
|
+
export { EuiDataGridSelectors } from './components/datagrid/selectors';
|
|
10
|
+
export { EuiSuperSelectSelectors } from './components/form/super_select/selectors';
|
|
11
|
+
export { EuiGlobalToastListSelectors } from './components/toast/selectors';
|
|
9
12
|
//# sourceMappingURL=selectors.js.map
|
package/lib/esm/selectors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
|