@elastic/eui 62.0.1 → 62.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/comment_list/comment_event.js +22 -28
- package/es/components/comment_list/comment_event.styles.js +15 -16
- package/es/test/rtl/component_helpers.d.ts +7 -0
- package/es/test/rtl/component_helpers.js +72 -0
- package/es/test/rtl/custom_render.d.ts +74 -0
- package/es/test/rtl/custom_render.js +52 -0
- package/es/test/rtl/data_test_subj_queries.d.ts +5 -0
- package/es/test/rtl/data_test_subj_queries.js +46 -0
- package/es/test/rtl/index.d.ts +3 -0
- package/es/test/rtl/index.js +10 -0
- package/eui.d.ts +86 -4
- package/lib/components/comment_list/comment_event.js +29 -26
- package/lib/components/comment_list/comment_event.styles.js +15 -16
- package/lib/test/rtl/component_helpers.d.ts +7 -0
- package/lib/test/rtl/component_helpers.js +77 -0
- package/lib/test/rtl/custom_render.d.ts +74 -0
- package/lib/test/rtl/custom_render.js +60 -0
- package/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
- package/lib/test/rtl/data_test_subj_queries.js +52 -0
- package/lib/test/rtl/index.d.ts +3 -0
- package/lib/test/rtl/index.js +81 -0
- package/optimize/es/components/comment_list/comment_event.js +22 -28
- package/optimize/es/components/comment_list/comment_event.styles.js +15 -16
- package/optimize/es/test/rtl/component_helpers.d.ts +7 -0
- package/optimize/es/test/rtl/component_helpers.js +71 -0
- package/optimize/es/test/rtl/custom_render.d.ts +74 -0
- package/optimize/es/test/rtl/custom_render.js +48 -0
- package/optimize/es/test/rtl/data_test_subj_queries.d.ts +5 -0
- package/optimize/es/test/rtl/data_test_subj_queries.js +36 -0
- package/optimize/es/test/rtl/index.d.ts +3 -0
- package/optimize/es/test/rtl/index.js +10 -0
- package/optimize/lib/components/comment_list/comment_event.js +22 -26
- package/optimize/lib/components/comment_list/comment_event.styles.js +15 -16
- package/optimize/lib/test/rtl/component_helpers.d.ts +7 -0
- package/optimize/lib/test/rtl/component_helpers.js +87 -0
- package/optimize/lib/test/rtl/custom_render.d.ts +74 -0
- package/optimize/lib/test/rtl/custom_render.js +59 -0
- package/optimize/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
- package/optimize/lib/test/rtl/data_test_subj_queries.js +51 -0
- package/optimize/lib/test/rtl/index.d.ts +3 -0
- package/optimize/lib/test/rtl/index.js +81 -0
- package/package.json +7 -1
- package/test-env/components/comment_list/comment_event.js +22 -26
- package/test-env/components/comment_list/comment_event.styles.js +15 -16
- package/test-env/test/rtl/component_helpers.js +87 -0
- package/test-env/test/rtl/custom_render.js +59 -0
- package/test-env/test/rtl/data_test_subj_queries.js +51 -0
- package/test-env/test/rtl/index.js +81 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { queries, RenderOptions, Screen } from '@testing-library/react';
|
|
3
|
+
import * as dataTestSubjQueries from './data_test_subj_queries';
|
|
4
|
+
/**
|
|
5
|
+
* Custom render() fn with EuiProvider and query helpers
|
|
6
|
+
*
|
|
7
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#custom-render
|
|
8
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
|
|
9
|
+
*/
|
|
10
|
+
declare const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
|
|
11
|
+
getByLabelText: typeof queries.getByLabelText;
|
|
12
|
+
getAllByLabelText: typeof queries.getAllByLabelText;
|
|
13
|
+
queryByLabelText: typeof queries.queryByLabelText;
|
|
14
|
+
queryAllByLabelText: typeof queries.queryAllByLabelText;
|
|
15
|
+
findByLabelText: typeof queries.findByLabelText;
|
|
16
|
+
findAllByLabelText: typeof queries.findAllByLabelText;
|
|
17
|
+
getByPlaceholderText: typeof queries.getByPlaceholderText;
|
|
18
|
+
getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
|
|
19
|
+
queryByPlaceholderText: typeof queries.queryByPlaceholderText;
|
|
20
|
+
queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
|
|
21
|
+
findByPlaceholderText: typeof queries.findByPlaceholderText;
|
|
22
|
+
findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
|
|
23
|
+
getByText: typeof queries.getByText;
|
|
24
|
+
getAllByText: typeof queries.getAllByText;
|
|
25
|
+
queryByText: typeof queries.queryByText;
|
|
26
|
+
queryAllByText: typeof queries.queryAllByText;
|
|
27
|
+
findByText: typeof queries.findByText;
|
|
28
|
+
findAllByText: typeof queries.findAllByText;
|
|
29
|
+
getByAltText: typeof queries.getByAltText;
|
|
30
|
+
getAllByAltText: typeof queries.getAllByAltText;
|
|
31
|
+
queryByAltText: typeof queries.queryByAltText;
|
|
32
|
+
queryAllByAltText: typeof queries.queryAllByAltText;
|
|
33
|
+
findByAltText: typeof queries.findByAltText;
|
|
34
|
+
findAllByAltText: typeof queries.findAllByAltText;
|
|
35
|
+
getByTitle: typeof queries.getByTitle;
|
|
36
|
+
getAllByTitle: typeof queries.getAllByTitle;
|
|
37
|
+
queryByTitle: typeof queries.queryByTitle;
|
|
38
|
+
queryAllByTitle: typeof queries.queryAllByTitle;
|
|
39
|
+
findByTitle: typeof queries.findByTitle;
|
|
40
|
+
findAllByTitle: typeof queries.findAllByTitle;
|
|
41
|
+
getByDisplayValue: typeof queries.getByDisplayValue;
|
|
42
|
+
getAllByDisplayValue: typeof queries.getAllByDisplayValue;
|
|
43
|
+
queryByDisplayValue: typeof queries.queryByDisplayValue;
|
|
44
|
+
queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
|
|
45
|
+
findByDisplayValue: typeof queries.findByDisplayValue;
|
|
46
|
+
findAllByDisplayValue: typeof queries.findAllByDisplayValue;
|
|
47
|
+
getByRole: typeof queries.getByRole;
|
|
48
|
+
getAllByRole: typeof queries.getAllByRole;
|
|
49
|
+
queryByRole: typeof queries.queryByRole;
|
|
50
|
+
queryAllByRole: typeof queries.queryAllByRole;
|
|
51
|
+
findByRole: typeof queries.findByRole;
|
|
52
|
+
findAllByRole: typeof queries.findAllByRole;
|
|
53
|
+
getByTestId: typeof queries.getByTestId;
|
|
54
|
+
getAllByTestId: typeof queries.getAllByTestId;
|
|
55
|
+
queryByTestId: typeof queries.queryByTestId;
|
|
56
|
+
queryAllByTestId: typeof queries.queryAllByTestId;
|
|
57
|
+
findByTestId: typeof queries.findByTestId;
|
|
58
|
+
findAllByTestId: typeof queries.findAllByTestId;
|
|
59
|
+
queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
|
|
60
|
+
queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
61
|
+
getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
|
|
62
|
+
getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
|
|
63
|
+
findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
|
|
64
|
+
findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
|
|
65
|
+
}, HTMLElement, HTMLElement>;
|
|
66
|
+
export { customRender as render };
|
|
67
|
+
/**
|
|
68
|
+
* Custom screen util with EUI query helpers
|
|
69
|
+
*
|
|
70
|
+
* @see https://testing-library.com/docs/queries/about/#screen
|
|
71
|
+
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
72
|
+
*/
|
|
73
|
+
declare const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
|
|
74
|
+
export { customScreen as screen };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["queries"];
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
import { queries, render, screen, within } from '@testing-library/react';
|
|
17
|
+
import { EuiProvider } from '../../components';
|
|
18
|
+
import * as dataTestSubjQueries from './data_test_subj_queries';
|
|
19
|
+
/**
|
|
20
|
+
* Custom render() fn with EuiProvider and query helpers
|
|
21
|
+
*
|
|
22
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#custom-render
|
|
23
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var customRender = function customRender(ui) {
|
|
27
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
+
|
|
29
|
+
var renderQueries = _ref.queries,
|
|
30
|
+
options = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
|
|
32
|
+
return render(ui, _objectSpread({
|
|
33
|
+
queries: _objectSpread(_objectSpread(_objectSpread({}, queries), dataTestSubjQueries), renderQueries || {}),
|
|
34
|
+
wrapper: EuiProvider
|
|
35
|
+
}, options));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { customRender as render };
|
|
39
|
+
/**
|
|
40
|
+
* Custom screen util with EUI query helpers
|
|
41
|
+
*
|
|
42
|
+
* @see https://testing-library.com/docs/queries/about/#screen
|
|
43
|
+
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
|
|
47
|
+
|
|
48
|
+
export { customScreen as screen };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Matcher, MatcherOptions } from '@testing-library/react';
|
|
2
|
+
import { queryHelpers } from '@testing-library/react';
|
|
3
|
+
declare const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[];
|
|
4
|
+
declare const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
|
|
5
|
+
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import { queryHelpers, buildQueries } from '@testing-library/react';
|
|
11
|
+
|
|
12
|
+
var queryAllByTestSubject = function queryAllByTestSubject() {
|
|
13
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
args[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return queryHelpers.queryAllByAttribute.apply(queryHelpers, ['data-test-subj'].concat(args));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var getMultipleError = function getMultipleError(_, TestSubjectValue) {
|
|
21
|
+
return "Found multiple elements with the data-test-subj attribute of: ".concat(TestSubjectValue);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var getMissingError = function getMissingError(_, TestSubjectValue) {
|
|
25
|
+
return "Unable to find an element with the data-test-subj attribute of: ".concat(TestSubjectValue);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var _buildQueries = buildQueries(queryAllByTestSubject, getMultipleError, getMissingError),
|
|
29
|
+
_buildQueries2 = _slicedToArray(_buildQueries, 5),
|
|
30
|
+
queryByTestSubject = _buildQueries2[0],
|
|
31
|
+
getAllByTestSubject = _buildQueries2[1],
|
|
32
|
+
getByTestSubject = _buildQueries2[2],
|
|
33
|
+
findAllByTestSubject = _buildQueries2[3],
|
|
34
|
+
findByTestSubject = _buildQueries2[4];
|
|
35
|
+
|
|
36
|
+
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject };
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './component_helpers';
|
|
9
|
+
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject } from './data_test_subj_queries';
|
|
10
|
+
export { render, screen } from './custom_render';
|
|
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiCommentEvent = void 0;
|
|
9
9
|
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
13
11
|
|
|
14
12
|
var _services = require("../../services");
|
|
@@ -60,14 +58,6 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
|
|
|
60
58
|
var cssStyles = [styles.euiCommentEvent, styles[type]];
|
|
61
59
|
var headerStyles = (0, _comment_event.euiCommentEventHeaderStyles)(euiTheme);
|
|
62
60
|
var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
|
|
63
|
-
var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
|
|
64
|
-
var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
|
|
65
|
-
var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
|
|
66
|
-
var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
|
|
67
|
-
var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
|
|
68
|
-
var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
|
|
69
|
-
var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
|
|
70
|
-
var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
|
|
71
61
|
var bodyStyles = (0, _comment_event.euiCommentEventBodyStyles)(euiTheme);
|
|
72
62
|
var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
|
|
73
63
|
var isFigure = isTypeRegular;
|
|
@@ -83,34 +73,40 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
|
|
|
83
73
|
color: 'transparent',
|
|
84
74
|
paddingSize: 'none'
|
|
85
75
|
};
|
|
86
|
-
|
|
76
|
+
return (0, _react2.jsx)(Element, {
|
|
77
|
+
className: classes,
|
|
78
|
+
css: cssStyles,
|
|
79
|
+
"data-type": type
|
|
80
|
+
}, hasEventElements && (0, _react2.jsx)(HeaderElement, {
|
|
81
|
+
className: "euiCommentEvent__header",
|
|
87
82
|
css: cssHeaderStyles
|
|
88
|
-
}, (0, _react2.jsx)(_panel.EuiPanel, (0,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
css: cssHeaderMainStyles
|
|
83
|
+
}, (0, _react2.jsx)(_panel.EuiPanel, panelProps, (0, _react2.jsx)("div", {
|
|
84
|
+
className: "euiCommentEvent__headerMain",
|
|
85
|
+
css: headerStyles.euiCommentEvent__headerMain
|
|
92
86
|
}, (0, _react2.jsx)("div", {
|
|
93
|
-
|
|
87
|
+
className: "euiCommentEvent__headerData",
|
|
88
|
+
css: headerStyles.euiCommentEvent__headerData
|
|
94
89
|
}, eventIcon && (0, _react2.jsx)(_avatar.EuiAvatar, {
|
|
95
|
-
|
|
90
|
+
className: "euiCommentEvent__headerEventIcon",
|
|
91
|
+
css: headerStyles.euiCommentEvent__headerEventIcon,
|
|
96
92
|
size: "s",
|
|
97
93
|
iconType: eventIcon,
|
|
98
94
|
name: eventIconAriaLabel ? eventIconAriaLabel : '',
|
|
99
95
|
color: "subdued",
|
|
100
96
|
"aria-hidden": !eventIconAriaLabel
|
|
101
97
|
}), username && (0, _react2.jsx)("div", {
|
|
102
|
-
|
|
98
|
+
className: "euiCommentEvent__headerUsername",
|
|
99
|
+
css: headerStyles.euiCommentEvent__headerUsername
|
|
103
100
|
}, username), event && (0, _react2.jsx)("div", {
|
|
104
|
-
|
|
101
|
+
className: "euiCommentEvent__headerEvent",
|
|
102
|
+
css: headerStyles.euiCommentEvent__headerEvent
|
|
105
103
|
}, event), timestamp && (0, _react2.jsx)("div", {
|
|
106
|
-
|
|
104
|
+
className: "euiCommentEvent__headerTimestamp"
|
|
107
105
|
}, (0, _react2.jsx)("time", null, timestamp))), actions && (0, _react2.jsx)("div", {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
className:
|
|
112
|
-
css: cssStyles
|
|
113
|
-
}, hasEventElements && eventHeader, children && (0, _react2.jsx)("div", {
|
|
106
|
+
className: "euiCommentEvent__headerActions",
|
|
107
|
+
css: headerStyles.euiCommentEvent__headerActions
|
|
108
|
+
}, actions)))), children && (0, _react2.jsx)("div", {
|
|
109
|
+
className: "euiCommentEvent__body",
|
|
114
110
|
css: cssBodyStyles
|
|
115
111
|
}, children));
|
|
116
112
|
};
|
|
@@ -34,20 +34,20 @@ var euiCommentEventStyles = function euiCommentEventStyles(_ref4) {
|
|
|
34
34
|
exports.euiCommentEventStyles = euiCommentEventStyles;
|
|
35
35
|
|
|
36
36
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
37
|
-
name: "
|
|
38
|
-
styles: "
|
|
37
|
+
name: "ui5tce-euiCommentEvent__headerEvent",
|
|
38
|
+
styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
|
|
39
39
|
} : {
|
|
40
|
-
name: "
|
|
41
|
-
styles: "
|
|
40
|
+
name: "ui5tce-euiCommentEvent__headerEvent",
|
|
41
|
+
styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
|
|
42
42
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
46
|
-
name: "
|
|
47
|
-
styles: "
|
|
46
|
+
name: "bqgcpj-hasEventColor",
|
|
47
|
+
styles: "padding:0;label:hasEventColor;"
|
|
48
48
|
} : {
|
|
49
|
-
name: "
|
|
50
|
-
styles: "
|
|
49
|
+
name: "bqgcpj-hasEventColor",
|
|
50
|
+
styles: "padding:0;label:hasEventColor;",
|
|
51
51
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -55,18 +55,17 @@ var euiCommentEventHeaderStyles = function euiCommentEventHeaderStyles(_ref5) {
|
|
|
55
55
|
var euiTheme = _ref5.euiTheme;
|
|
56
56
|
return {
|
|
57
57
|
euiCommentEvent__header: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__header;"),
|
|
58
|
-
|
|
58
|
+
// types
|
|
59
|
+
regular: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
|
|
60
|
+
// variants
|
|
61
|
+
hasEventColor: _ref2,
|
|
62
|
+
// Children
|
|
59
63
|
euiCommentEvent__headerMain: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;gap:", euiTheme.size.s, ";;label:euiCommentEvent__headerMain;"),
|
|
60
64
|
euiCommentEvent__headerData: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;align-items:center;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerData;"),
|
|
61
65
|
euiCommentEvent__headerEventIcon: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";;label:euiCommentEvent__headerEventIcon;"),
|
|
62
66
|
euiCommentEvent__headerUsername: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.semiBold, ";;label:euiCommentEvent__headerUsername;"),
|
|
63
|
-
euiCommentEvent__headerEvent:
|
|
64
|
-
|
|
65
|
-
euiCommentEvent__headerActions: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;"),
|
|
66
|
-
// types
|
|
67
|
-
regular: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
|
|
68
|
-
// variants
|
|
69
|
-
hasEventColor: _ref
|
|
67
|
+
euiCommentEvent__headerEvent: _ref,
|
|
68
|
+
euiCommentEvent__headerActions: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;")
|
|
70
69
|
};
|
|
71
70
|
};
|
|
72
71
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure the EuiPopover being tested is open/closed before contiuning
|
|
3
|
+
* Note: Because EuiPopover is portalled, we want to query `document`
|
|
4
|
+
* instead of the `container` returned by RTL's render()
|
|
5
|
+
*/
|
|
6
|
+
export declare const waitForEuiPopoverOpen: () => Promise<void>;
|
|
7
|
+
export declare const waitForEuiPopoverClose: () => Promise<void>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.waitForEuiPopoverOpen = exports.waitForEuiPopoverClose = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _react = require("@testing-library/react");
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
19
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
20
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
21
|
+
* Side Public License, v 1.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Ensure the EuiPopover being tested is open/closed before contiuning
|
|
26
|
+
* Note: Because EuiPopover is portalled, we want to query `document`
|
|
27
|
+
* instead of the `container` returned by RTL's render()
|
|
28
|
+
*/
|
|
29
|
+
var waitForEuiPopoverOpen = /*#__PURE__*/function () {
|
|
30
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
31
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
32
|
+
while (1) {
|
|
33
|
+
switch (_context.prev = _context.next) {
|
|
34
|
+
case 0:
|
|
35
|
+
_context.next = 2;
|
|
36
|
+
return (0, _react.waitFor)(function () {
|
|
37
|
+
var openPopover = document.querySelector('[data-popover-open]');
|
|
38
|
+
expect(openPopover).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
case 2:
|
|
42
|
+
return _context.abrupt("return", _context.sent);
|
|
43
|
+
|
|
44
|
+
case 3:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, _callee);
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
return function waitForEuiPopoverOpen() {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}();
|
|
56
|
+
|
|
57
|
+
exports.waitForEuiPopoverOpen = waitForEuiPopoverOpen;
|
|
58
|
+
|
|
59
|
+
var waitForEuiPopoverClose = /*#__PURE__*/function () {
|
|
60
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
61
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
_context2.next = 2;
|
|
66
|
+
return (0, _react.waitFor)(function () {
|
|
67
|
+
var openPopover = document.querySelector('[data-popover-open]');
|
|
68
|
+
expect(openPopover).toBeFalsy();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
case 2:
|
|
72
|
+
return _context2.abrupt("return", _context2.sent);
|
|
73
|
+
|
|
74
|
+
case 3:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context2.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
return function waitForEuiPopoverClose() {
|
|
83
|
+
return _ref2.apply(this, arguments);
|
|
84
|
+
};
|
|
85
|
+
}();
|
|
86
|
+
|
|
87
|
+
exports.waitForEuiPopoverClose = waitForEuiPopoverClose;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { queries, RenderOptions, Screen } from '@testing-library/react';
|
|
3
|
+
import * as dataTestSubjQueries from './data_test_subj_queries';
|
|
4
|
+
/**
|
|
5
|
+
* Custom render() fn with EuiProvider and query helpers
|
|
6
|
+
*
|
|
7
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#custom-render
|
|
8
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
|
|
9
|
+
*/
|
|
10
|
+
declare const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
|
|
11
|
+
getByLabelText: typeof queries.getByLabelText;
|
|
12
|
+
getAllByLabelText: typeof queries.getAllByLabelText;
|
|
13
|
+
queryByLabelText: typeof queries.queryByLabelText;
|
|
14
|
+
queryAllByLabelText: typeof queries.queryAllByLabelText;
|
|
15
|
+
findByLabelText: typeof queries.findByLabelText;
|
|
16
|
+
findAllByLabelText: typeof queries.findAllByLabelText;
|
|
17
|
+
getByPlaceholderText: typeof queries.getByPlaceholderText;
|
|
18
|
+
getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
|
|
19
|
+
queryByPlaceholderText: typeof queries.queryByPlaceholderText;
|
|
20
|
+
queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
|
|
21
|
+
findByPlaceholderText: typeof queries.findByPlaceholderText;
|
|
22
|
+
findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
|
|
23
|
+
getByText: typeof queries.getByText;
|
|
24
|
+
getAllByText: typeof queries.getAllByText;
|
|
25
|
+
queryByText: typeof queries.queryByText;
|
|
26
|
+
queryAllByText: typeof queries.queryAllByText;
|
|
27
|
+
findByText: typeof queries.findByText;
|
|
28
|
+
findAllByText: typeof queries.findAllByText;
|
|
29
|
+
getByAltText: typeof queries.getByAltText;
|
|
30
|
+
getAllByAltText: typeof queries.getAllByAltText;
|
|
31
|
+
queryByAltText: typeof queries.queryByAltText;
|
|
32
|
+
queryAllByAltText: typeof queries.queryAllByAltText;
|
|
33
|
+
findByAltText: typeof queries.findByAltText;
|
|
34
|
+
findAllByAltText: typeof queries.findAllByAltText;
|
|
35
|
+
getByTitle: typeof queries.getByTitle;
|
|
36
|
+
getAllByTitle: typeof queries.getAllByTitle;
|
|
37
|
+
queryByTitle: typeof queries.queryByTitle;
|
|
38
|
+
queryAllByTitle: typeof queries.queryAllByTitle;
|
|
39
|
+
findByTitle: typeof queries.findByTitle;
|
|
40
|
+
findAllByTitle: typeof queries.findAllByTitle;
|
|
41
|
+
getByDisplayValue: typeof queries.getByDisplayValue;
|
|
42
|
+
getAllByDisplayValue: typeof queries.getAllByDisplayValue;
|
|
43
|
+
queryByDisplayValue: typeof queries.queryByDisplayValue;
|
|
44
|
+
queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
|
|
45
|
+
findByDisplayValue: typeof queries.findByDisplayValue;
|
|
46
|
+
findAllByDisplayValue: typeof queries.findAllByDisplayValue;
|
|
47
|
+
getByRole: typeof queries.getByRole;
|
|
48
|
+
getAllByRole: typeof queries.getAllByRole;
|
|
49
|
+
queryByRole: typeof queries.queryByRole;
|
|
50
|
+
queryAllByRole: typeof queries.queryAllByRole;
|
|
51
|
+
findByRole: typeof queries.findByRole;
|
|
52
|
+
findAllByRole: typeof queries.findAllByRole;
|
|
53
|
+
getByTestId: typeof queries.getByTestId;
|
|
54
|
+
getAllByTestId: typeof queries.getAllByTestId;
|
|
55
|
+
queryByTestId: typeof queries.queryByTestId;
|
|
56
|
+
queryAllByTestId: typeof queries.queryAllByTestId;
|
|
57
|
+
findByTestId: typeof queries.findByTestId;
|
|
58
|
+
findAllByTestId: typeof queries.findAllByTestId;
|
|
59
|
+
queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
|
|
60
|
+
queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
61
|
+
getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
|
|
62
|
+
getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
|
|
63
|
+
findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
|
|
64
|
+
findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
|
|
65
|
+
}, HTMLElement, HTMLElement>;
|
|
66
|
+
export { customRender as render };
|
|
67
|
+
/**
|
|
68
|
+
* Custom screen util with EUI query helpers
|
|
69
|
+
*
|
|
70
|
+
* @see https://testing-library.com/docs/queries/about/#screen
|
|
71
|
+
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
72
|
+
*/
|
|
73
|
+
declare const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
|
|
74
|
+
export { customScreen as screen };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.screen = exports.render = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _react = require("@testing-library/react");
|
|
17
|
+
|
|
18
|
+
var _components = require("../../components");
|
|
19
|
+
|
|
20
|
+
var dataTestSubjQueries = _interopRequireWildcard(require("./data_test_subj_queries"));
|
|
21
|
+
|
|
22
|
+
var _excluded = ["queries"];
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Custom render() fn with EuiProvider and query helpers
|
|
34
|
+
*
|
|
35
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#custom-render
|
|
36
|
+
* @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
|
|
37
|
+
*/
|
|
38
|
+
var customRender = function customRender(ui) {
|
|
39
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
|
+
|
|
41
|
+
var renderQueries = _ref.queries,
|
|
42
|
+
options = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
43
|
+
return (0, _react.render)(ui, _objectSpread({
|
|
44
|
+
queries: _objectSpread(_objectSpread(_objectSpread({}, _react.queries), dataTestSubjQueries), renderQueries || {}),
|
|
45
|
+
wrapper: _components.EuiProvider
|
|
46
|
+
}, options));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.render = customRender;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Custom screen util with EUI query helpers
|
|
53
|
+
*
|
|
54
|
+
* @see https://testing-library.com/docs/queries/about/#screen
|
|
55
|
+
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
56
|
+
*/
|
|
57
|
+
var customScreen = _objectSpread(_objectSpread({}, _react.screen), (0, _react.within)(document.body, dataTestSubjQueries));
|
|
58
|
+
|
|
59
|
+
exports.screen = customScreen;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Matcher, MatcherOptions } from '@testing-library/react';
|
|
2
|
+
import { queryHelpers } from '@testing-library/react';
|
|
3
|
+
declare const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[];
|
|
4
|
+
declare const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
|
|
5
|
+
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.queryByTestSubject = exports.queryAllByTestSubject = exports.getByTestSubject = exports.getAllByTestSubject = exports.findByTestSubject = exports.findAllByTestSubject = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = require("@testing-library/react");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
var queryAllByTestSubject = function queryAllByTestSubject() {
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _react.queryHelpers.queryAllByAttribute.apply(_react.queryHelpers, ['data-test-subj'].concat(args));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.queryAllByTestSubject = queryAllByTestSubject;
|
|
30
|
+
|
|
31
|
+
var getMultipleError = function getMultipleError(_, TestSubjectValue) {
|
|
32
|
+
return "Found multiple elements with the data-test-subj attribute of: ".concat(TestSubjectValue);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getMissingError = function getMissingError(_, TestSubjectValue) {
|
|
36
|
+
return "Unable to find an element with the data-test-subj attribute of: ".concat(TestSubjectValue);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var _buildQueries = (0, _react.buildQueries)(queryAllByTestSubject, getMultipleError, getMissingError),
|
|
40
|
+
_buildQueries2 = (0, _slicedToArray2.default)(_buildQueries, 5),
|
|
41
|
+
queryByTestSubject = _buildQueries2[0],
|
|
42
|
+
getAllByTestSubject = _buildQueries2[1],
|
|
43
|
+
getByTestSubject = _buildQueries2[2],
|
|
44
|
+
findAllByTestSubject = _buildQueries2[3],
|
|
45
|
+
findByTestSubject = _buildQueries2[4];
|
|
46
|
+
|
|
47
|
+
exports.findByTestSubject = findByTestSubject;
|
|
48
|
+
exports.findAllByTestSubject = findAllByTestSubject;
|
|
49
|
+
exports.getByTestSubject = getByTestSubject;
|
|
50
|
+
exports.getAllByTestSubject = getAllByTestSubject;
|
|
51
|
+
exports.queryByTestSubject = queryByTestSubject;
|