@elastic/eui 71.0.0 → 72.0.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 +0 -7
- package/dist/eui_theme_dark.css +7747 -5854
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +7737 -5844
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/datagrid/data_grid.a11y.js +251 -0
- package/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/es/components/date_picker/date_picker.a11y.js +83 -0
- package/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +160 -173
- package/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/es/components/delay_hide/delay_hide.a11y.js +106 -0
- package/es/components/delay_render/delay_render.a11y.js +106 -0
- package/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
- package/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/es/components/error_boundary/error_boundary.js +45 -27
- package/es/components/expression/expression.a11y.js +254 -0
- package/es/components/filter_group/filter_group.a11y.js +281 -0
- package/es/components/focus_trap/focus_trap.a11y.js +131 -0
- package/es/components/form/file_picker/file_picker.js +1 -0
- package/es/components/header/header.a11y.js +374 -0
- package/es/components/icon/icon_ML.a11y.js +33 -0
- package/es/components/icon/icon_apps.a11y.js +33 -0
- package/es/components/icon/icon_editor.a11y.js +33 -0
- package/es/components/icon/icon_elastic.a11y.js +33 -0
- package/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/es/components/icon/icon_tokens.a11y.js +33 -0
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/es/components/page/page_side_bar/page_side_bar.js +3 -0
- package/es/components/page/page_template.js +1 -15
- package/es/components/selectable/selectable.js +4 -3
- package/es/components/selectable/selectable_list/selectable_list.js +17 -5
- package/es/components/tabs/tab.js +7 -17
- package/es/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/es/components/tabs/tabs.js +7 -11
- package/es/components/tabs/tabs_context.js +13 -0
- package/eui.d.ts +60 -43
- package/i18ntokens.json +34 -18
- package/lib/components/datagrid/data_grid.a11y.js +255 -0
- package/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/lib/components/date_picker/date_picker.a11y.js +89 -0
- package/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +155 -168
- package/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/lib/components/delay_hide/delay_hide.a11y.js +111 -0
- package/lib/components/delay_render/delay_render.a11y.js +111 -0
- package/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/lib/components/error_boundary/error_boundary.js +49 -29
- package/lib/components/expression/expression.a11y.js +262 -0
- package/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/lib/components/form/file_picker/file_picker.js +1 -0
- package/lib/components/header/header.a11y.js +385 -0
- package/lib/components/icon/icon_ML.a11y.js +40 -0
- package/lib/components/icon/icon_apps.a11y.js +40 -0
- package/lib/components/icon/icon_editor.a11y.js +40 -0
- package/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/lib/components/page/page_side_bar/page_side_bar.js +4 -0
- package/lib/components/page/page_template.js +1 -15
- package/lib/components/selectable/selectable.js +4 -3
- package/lib/components/selectable/selectable_list/selectable_list.js +17 -5
- package/lib/components/tabs/tab.js +14 -17
- package/lib/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/lib/components/tabs/tabs.js +8 -14
- package/lib/components/tabs/tabs_context.js +23 -0
- package/optimize/es/components/datagrid/data_grid.a11y.js +234 -0
- package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/es/components/date_picker/date_picker.a11y.js +73 -0
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +145 -169
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/es/components/delay_hide/delay_hide.a11y.js +96 -0
- package/optimize/es/components/delay_render/delay_render.a11y.js +96 -0
- package/optimize/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
- package/optimize/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/optimize/es/components/error_boundary/error_boundary.js +37 -26
- package/optimize/es/components/expression/expression.a11y.js +243 -0
- package/optimize/es/components/filter_group/filter_group.a11y.js +271 -0
- package/optimize/es/components/focus_trap/focus_trap.a11y.js +120 -0
- package/optimize/es/components/form/file_picker/file_picker.js +1 -0
- package/optimize/es/components/header/header.a11y.js +364 -0
- package/optimize/es/components/icon/icon_ML.a11y.js +33 -0
- package/optimize/es/components/icon/icon_apps.a11y.js +33 -0
- package/optimize/es/components/icon/icon_editor.a11y.js +33 -0
- package/optimize/es/components/icon/icon_elastic.a11y.js +33 -0
- package/optimize/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/optimize/es/components/icon/icon_tokens.a11y.js +33 -0
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/optimize/es/components/page/page_side_bar/page_side_bar.js +3 -0
- package/optimize/es/components/selectable/selectable.js +2 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/es/components/tabs/tab.js +7 -5
- package/optimize/es/components/tabs/tabs.js +7 -11
- package/optimize/es/components/tabs/tabs_context.js +13 -0
- package/optimize/lib/components/datagrid/data_grid.a11y.js +248 -0
- package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/lib/components/date_picker/date_picker.a11y.js +87 -0
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +146 -167
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/lib/components/delay_hide/delay_hide.a11y.js +111 -0
- package/optimize/lib/components/delay_render/delay_render.a11y.js +111 -0
- package/optimize/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/optimize/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/optimize/lib/components/error_boundary/error_boundary.js +41 -28
- package/optimize/lib/components/expression/expression.a11y.js +254 -0
- package/optimize/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/optimize/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +1 -0
- package/optimize/lib/components/header/header.a11y.js +385 -0
- package/optimize/lib/components/icon/icon_ML.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_apps.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_editor.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/optimize/lib/components/page/page_side_bar/page_side_bar.js +4 -0
- package/optimize/lib/components/selectable/selectable.js +2 -2
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/lib/components/tabs/tab.js +15 -5
- package/optimize/lib/components/tabs/tabs.js +8 -14
- package/optimize/lib/components/tabs/tabs_context.js +23 -0
- package/package.json +14 -19
- package/src/components/basic_table/_basic_table.scss +1 -4
- package/src/components/button/button_empty/_button_empty.scss +2 -4
- package/src/components/button/button_group/_button_group.scss +1 -1
- package/src/components/button/button_group/_button_group_button.scss +3 -4
- package/src/components/button/button_icon/_button_icon.scss +0 -3
- package/src/components/collapsible_nav/_collapsible_nav.scss +1 -1
- package/src/components/collapsible_nav/collapsible_nav_group/_collapsible_nav_group.scss +1 -1
- package/src/components/color_picker/_color_picker.scss +3 -2
- package/src/components/color_picker/_hue.scss +7 -7
- package/src/components/color_picker/_saturation.scss +1 -1
- package/src/components/color_picker/color_palette_display/_mixins.scss +1 -1
- package/src/components/color_picker/color_stops/_color_stops.scss +2 -3
- package/src/components/combo_box/_combo_box.scss +7 -6
- package/src/components/combo_box/combo_box_input/_combo_box_input.scss +2 -1
- package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +1 -1
- package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +2 -3
- package/src/components/control_bar/_variables.scss +0 -1
- package/src/components/datagrid/_data_grid_data_row.scss +4 -5
- package/src/components/datagrid/_mixins.scss +1 -1
- package/src/components/datagrid/body/_data_grid_footer_row.scss +2 -1
- package/src/components/datagrid/body/header/_data_grid_column_resizer.scss +3 -4
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -1
- package/src/components/datagrid/controls/_data_grid_column_sorting.scss +1 -2
- package/src/components/date_picker/_date_picker_range.scss +1 -1
- package/src/components/date_picker/super_date_picker/_super_date_picker.scss +1 -4
- package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +15 -1
- package/src/components/drag_and_drop/_draggable.scss +3 -5
- package/src/components/drag_and_drop/_droppable.scss +1 -1
- package/src/components/empty_prompt/_empty_prompt.scss +1 -1
- package/src/components/filter_group/_filter_group.scss +2 -2
- package/src/components/filter_group/_filter_select_item.scss +0 -1
- package/src/components/form/checkbox/_checkbox.scss +5 -3
- package/src/components/form/described_form_group/_described_form_group.scss +0 -1
- package/src/components/form/field_password/_field_password.scss +1 -1
- package/src/components/form/field_search/_field_search.scss +1 -1
- package/src/components/form/file_picker/_file_picker.scss +15 -16
- package/src/components/form/form_control_layout/_form_control_layout.scss +6 -7
- package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +4 -6
- package/src/components/form/form_row/_form_row.scss +3 -0
- package/src/components/form/radio/_radio.scss +5 -3
- package/src/components/form/select/_select.scss +1 -1
- package/src/components/form/switch/_switch.scss +3 -1
- package/src/components/header/_mixins.scss +1 -1
- package/src/components/header/header_section/_header_section_item.scss +4 -4
- package/src/components/header/header_section/_header_section_item_button.scss +0 -1
- package/src/components/key_pad_menu/_key_pad_menu_item.scss +2 -7
- package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +4 -4
- package/src/components/markdown_editor/_markdown_editor_footer.scss +1 -1
- package/src/components/markdown_editor/_markdown_editor_text_area.scss +2 -3
- package/src/components/markdown_editor/_markdown_format.scss +4 -2
- package/src/components/notification/_notification_event.scss +2 -2
- package/src/components/page/page_content/_page_content_body.scss +0 -1
- package/src/components/page/page_content/_page_content_header_section.scss +0 -1
- package/src/components/page/page_side_bar/_page_side_bar.scss +0 -1
- package/src/components/panel/split_panel/_split_panel.scss +2 -2
- package/src/components/resizable_container/_resizable_button.scss +31 -31
- package/src/components/resizable_container/_resizable_collapse_button.scss +9 -9
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +1 -1
- package/src/components/side_nav/_mixins.scss +1 -1
- package/src/components/side_nav/_side_nav.scss +2 -1
- package/src/components/side_nav/_side_nav_item.scss +2 -3
- package/src/components/steps/_steps.scss +2 -1
- package/src/components/suggest/_suggest_input.scss +1 -1
- package/src/components/suggest/_suggest_item.scss +4 -3
- package/src/components/table/_responsive.scss +5 -3
- package/src/components/table/_table.scss +2 -4
- package/src/components/table/mobile/_mobile.scss +0 -2
- package/src/components/tree_view/tree_view.scss +2 -2
- package/src/global_styling/mixins/_form.scss +7 -18
- package/src/global_styling/mixins/_header.scss +2 -2
- package/src/global_styling/mixins/_helpers.scss +1 -2
- package/src/global_styling/mixins/_icons.scss +1 -1
- package/src/global_styling/mixins/_range.scss +4 -8
- package/src/global_styling/mixins/_responsive.scss +3 -8
- package/src/global_styling/mixins/_shadow.scss +5 -9
- package/src/global_styling/mixins/_states.scss +2 -2
- package/src/global_styling/mixins/_typography.scss +16 -19
- package/src/global_styling/variables/_colors_vis.scss +1 -1
- package/src/global_styling/variables/_typography.scss +1 -3
- package/src/themes/amsterdam/_colors_dark.scss +2 -1
- package/src/themes/amsterdam/_colors_light.scss +2 -0
- package/src/themes/amsterdam/global_styling/mixins/_link.scss +1 -1
- package/src/themes/amsterdam/global_styling/mixins/_states.scss +0 -1
- package/src/themes/amsterdam/global_styling/mixins/_typography.scss +1 -2
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_days.scss +0 -1
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_month_year.scss +0 -1
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_times.scss +3 -4
- package/src/themes/amsterdam/global_styling/react_date_picker/_mixins.scss +0 -1
- package/src/themes/amsterdam/global_styling/variables/_typography.scss +1 -2
- package/src/themes/amsterdam/overrides/_color_stops.scss +4 -5
- package/src/themes/amsterdam/overrides/_combo_box.scss +3 -0
- package/src/themes/amsterdam/overrides/_form_control_layout.scss +3 -0
- package/src/themes/amsterdam/overrides/_form_control_layout_delimited.scss +5 -4
- package/src/themes/amsterdam/overrides/_header.scss +2 -2
- package/src/themes/amsterdam/overrides/_hue.scss +6 -6
- package/src/themes/amsterdam/overrides/_key_pad_menu.scss +2 -2
- package/src/themes/amsterdam/overrides/_steps.scss +1 -2
- package/src/themes/legacy/_colors_dark.scss +2 -1
- package/src/themes/legacy/_colors_light.scss +2 -0
- package/src/themes/legacy/reset/_reset.scss +8 -7
- package/test-env/components/datagrid/data_grid.a11y.js +248 -0
- package/test-env/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/test-env/components/date_picker/date_picker.a11y.js +87 -0
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +153 -166
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/test-env/components/delay_hide/delay_hide.a11y.js +111 -0
- package/test-env/components/delay_render/delay_render.a11y.js +111 -0
- package/test-env/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/test-env/components/error_boundary/error_boundary.a11y.js +75 -0
- package/test-env/components/error_boundary/error_boundary.js +48 -28
- package/test-env/components/expression/expression.a11y.js +254 -0
- package/test-env/components/filter_group/filter_group.a11y.js +287 -0
- package/test-env/components/focus_trap/focus_trap.a11y.js +140 -0
- package/test-env/components/form/file_picker/file_picker.js +1 -0
- package/test-env/components/header/header.a11y.js +385 -0
- package/test-env/components/icon/icon_ML.a11y.js +40 -0
- package/test-env/components/icon/icon_apps.a11y.js +40 -0
- package/test-env/components/icon/icon_editor.a11y.js +40 -0
- package/test-env/components/icon/icon_elastic.a11y.js +40 -0
- package/test-env/components/icon/icon_glyphs.a11y.js +40 -0
- package/test-env/components/icon/icon_tokens.a11y.js +40 -0
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/test-env/components/page/page_side_bar/page_side_bar.js +4 -0
- package/test-env/components/page/page_template.js +1 -15
- package/test-env/components/selectable/selectable.js +4 -3
- package/test-env/components/selectable/selectable_list/selectable_list.js +17 -5
- package/test-env/components/tabs/tab.js +15 -17
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/test-env/components/tabs/tabs.js +8 -14
- package/test-env/components/tabs/tabs_context.js +23 -0
- package/scripts/postinstall.js +0 -9
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _button = require("../button");
|
|
8
|
+
|
|
9
|
+
var _empty_prompt = require("./empty_prompt");
|
|
10
|
+
|
|
11
|
+
var _link = require("../link");
|
|
12
|
+
|
|
13
|
+
var _title = require("../title");
|
|
14
|
+
|
|
15
|
+
var _react2 = require("@emotion/react");
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
19
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
20
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
21
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
22
|
+
* Side Public License, v 1.
|
|
23
|
+
*/
|
|
24
|
+
/// <reference types="../../../cypress/support"/>
|
|
25
|
+
var EmptyPrompt = function EmptyPrompt(_ref) {
|
|
26
|
+
var addCaseSpy = _ref.addCaseSpy,
|
|
27
|
+
addLinkSpy = _ref.addLinkSpy;
|
|
28
|
+
return (0, _react2.jsx)(_empty_prompt.EuiEmptyPrompt, {
|
|
29
|
+
iconType: "logoSecurity",
|
|
30
|
+
title: (0, _react2.jsx)("h2", null, "Start adding cases"),
|
|
31
|
+
body: (0, _react2.jsx)("p", null, "Add a new case or change your filter settings."),
|
|
32
|
+
actions: (0, _react2.jsx)(_button.EuiButton, {
|
|
33
|
+
color: "primary",
|
|
34
|
+
onClick: addCaseSpy,
|
|
35
|
+
fill: true
|
|
36
|
+
}, "Add a case"),
|
|
37
|
+
footer: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_title.EuiTitle, {
|
|
38
|
+
size: "xxs"
|
|
39
|
+
}, (0, _react2.jsx)("h3", null, "Want to learn more?")), (0, _react2.jsx)(_link.EuiLink, {
|
|
40
|
+
href: "#",
|
|
41
|
+
onClick: addLinkSpy
|
|
42
|
+
}, "Read the docs"))
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
beforeEach(function () {
|
|
47
|
+
var addCaseSpy = cy.spy().as('addCaseSpy');
|
|
48
|
+
var addLinkSpy = cy.spy().as('addLinkSpy');
|
|
49
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
50
|
+
|
|
51
|
+
cy.realMount((0, _react2.jsx)(EmptyPrompt, {
|
|
52
|
+
addCaseSpy: addCaseSpy,
|
|
53
|
+
addLinkSpy: addLinkSpy
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
describe('EuiEmptyPrompt', function () {
|
|
57
|
+
describe('Automated accessibility check', function () {
|
|
58
|
+
it('has zero violations on first render', function () {
|
|
59
|
+
cy.checkAxe();
|
|
60
|
+
});
|
|
61
|
+
it('has zero violations after clicking Add a case button', function () {
|
|
62
|
+
cy.get('button.euiButton').contains('Add a case').realClick();
|
|
63
|
+
cy.get('@addCaseSpy').should('have.been.called');
|
|
64
|
+
cy.checkAxe();
|
|
65
|
+
});
|
|
66
|
+
it('has zero violations after clicking Read the docs link', function () {
|
|
67
|
+
cy.get('a.euiLink').contains('Read the docs').realClick();
|
|
68
|
+
cy.get('@addLinkSpy').should('have.been.called');
|
|
69
|
+
cy.checkAxe();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _button = require("../button");
|
|
8
|
+
|
|
9
|
+
var _error_boundary = require("./error_boundary");
|
|
10
|
+
|
|
11
|
+
var _spacer = require("../spacer");
|
|
12
|
+
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
19
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
|
+
* Side Public License, v 1.
|
|
21
|
+
*/
|
|
22
|
+
/// <reference types="../../../cypress/support"/>
|
|
23
|
+
var handleFocus = function handleFocus() {
|
|
24
|
+
var target = document.querySelector('pre.euiCodeBlock__pre');
|
|
25
|
+
target.focus();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe('EuiErrorBoundary', function () {
|
|
29
|
+
describe('Automated accessibility check when an error is thrown', function () {
|
|
30
|
+
var BadComponent = function BadComponent() {
|
|
31
|
+
throw new Error('Throw the error.');
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
beforeEach(function () {
|
|
35
|
+
cy.on('uncaught:exception', function (err) {
|
|
36
|
+
if (err.message.includes('Throw the error')) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
41
|
+
|
|
42
|
+
cy.realMount((0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_button.EuiButton, {
|
|
43
|
+
color: "primary",
|
|
44
|
+
onClick: handleFocus,
|
|
45
|
+
"data-test-subj": "cy-error-boundary-button"
|
|
46
|
+
}, "Press to focus"), (0, _react2.jsx)(_spacer.EuiSpacer, null), (0, _react2.jsx)(_error_boundary.EuiErrorBoundary, null, (0, _react2.jsx)(BadComponent, null))));
|
|
47
|
+
});
|
|
48
|
+
it('has zero violations on first render', function () {
|
|
49
|
+
cy.checkAxe();
|
|
50
|
+
});
|
|
51
|
+
it('has zero violations and accepts focus when the button is pressed', function () {
|
|
52
|
+
cy.realPress('Tab');
|
|
53
|
+
cy.realPress('Enter');
|
|
54
|
+
cy.get('pre.euiCodeBlock__pre').should('have.focus');
|
|
55
|
+
cy.checkAxe();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('Automated accessibility check when no error is thrown', function () {
|
|
59
|
+
var GoodComponent = function GoodComponent() {
|
|
60
|
+
return (0, _react2.jsx)("div", {
|
|
61
|
+
"data-test-subj": "cy-good-component"
|
|
62
|
+
}, "This is a properly rendered component.");
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
beforeEach(function () {
|
|
66
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
67
|
+
|
|
68
|
+
cy.realMount((0, _react2.jsx)(_error_boundary.EuiErrorBoundary, null, (0, _react2.jsx)(GoodComponent, null)));
|
|
69
|
+
});
|
|
70
|
+
it('has zero violations when no violations are thrown', function () {
|
|
71
|
+
cy.get('div[data-test-subj="cy-good-component"]').should('exist');
|
|
72
|
+
cy.checkAxe();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.
|
|
10
|
+
exports.EuiErrorMessage = exports.EuiErrorBoundary = void 0;
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
@@ -41,7 +41,8 @@ var _error_boundary = require("./error_boundary.styles");
|
|
|
41
41
|
|
|
42
42
|
var _react2 = require("@emotion/react");
|
|
43
43
|
|
|
44
|
-
var _excluded = ["
|
|
44
|
+
var _excluded = ["children"],
|
|
45
|
+
_excluded2 = ["errorMessage", "className", "data-test-subj"];
|
|
45
46
|
|
|
46
47
|
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); }
|
|
47
48
|
|
|
@@ -51,15 +52,15 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
51
52
|
|
|
52
53
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
54
|
|
|
54
|
-
var
|
|
55
|
-
(0, _inherits2.default)(
|
|
55
|
+
var EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
56
|
+
(0, _inherits2.default)(EuiErrorBoundary, _Component);
|
|
56
57
|
|
|
57
|
-
var _super = _createSuper(
|
|
58
|
+
var _super = _createSuper(EuiErrorBoundary);
|
|
58
59
|
|
|
59
|
-
function
|
|
60
|
+
function EuiErrorBoundary(props) {
|
|
60
61
|
var _this;
|
|
61
62
|
|
|
62
|
-
(0, _classCallCheck2.default)(this,
|
|
63
|
+
(0, _classCallCheck2.default)(this, EuiErrorBoundary);
|
|
63
64
|
_this = _super.call(this, props);
|
|
64
65
|
var errorState = {
|
|
65
66
|
hasError: false,
|
|
@@ -69,7 +70,7 @@ var _EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
69
70
|
return _this;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
(0, _createClass2.default)(
|
|
73
|
+
(0, _createClass2.default)(EuiErrorBoundary, [{
|
|
73
74
|
key: "componentDidCatch",
|
|
74
75
|
value: function componentDidCatch(_ref) {
|
|
75
76
|
var message = _ref.message,
|
|
@@ -89,36 +90,29 @@ var _EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
89
90
|
key: "render",
|
|
90
91
|
value: function render() {
|
|
91
92
|
var _this$props = this.props,
|
|
92
|
-
className = _this$props.className,
|
|
93
93
|
children = _this$props.children,
|
|
94
|
-
_dataTestSubj = _this$props['data-test-subj'],
|
|
95
|
-
theme = _this$props.theme,
|
|
96
94
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
97
|
-
var dataTestSubj = (0, _classnames.default)('euiErrorBoundary', _dataTestSubj);
|
|
98
|
-
var styles = (0, _error_boundary.euiErrorBoundaryStyles)(theme);
|
|
99
95
|
|
|
100
96
|
if (this.state.hasError) {
|
|
101
97
|
// You can render any custom fallback UI
|
|
102
|
-
return (0, _react2.jsx)(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"data-test-subj": dataTestSubj
|
|
106
|
-
}, rest), (0, _react2.jsx)(_code.EuiCodeBlock, null, (0, _react2.jsx)(_title.EuiTitle, {
|
|
107
|
-
size: "xs"
|
|
108
|
-
}, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
109
|
-
token: "euiErrorBoundary.error",
|
|
110
|
-
default: "Error"
|
|
111
|
-
}))), this.state.error));
|
|
98
|
+
return (0, _react2.jsx)(EuiErrorMessage, (0, _extends2.default)({}, rest, {
|
|
99
|
+
errorMessage: this.state.error
|
|
100
|
+
}));
|
|
112
101
|
}
|
|
113
102
|
|
|
114
103
|
return children;
|
|
115
104
|
}
|
|
116
105
|
}]);
|
|
117
|
-
return
|
|
106
|
+
return EuiErrorBoundary;
|
|
118
107
|
}(_react.Component);
|
|
108
|
+
/**
|
|
109
|
+
* Split out into a separate styling-only component for easier use of hooks,
|
|
110
|
+
* and also for internal re-use by EUI's docs/playgrounds
|
|
111
|
+
*/
|
|
119
112
|
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
|
|
114
|
+
exports.EuiErrorBoundary = EuiErrorBoundary;
|
|
115
|
+
EuiErrorBoundary.propTypes = {
|
|
122
116
|
className: _propTypes.default.string,
|
|
123
117
|
"aria-label": _propTypes.default.string,
|
|
124
118
|
"data-test-subj": _propTypes.default.string,
|
|
@@ -129,5 +123,31 @@ _EuiErrorBoundary.propTypes = {
|
|
|
129
123
|
*/
|
|
130
124
|
children: _propTypes.default.node.isRequired
|
|
131
125
|
};
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
|
|
127
|
+
var EuiErrorMessage = function EuiErrorMessage(_ref2) {
|
|
128
|
+
var errorMessage = _ref2.errorMessage,
|
|
129
|
+
className = _ref2.className,
|
|
130
|
+
dataTestSubj = _ref2['data-test-subj'],
|
|
131
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
132
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
133
|
+
var styles = (0, _error_boundary.euiErrorBoundaryStyles)(euiTheme);
|
|
134
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
135
|
+
css: styles.euiErrorBoundary,
|
|
136
|
+
className: (0, _classnames.default)('euiErrorBoundary', className),
|
|
137
|
+
"data-test-subj": (0, _classnames.default)('euiErrorBoundary', dataTestSubj)
|
|
138
|
+
}, rest), (0, _react2.jsx)(_code.EuiCodeBlock, null, (0, _react2.jsx)(_title.EuiTitle, {
|
|
139
|
+
size: "xs"
|
|
140
|
+
}, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
141
|
+
token: "euiErrorBoundary.error",
|
|
142
|
+
default: "Error"
|
|
143
|
+
}))), errorMessage));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.EuiErrorMessage = EuiErrorMessage;
|
|
147
|
+
EuiErrorMessage.propTypes = {
|
|
148
|
+
className: _propTypes.default.string,
|
|
149
|
+
"aria-label": _propTypes.default.string,
|
|
150
|
+
"data-test-subj": _propTypes.default.string,
|
|
151
|
+
css: _propTypes.default.any,
|
|
152
|
+
errorMessage: _propTypes.default.string
|
|
153
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
|
+
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
|
|
13
|
+
var _expression = require("./expression");
|
|
14
|
+
|
|
15
|
+
var _form = require("../form");
|
|
16
|
+
|
|
17
|
+
var _flex = require("../flex");
|
|
18
|
+
|
|
19
|
+
var _panel = require("../panel");
|
|
20
|
+
|
|
21
|
+
var _popover = require("../popover");
|
|
22
|
+
|
|
23
|
+
var _services = require("../../services");
|
|
24
|
+
|
|
25
|
+
var _react2 = require("@emotion/react");
|
|
26
|
+
|
|
27
|
+
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); }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
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; }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
describe('EuiExpression', function () {
|
|
36
|
+
var BaseExpression = function BaseExpression() {
|
|
37
|
+
var _useState = (0, _react.useState)({
|
|
38
|
+
isOpen: false,
|
|
39
|
+
value: 'count()'
|
|
40
|
+
}),
|
|
41
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
+
example1 = _useState2[0],
|
|
43
|
+
setExample1 = _useState2[1];
|
|
44
|
+
|
|
45
|
+
var _useState3 = (0, _react.useState)({
|
|
46
|
+
value: 100,
|
|
47
|
+
description: 'Is above'
|
|
48
|
+
}),
|
|
49
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
50
|
+
example2 = _useState4[0],
|
|
51
|
+
setExample2 = _useState4[1];
|
|
52
|
+
|
|
53
|
+
var expressionPopoverId__1 = (0, _services.useGeneratedHtmlId)({
|
|
54
|
+
prefix: 'expressionPopover',
|
|
55
|
+
suffix: 'first'
|
|
56
|
+
});
|
|
57
|
+
var expressionPopoverId__2 = (0, _services.useGeneratedHtmlId)({
|
|
58
|
+
prefix: 'expressionPopover',
|
|
59
|
+
suffix: 'second'
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
var openExample1 = function openExample1() {
|
|
63
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
64
|
+
isOpen: true
|
|
65
|
+
}));
|
|
66
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
67
|
+
isOpen: false
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var closeExample1 = function closeExample1() {
|
|
72
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
73
|
+
isOpen: false
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var openExample2 = function openExample2() {
|
|
78
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
79
|
+
isOpen: false
|
|
80
|
+
}));
|
|
81
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
82
|
+
isOpen: true
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var closeExample2 = function closeExample2() {
|
|
87
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
88
|
+
isOpen: false
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var changeExample1 = function changeExample1(event) {
|
|
93
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
94
|
+
value: event.target.value
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var changeExample2Value = function changeExample2Value(e) {
|
|
99
|
+
var sanitizedValue = parseInt(e.target.value, 10);
|
|
100
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
101
|
+
value: isNaN(sanitizedValue) ? '' : sanitizedValue
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
var changeExample2Description = function changeExample2Description(event) {
|
|
106
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
107
|
+
description: event.target.value
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var renderPopover1 = function renderPopover1() {
|
|
112
|
+
return (0, _react2.jsx)("div", {
|
|
113
|
+
"data-test-subj": "cy-expression-popover-1"
|
|
114
|
+
}, (0, _react2.jsx)(_popover.EuiPopoverTitle, null, "When"), (0, _react2.jsx)(_form.EuiSelect, {
|
|
115
|
+
compressed: true,
|
|
116
|
+
value: example1.value,
|
|
117
|
+
onChange: changeExample1,
|
|
118
|
+
options: [{
|
|
119
|
+
value: 'count()',
|
|
120
|
+
text: 'count()'
|
|
121
|
+
}, {
|
|
122
|
+
value: 'average()',
|
|
123
|
+
text: 'average()'
|
|
124
|
+
}, {
|
|
125
|
+
value: 'sum()',
|
|
126
|
+
text: 'sum()'
|
|
127
|
+
}, {
|
|
128
|
+
value: 'median()',
|
|
129
|
+
text: 'median()'
|
|
130
|
+
}, {
|
|
131
|
+
value: 'min()',
|
|
132
|
+
text: 'min()'
|
|
133
|
+
}, {
|
|
134
|
+
value: 'max()',
|
|
135
|
+
text: 'max()'
|
|
136
|
+
}]
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var renderPopover2 = function renderPopover2() {
|
|
141
|
+
return (0, _react2.jsx)("div", {
|
|
142
|
+
"data-test-subj": "cy-expression-popover-2"
|
|
143
|
+
}, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
144
|
+
gutterSize: "s"
|
|
145
|
+
}, (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
146
|
+
grow: false,
|
|
147
|
+
style: {
|
|
148
|
+
width: 150
|
|
149
|
+
}
|
|
150
|
+
}, (0, _react2.jsx)(_form.EuiSelect, {
|
|
151
|
+
compressed: true,
|
|
152
|
+
value: example2.description,
|
|
153
|
+
onChange: changeExample2Description,
|
|
154
|
+
options: [{
|
|
155
|
+
value: 'Is above',
|
|
156
|
+
text: 'Is above'
|
|
157
|
+
}, {
|
|
158
|
+
value: 'Is below',
|
|
159
|
+
text: 'Is below'
|
|
160
|
+
}, {
|
|
161
|
+
value: 'Is exactly',
|
|
162
|
+
text: 'Is exactly'
|
|
163
|
+
}]
|
|
164
|
+
})), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
165
|
+
grow: false,
|
|
166
|
+
style: {
|
|
167
|
+
width: 100
|
|
168
|
+
}
|
|
169
|
+
}, (0, _react2.jsx)(_form.EuiFieldNumber, {
|
|
170
|
+
compressed: true,
|
|
171
|
+
value: example2.value,
|
|
172
|
+
onChange: changeExample2Value
|
|
173
|
+
}))));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
return (0, _react2.jsx)(_panel.EuiPanel, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
177
|
+
gutterSize: "s"
|
|
178
|
+
}, (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
179
|
+
grow: false
|
|
180
|
+
}, (0, _react2.jsx)(_popover.EuiPopover, {
|
|
181
|
+
id: expressionPopoverId__1,
|
|
182
|
+
button: (0, _react2.jsx)(_expression.EuiExpression, {
|
|
183
|
+
description: "when",
|
|
184
|
+
value: example1.value,
|
|
185
|
+
isActive: example1.isOpen,
|
|
186
|
+
onClick: openExample1
|
|
187
|
+
}),
|
|
188
|
+
isOpen: example1.isOpen,
|
|
189
|
+
closePopover: closeExample1,
|
|
190
|
+
panelPaddingSize: "s",
|
|
191
|
+
anchorPosition: "downLeft"
|
|
192
|
+
}, renderPopover1())), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
193
|
+
grow: false
|
|
194
|
+
}, (0, _react2.jsx)(_popover.EuiPopover, {
|
|
195
|
+
id: expressionPopoverId__2,
|
|
196
|
+
panelPaddingSize: "s",
|
|
197
|
+
button: (0, _react2.jsx)(_expression.EuiExpression, {
|
|
198
|
+
description: example2.description,
|
|
199
|
+
value: example2.value,
|
|
200
|
+
isActive: example2.isOpen,
|
|
201
|
+
onClick: openExample2
|
|
202
|
+
}),
|
|
203
|
+
isOpen: example2.isOpen,
|
|
204
|
+
closePopover: closeExample2,
|
|
205
|
+
anchorPosition: "downLeft"
|
|
206
|
+
}, renderPopover2()))));
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
beforeEach(function () {
|
|
210
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
211
|
+
|
|
212
|
+
cy.realMount((0, _react2.jsx)(BaseExpression, null));
|
|
213
|
+
});
|
|
214
|
+
describe('Automated accessibility check', function () {
|
|
215
|
+
it('has zero violations on first render', function () {
|
|
216
|
+
cy.checkAxe();
|
|
217
|
+
});
|
|
218
|
+
it('has zero violations when count popover is open', function () {
|
|
219
|
+
cy.get('button').contains(/When count\(\)/i).realClick();
|
|
220
|
+
cy.get('div[data-test-subj="cy-expression-popover-1"]').should('exist');
|
|
221
|
+
cy.checkAxe();
|
|
222
|
+
});
|
|
223
|
+
it('has zero violations when is above popover is open', function () {
|
|
224
|
+
cy.get('button').contains(/Is above 100/i).realClick();
|
|
225
|
+
cy.get('div[data-test-subj="cy-expression-popover-2"]').should('exist');
|
|
226
|
+
cy.checkAxe();
|
|
227
|
+
});
|
|
228
|
+
it('has zero violations when first popover is interacted with by keyboard', function () {
|
|
229
|
+
cy.realPress('Tab');
|
|
230
|
+
cy.get('button').contains(/When count\(\)/i).should('have.focus');
|
|
231
|
+
cy.realPress('Enter');
|
|
232
|
+
cy.get('div[data-test-subj="cy-expression-popover-1"]').should('exist');
|
|
233
|
+
cy.realPress('Tab');
|
|
234
|
+
cy.realPress(['a', 'v', 'g']);
|
|
235
|
+
cy.realPress('Escape');
|
|
236
|
+
cy.get('button').contains(/When average\(\)/i).should('have.focus');
|
|
237
|
+
cy.checkAxe();
|
|
238
|
+
});
|
|
239
|
+
it('has zero violations when second popover is interacted with by keyboard', function () {
|
|
240
|
+
cy.repeatRealPress('Tab');
|
|
241
|
+
cy.get('button').contains(/Is above 100/i).should('have.focus');
|
|
242
|
+
cy.realPress('Enter');
|
|
243
|
+
cy.get('div[data-test-subj="cy-expression-popover-2"]').should('exist');
|
|
244
|
+
cy.realPress('Tab');
|
|
245
|
+
cy.realPress(['I', 's', ' ', 'e']);
|
|
246
|
+
cy.realPress('Tab');
|
|
247
|
+
cy.repeatRealPress('Delete', 3);
|
|
248
|
+
cy.realPress(['5', '0', '0']);
|
|
249
|
+
cy.realPress('Escape');
|
|
250
|
+
cy.get('button').contains(/Is exactly 500/i).should('have.focus');
|
|
251
|
+
cy.checkAxe();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
});
|