@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.
Files changed (48) hide show
  1. package/es/components/comment_list/comment_event.js +22 -28
  2. package/es/components/comment_list/comment_event.styles.js +15 -16
  3. package/es/test/rtl/component_helpers.d.ts +7 -0
  4. package/es/test/rtl/component_helpers.js +72 -0
  5. package/es/test/rtl/custom_render.d.ts +74 -0
  6. package/es/test/rtl/custom_render.js +52 -0
  7. package/es/test/rtl/data_test_subj_queries.d.ts +5 -0
  8. package/es/test/rtl/data_test_subj_queries.js +46 -0
  9. package/es/test/rtl/index.d.ts +3 -0
  10. package/es/test/rtl/index.js +10 -0
  11. package/eui.d.ts +86 -4
  12. package/lib/components/comment_list/comment_event.js +29 -26
  13. package/lib/components/comment_list/comment_event.styles.js +15 -16
  14. package/lib/test/rtl/component_helpers.d.ts +7 -0
  15. package/lib/test/rtl/component_helpers.js +77 -0
  16. package/lib/test/rtl/custom_render.d.ts +74 -0
  17. package/lib/test/rtl/custom_render.js +60 -0
  18. package/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
  19. package/lib/test/rtl/data_test_subj_queries.js +52 -0
  20. package/lib/test/rtl/index.d.ts +3 -0
  21. package/lib/test/rtl/index.js +81 -0
  22. package/optimize/es/components/comment_list/comment_event.js +22 -28
  23. package/optimize/es/components/comment_list/comment_event.styles.js +15 -16
  24. package/optimize/es/test/rtl/component_helpers.d.ts +7 -0
  25. package/optimize/es/test/rtl/component_helpers.js +71 -0
  26. package/optimize/es/test/rtl/custom_render.d.ts +74 -0
  27. package/optimize/es/test/rtl/custom_render.js +48 -0
  28. package/optimize/es/test/rtl/data_test_subj_queries.d.ts +5 -0
  29. package/optimize/es/test/rtl/data_test_subj_queries.js +36 -0
  30. package/optimize/es/test/rtl/index.d.ts +3 -0
  31. package/optimize/es/test/rtl/index.js +10 -0
  32. package/optimize/lib/components/comment_list/comment_event.js +22 -26
  33. package/optimize/lib/components/comment_list/comment_event.styles.js +15 -16
  34. package/optimize/lib/test/rtl/component_helpers.d.ts +7 -0
  35. package/optimize/lib/test/rtl/component_helpers.js +87 -0
  36. package/optimize/lib/test/rtl/custom_render.d.ts +74 -0
  37. package/optimize/lib/test/rtl/custom_render.js +59 -0
  38. package/optimize/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
  39. package/optimize/lib/test/rtl/data_test_subj_queries.js +51 -0
  40. package/optimize/lib/test/rtl/index.d.ts +3 -0
  41. package/optimize/lib/test/rtl/index.js +81 -0
  42. package/package.json +7 -1
  43. package/test-env/components/comment_list/comment_event.js +22 -26
  44. package/test-env/components/comment_list/comment_event.styles.js +15 -16
  45. package/test-env/test/rtl/component_helpers.js +87 -0
  46. package/test-env/test/rtl/custom_render.js +59 -0
  47. package/test-env/test/rtl/data_test_subj_queries.js +51 -0
  48. package/test-env/test/rtl/index.js +81 -0
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /*
4
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -45,14 +43,6 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
45
43
  var cssStyles = [styles.euiCommentEvent, styles[type]];
46
44
  var headerStyles = euiCommentEventHeaderStyles(euiTheme);
47
45
  var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
48
- var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
49
- var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
50
- var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
51
- var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
52
- var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
53
- var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
54
- var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
55
- var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
56
46
  var bodyStyles = euiCommentEventBodyStyles(euiTheme);
57
47
  var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
58
48
  var isFigure = isTypeRegular;
@@ -68,36 +58,40 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
68
58
  color: 'transparent',
69
59
  paddingSize: 'none'
70
60
  };
71
-
72
- var eventHeader = ___EmotionJSX(HeaderElement, {
61
+ return ___EmotionJSX(Element, {
62
+ className: classes,
63
+ css: cssStyles,
64
+ "data-type": type
65
+ }, hasEventElements && ___EmotionJSX(HeaderElement, {
66
+ className: "euiCommentEvent__header",
73
67
  css: cssHeaderStyles
74
- }, ___EmotionJSX(EuiPanel, _extends({}, panelProps, {
75
- css: cssHeaderPanelStyles
76
- }), ___EmotionJSX("div", {
77
- css: cssHeaderMainStyles
68
+ }, ___EmotionJSX(EuiPanel, panelProps, ___EmotionJSX("div", {
69
+ className: "euiCommentEvent__headerMain",
70
+ css: headerStyles.euiCommentEvent__headerMain
78
71
  }, ___EmotionJSX("div", {
79
- css: cssHeaderDataStyles
72
+ className: "euiCommentEvent__headerData",
73
+ css: headerStyles.euiCommentEvent__headerData
80
74
  }, eventIcon && ___EmotionJSX(EuiAvatar, {
81
- css: cssHeaderEventIconStyles,
75
+ className: "euiCommentEvent__headerEventIcon",
76
+ css: headerStyles.euiCommentEvent__headerEventIcon,
82
77
  size: "s",
83
78
  iconType: eventIcon,
84
79
  name: eventIconAriaLabel ? eventIconAriaLabel : '',
85
80
  color: "subdued",
86
81
  "aria-hidden": !eventIconAriaLabel
87
82
  }), username && ___EmotionJSX("div", {
88
- css: cssHeaderUsernameStyles
83
+ className: "euiCommentEvent__headerUsername",
84
+ css: headerStyles.euiCommentEvent__headerUsername
89
85
  }, username), event && ___EmotionJSX("div", {
90
- css: cssHeaderEventStyles
86
+ className: "euiCommentEvent__headerEvent",
87
+ css: headerStyles.euiCommentEvent__headerEvent
91
88
  }, event), timestamp && ___EmotionJSX("div", {
92
- css: cssHeaderTimestampStyles
89
+ className: "euiCommentEvent__headerTimestamp"
93
90
  }, ___EmotionJSX("time", null, timestamp))), actions && ___EmotionJSX("div", {
94
- css: cssHeaderActionsStyles
95
- }, actions))));
96
-
97
- return ___EmotionJSX(Element, {
98
- className: classes,
99
- css: cssStyles
100
- }, hasEventElements && eventHeader, children && ___EmotionJSX("div", {
91
+ className: "euiCommentEvent__headerActions",
92
+ css: headerStyles.euiCommentEvent__headerActions
93
+ }, actions)))), children && ___EmotionJSX("div", {
94
+ className: "euiCommentEvent__body",
101
95
  css: cssBodyStyles
102
96
  }, children));
103
97
  };
@@ -31,20 +31,20 @@ export var euiCommentEventStyles = function euiCommentEventStyles(_ref4) {
31
31
  };
32
32
 
33
33
  var _ref = process.env.NODE_ENV === "production" ? {
34
- name: "bqgcpj-hasEventColor",
35
- styles: "padding:0;label:hasEventColor;"
34
+ name: "ui5tce-euiCommentEvent__headerEvent",
35
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
36
36
  } : {
37
- name: "bqgcpj-hasEventColor",
38
- styles: "padding:0;label:hasEventColor;",
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
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
40
  };
41
41
 
42
42
  var _ref2 = process.env.NODE_ENV === "production" ? {
43
- name: "ui5tce-euiCommentEvent__headerEvent",
44
- styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
43
+ name: "bqgcpj-hasEventColor",
44
+ styles: "padding:0;label:hasEventColor;"
45
45
  } : {
46
- name: "ui5tce-euiCommentEvent__headerEvent",
47
- styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
46
+ name: "bqgcpj-hasEventColor",
47
+ styles: "padding:0;label:hasEventColor;",
48
48
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
49
49
  };
50
50
 
@@ -52,18 +52,17 @@ export var euiCommentEventHeaderStyles = function euiCommentEventHeaderStyles(_r
52
52
  var euiTheme = _ref5.euiTheme;
53
53
  return {
54
54
  euiCommentEvent__header: /*#__PURE__*/css(";label:euiCommentEvent__header;"),
55
- euiCommentEvent__headerPanel: /*#__PURE__*/css(";label:euiCommentEvent__headerPanel;"),
55
+ // types
56
+ regular: /*#__PURE__*/css("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
57
+ // variants
58
+ hasEventColor: _ref2,
59
+ // Children
56
60
  euiCommentEvent__headerMain: /*#__PURE__*/css("display:flex;flex:1;gap:", euiTheme.size.s, ";;label:euiCommentEvent__headerMain;"),
57
61
  euiCommentEvent__headerData: /*#__PURE__*/css("display:flex;flex:1;align-items:center;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerData;"),
58
62
  euiCommentEvent__headerEventIcon: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:euiCommentEvent__headerEventIcon;"),
59
63
  euiCommentEvent__headerUsername: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.semiBold, ";;label:euiCommentEvent__headerUsername;"),
60
- euiCommentEvent__headerEvent: _ref2,
61
- euiCommentEvent__headerTimestamp: /*#__PURE__*/css(";label:euiCommentEvent__headerTimestamp;"),
62
- euiCommentEvent__headerActions: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;"),
63
- // types
64
- regular: /*#__PURE__*/css("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
65
- // variants
66
- hasEventColor: _ref
64
+ euiCommentEvent__headerEvent: _ref,
65
+ euiCommentEvent__headerActions: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;")
67
66
  };
68
67
  };
69
68
  export var euiCommentEventBodyStyles = function euiCommentEventBodyStyles(_ref6) {
@@ -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,72 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ import { waitFor } from '@testing-library/react';
13
+ /**
14
+ * Ensure the EuiPopover being tested is open/closed before contiuning
15
+ * Note: Because EuiPopover is portalled, we want to query `document`
16
+ * instead of the `container` returned by RTL's render()
17
+ */
18
+
19
+ export var waitForEuiPopoverOpen = /*#__PURE__*/function () {
20
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
21
+ return regeneratorRuntime.wrap(function _callee$(_context) {
22
+ while (1) {
23
+ switch (_context.prev = _context.next) {
24
+ case 0:
25
+ _context.next = 2;
26
+ return waitFor(function () {
27
+ var openPopover = document.querySelector('[data-popover-open]');
28
+ expect(openPopover).toBeTruthy();
29
+ });
30
+
31
+ case 2:
32
+ return _context.abrupt("return", _context.sent);
33
+
34
+ case 3:
35
+ case "end":
36
+ return _context.stop();
37
+ }
38
+ }
39
+ }, _callee);
40
+ }));
41
+
42
+ return function waitForEuiPopoverOpen() {
43
+ return _ref.apply(this, arguments);
44
+ };
45
+ }();
46
+ export var waitForEuiPopoverClose = /*#__PURE__*/function () {
47
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
48
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
49
+ while (1) {
50
+ switch (_context2.prev = _context2.next) {
51
+ case 0:
52
+ _context2.next = 2;
53
+ return waitFor(function () {
54
+ var openPopover = document.querySelector('[data-popover-open]');
55
+ expect(openPopover).toBeFalsy();
56
+ });
57
+
58
+ case 2:
59
+ return _context2.abrupt("return", _context2.sent);
60
+
61
+ case 3:
62
+ case "end":
63
+ return _context2.stop();
64
+ }
65
+ }
66
+ }, _callee2);
67
+ }));
68
+
69
+ return function waitForEuiPopoverClose() {
70
+ return _ref2.apply(this, arguments);
71
+ };
72
+ }();
@@ -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,52 @@
1
+ var _excluded = ["queries"];
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+
11
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import { queries, render, screen, within } from '@testing-library/react';
21
+ import { EuiProvider } from '../../components';
22
+ import * as dataTestSubjQueries from './data_test_subj_queries';
23
+ /**
24
+ * Custom render() fn with EuiProvider and query helpers
25
+ *
26
+ * @see https://testing-library.com/docs/react-testing-library/setup#custom-render
27
+ * @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
28
+ */
29
+
30
+ var customRender = function customRender(ui) {
31
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
32
+
33
+ var renderQueries = _ref.queries,
34
+ options = _objectWithoutProperties(_ref, _excluded);
35
+
36
+ return render(ui, _objectSpread({
37
+ queries: _objectSpread(_objectSpread(_objectSpread({}, queries), dataTestSubjQueries), renderQueries || {}),
38
+ wrapper: EuiProvider
39
+ }, options));
40
+ };
41
+
42
+ export { customRender as render };
43
+ /**
44
+ * Custom screen util with EUI query helpers
45
+ *
46
+ * @see https://testing-library.com/docs/queries/about/#screen
47
+ * @see https://github.com/testing-library/dom-testing-library/issues/516
48
+ */
49
+
50
+ var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
51
+
52
+ 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,46 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import { queryHelpers, buildQueries } from '@testing-library/react';
21
+
22
+ var queryAllByTestSubject = function queryAllByTestSubject() {
23
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ args[_key] = arguments[_key];
25
+ }
26
+
27
+ return queryHelpers.queryAllByAttribute.apply(queryHelpers, ['data-test-subj'].concat(args));
28
+ };
29
+
30
+ var getMultipleError = function getMultipleError(_, TestSubjectValue) {
31
+ return "Found multiple elements with the data-test-subj attribute of: ".concat(TestSubjectValue);
32
+ };
33
+
34
+ var getMissingError = function getMissingError(_, TestSubjectValue) {
35
+ return "Unable to find an element with the data-test-subj attribute of: ".concat(TestSubjectValue);
36
+ };
37
+
38
+ var _buildQueries = buildQueries(queryAllByTestSubject, getMultipleError, getMissingError),
39
+ _buildQueries2 = _slicedToArray(_buildQueries, 5),
40
+ queryByTestSubject = _buildQueries2[0],
41
+ getAllByTestSubject = _buildQueries2[1],
42
+ getByTestSubject = _buildQueries2[2],
43
+ findAllByTestSubject = _buildQueries2[3],
44
+ findByTestSubject = _buildQueries2[4];
45
+
46
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject };
@@ -0,0 +1,3 @@
1
+ export * from './component_helpers';
2
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
3
+ export { render, screen } from './custom_render';
@@ -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';
package/eui.d.ts CHANGED
@@ -9270,16 +9270,14 @@ declare module '@elastic/eui/src/components/comment_list/comment_event.styles' {
9270
9270
  };
9271
9271
  export const euiCommentEventHeaderStyles: ({ euiTheme }: UseEuiTheme) => {
9272
9272
  euiCommentEvent__header: import("@emotion/utils").SerializedStyles;
9273
- euiCommentEvent__headerPanel: import("@emotion/utils").SerializedStyles;
9273
+ regular: import("@emotion/utils").SerializedStyles;
9274
+ hasEventColor: import("@emotion/utils").SerializedStyles;
9274
9275
  euiCommentEvent__headerMain: import("@emotion/utils").SerializedStyles;
9275
9276
  euiCommentEvent__headerData: import("@emotion/utils").SerializedStyles;
9276
9277
  euiCommentEvent__headerEventIcon: import("@emotion/utils").SerializedStyles;
9277
9278
  euiCommentEvent__headerUsername: import("@emotion/utils").SerializedStyles;
9278
9279
  euiCommentEvent__headerEvent: import("@emotion/utils").SerializedStyles;
9279
- euiCommentEvent__headerTimestamp: import("@emotion/utils").SerializedStyles;
9280
9280
  euiCommentEvent__headerActions: import("@emotion/utils").SerializedStyles;
9281
- regular: import("@emotion/utils").SerializedStyles;
9282
- hasEventColor: import("@emotion/utils").SerializedStyles;
9283
9281
  };
9284
9282
  export const euiCommentEventBodyStyles: ({ euiTheme }: UseEuiTheme) => {
9285
9283
  euiCommentEvent__body: import("@emotion/utils").SerializedStyles;
@@ -23426,6 +23424,90 @@ declare module 'mdast-util-to-hast/lib/all' {
23426
23424
  const all: (h: H, node: Node) => Node[];
23427
23425
  export = all;
23428
23426
  }
23427
+ declare module '@elastic/eui/src/test/rtl/component_helpers' {
23428
+ /**
23429
+ * Ensure the EuiPopover being tested is open/closed before contiuning
23430
+ * Note: Because EuiPopover is portalled, we want to query `document`
23431
+ * instead of the `container` returned by RTL's render()
23432
+ */
23433
+ export const waitForEuiPopoverOpen: () => Promise<void>;
23434
+ export const waitForEuiPopoverClose: () => Promise<void>;
23435
+
23436
+ }
23437
+ declare module '@elastic/eui/src/test/rtl/data_test_subj_queries' {
23438
+ import { queryHelpers, Matcher, MatcherOptions } from '@testing-library/react'; const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[]; const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
23439
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
23440
+
23441
+ }
23442
+ declare module '@elastic/eui/src/test/rtl/custom_render' {
23443
+ import { ReactElement } from 'react';
23444
+ import { queries, RenderOptions, Screen } from '@testing-library/react';
23445
+ import * as dataTestSubjQueries from '@elastic/eui/src/test/rtl/data_test_subj_queries'; const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
23446
+ getByLabelText: typeof queries.getByLabelText;
23447
+ getAllByLabelText: typeof queries.getAllByLabelText;
23448
+ queryByLabelText: typeof queries.queryByLabelText;
23449
+ queryAllByLabelText: typeof queries.queryAllByLabelText;
23450
+ findByLabelText: typeof queries.findByLabelText;
23451
+ findAllByLabelText: typeof queries.findAllByLabelText;
23452
+ getByPlaceholderText: typeof queries.getByPlaceholderText;
23453
+ getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
23454
+ queryByPlaceholderText: typeof queries.queryByPlaceholderText;
23455
+ queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
23456
+ findByPlaceholderText: typeof queries.findByPlaceholderText;
23457
+ findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
23458
+ getByText: typeof queries.getByText;
23459
+ getAllByText: typeof queries.getAllByText;
23460
+ queryByText: typeof queries.queryByText;
23461
+ queryAllByText: typeof queries.queryAllByText;
23462
+ findByText: typeof queries.findByText;
23463
+ findAllByText: typeof queries.findAllByText;
23464
+ getByAltText: typeof queries.getByAltText;
23465
+ getAllByAltText: typeof queries.getAllByAltText;
23466
+ queryByAltText: typeof queries.queryByAltText;
23467
+ queryAllByAltText: typeof queries.queryAllByAltText;
23468
+ findByAltText: typeof queries.findByAltText;
23469
+ findAllByAltText: typeof queries.findAllByAltText;
23470
+ getByTitle: typeof queries.getByTitle;
23471
+ getAllByTitle: typeof queries.getAllByTitle;
23472
+ queryByTitle: typeof queries.queryByTitle;
23473
+ queryAllByTitle: typeof queries.queryAllByTitle;
23474
+ findByTitle: typeof queries.findByTitle;
23475
+ findAllByTitle: typeof queries.findAllByTitle;
23476
+ getByDisplayValue: typeof queries.getByDisplayValue;
23477
+ getAllByDisplayValue: typeof queries.getAllByDisplayValue;
23478
+ queryByDisplayValue: typeof queries.queryByDisplayValue;
23479
+ queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
23480
+ findByDisplayValue: typeof queries.findByDisplayValue;
23481
+ findAllByDisplayValue: typeof queries.findAllByDisplayValue;
23482
+ getByRole: typeof queries.getByRole;
23483
+ getAllByRole: typeof queries.getAllByRole;
23484
+ queryByRole: typeof queries.queryByRole;
23485
+ queryAllByRole: typeof queries.queryAllByRole;
23486
+ findByRole: typeof queries.findByRole;
23487
+ findAllByRole: typeof queries.findAllByRole;
23488
+ getByTestId: typeof queries.getByTestId;
23489
+ getAllByTestId: typeof queries.getAllByTestId;
23490
+ queryByTestId: typeof queries.queryByTestId;
23491
+ queryAllByTestId: typeof queries.queryAllByTestId;
23492
+ findByTestId: typeof queries.findByTestId;
23493
+ findAllByTestId: typeof queries.findAllByTestId;
23494
+ queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
23495
+ queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
23496
+ getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
23497
+ getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
23498
+ findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
23499
+ findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
23500
+ }, HTMLElement, HTMLElement>;
23501
+ export { customRender as render }; const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
23502
+ export { customScreen as screen };
23503
+
23504
+ }
23505
+ declare module '@elastic/eui/src/test/rtl' {
23506
+ export * from '@elastic/eui/src/test/rtl/component_helpers';
23507
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from '@elastic/eui/src/test/rtl/data_test_subj_queries';
23508
+ export { render, screen } from '@elastic/eui/src/test/rtl/custom_render';
23509
+
23510
+ }
23429
23511
  declare module '@elastic/eui/src/components/table/mobile' {
23430
23512
  export { EuiTableHeaderMobile } from '@elastic/eui/src/components/table/mobile/table_header_mobile';
23431
23513
  export type { EuiTableSortMobileProps } from '@elastic/eui/src/components/table/mobile/table_sort_mobile';
@@ -23,8 +23,13 @@ var _react2 = require("@emotion/react");
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
-
26
+ /*
27
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
28
+ * or more contributor license agreements. Licensed under the Elastic License
29
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
30
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
31
+ * Side Public License, v 1.
32
+ */
28
33
  var EuiCommentEvent = function EuiCommentEvent(_ref) {
29
34
  var children = _ref.children,
30
35
  className = _ref.className,
@@ -55,14 +60,6 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
55
60
  var cssStyles = [styles.euiCommentEvent, styles[type]];
56
61
  var headerStyles = (0, _comment_event.euiCommentEventHeaderStyles)(euiTheme);
57
62
  var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
58
- var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
59
- var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
60
- var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
61
- var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
62
- var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
63
- var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
64
- var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
65
- var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
66
63
  var bodyStyles = (0, _comment_event.euiCommentEventBodyStyles)(euiTheme);
67
64
  var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
68
65
  var isFigure = isTypeRegular;
@@ -78,34 +75,40 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
78
75
  color: 'transparent',
79
76
  paddingSize: 'none'
80
77
  };
81
- var eventHeader = (0, _react2.jsx)(HeaderElement, {
78
+ return (0, _react2.jsx)(Element, {
79
+ className: classes,
80
+ css: cssStyles,
81
+ "data-type": type
82
+ }, hasEventElements && (0, _react2.jsx)(HeaderElement, {
83
+ className: "euiCommentEvent__header",
82
84
  css: cssHeaderStyles
83
- }, (0, _react2.jsx)(_panel.EuiPanel, _extends({}, panelProps, {
84
- css: cssHeaderPanelStyles
85
- }), (0, _react2.jsx)("div", {
86
- css: cssHeaderMainStyles
85
+ }, (0, _react2.jsx)(_panel.EuiPanel, panelProps, (0, _react2.jsx)("div", {
86
+ className: "euiCommentEvent__headerMain",
87
+ css: headerStyles.euiCommentEvent__headerMain
87
88
  }, (0, _react2.jsx)("div", {
88
- css: cssHeaderDataStyles
89
+ className: "euiCommentEvent__headerData",
90
+ css: headerStyles.euiCommentEvent__headerData
89
91
  }, eventIcon && (0, _react2.jsx)(_avatar.EuiAvatar, {
90
- css: cssHeaderEventIconStyles,
92
+ className: "euiCommentEvent__headerEventIcon",
93
+ css: headerStyles.euiCommentEvent__headerEventIcon,
91
94
  size: "s",
92
95
  iconType: eventIcon,
93
96
  name: eventIconAriaLabel ? eventIconAriaLabel : '',
94
97
  color: "subdued",
95
98
  "aria-hidden": !eventIconAriaLabel
96
99
  }), username && (0, _react2.jsx)("div", {
97
- css: cssHeaderUsernameStyles
100
+ className: "euiCommentEvent__headerUsername",
101
+ css: headerStyles.euiCommentEvent__headerUsername
98
102
  }, username), event && (0, _react2.jsx)("div", {
99
- css: cssHeaderEventStyles
103
+ className: "euiCommentEvent__headerEvent",
104
+ css: headerStyles.euiCommentEvent__headerEvent
100
105
  }, event), timestamp && (0, _react2.jsx)("div", {
101
- css: cssHeaderTimestampStyles
106
+ className: "euiCommentEvent__headerTimestamp"
102
107
  }, (0, _react2.jsx)("time", null, timestamp))), actions && (0, _react2.jsx)("div", {
103
- css: cssHeaderActionsStyles
104
- }, actions))));
105
- return (0, _react2.jsx)(Element, {
106
- className: classes,
107
- css: cssStyles
108
- }, hasEventElements && eventHeader, children && (0, _react2.jsx)("div", {
108
+ className: "euiCommentEvent__headerActions",
109
+ css: headerStyles.euiCommentEvent__headerActions
110
+ }, actions)))), children && (0, _react2.jsx)("div", {
111
+ className: "euiCommentEvent__body",
109
112
  css: cssBodyStyles
110
113
  }, children));
111
114
  };