Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding tooltips and tests to visual-refresh-toolbar #2650

Merged
merged 39 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c1c6d19
adding tooltips and tests to visual refrest
dpitcock Aug 30, 2024
b1f5f32
adding integ tests to visual refresh tooltip toolbar
dpitcock Sep 5, 2024
eee8654
following up on integ tests
dpitcock Sep 9, 2024
c6f5440
returning retries to integ
dpitcock Sep 9, 2024
30cb97a
fixing package version issues
dpitcock Sep 9, 2024
35a26d0
updating doc string to manage expectations on website
dpitcock Sep 9, 2024
cf1d4fe
removig hard and soft setShowTooltip functions in visual-refresh draw…
dpitcock Sep 9, 2024
962c5f8
updating interface to note drawer aria label is used for tooltip
dpitcock Sep 10, 2024
9b2e4cf
seperating hide on escape to own tests
dpitcock Sep 10, 2024
83e1879
updating docstring snapshot
dpitcock Sep 10, 2024
a5c16ca
removing unneccessary methods for testing
dpitcock Sep 10, 2024
f8a8f35
skipping mouse event tests on mobile
dpitcock Sep 10, 2024
51b8cda
updating drawername aria label docstring
dpitcock Sep 11, 2024
da0a42a
setting hover away event to be hovering over nav toggle instead of bo…
dpitcock Sep 11, 2024
6365078
fixing tooltip to show after key navigation after drawer open
dpitcock Sep 12, 2024
1769be4
ready for tooltip registry
dpitcock Sep 12, 2024
b34d619
adding tooltip registry
dpitcock Sep 13, 2024
e542dff
tooltips workign on safari brower in desktop
dpitcock Sep 16, 2024
e830788
adding more commments to explain handleFocus conditions
dpitcock Sep 16, 2024
db015f6
removing flashing tooltip on trigger button with badge
dpitcock Sep 16, 2024
3eae7b0
detecting shift focus from outside the trigger buttons in visual-refresh
dpitcock Sep 16, 2024
2ab4264
cleanup and spli-panel button work
dpitcock Sep 16, 2024
86f2a3d
skipping failing tests
dpitcock Sep 16, 2024
6ee8edf
skipping another test
dpitcock Sep 16, 2024
fe07fa6
removing mouse events
dpitcock Sep 16, 2024
31a5d82
skipping failed integ pointer tests
dpitcock Sep 16, 2024
4b3c38e
using custom pointer tests for events on drawer triggers
dpitcock Sep 16, 2024
7c06ab2
using custom pointer tests for events on drawer triggers2
dpitcock Sep 16, 2024
b377727
stopping flicker of clicking button with badge on vr
dpitcock Sep 17, 2024
a8f099a
removing tooltips from visual-refresh
dpitcock Sep 17, 2024
62054d0
updating drawers in vr removing tooltip props
dpitcock Sep 17, 2024
84b7d3d
increasing coverage
dpitcock Sep 17, 2024
1a4b03d
removing unsaved console.log
dpitcock Sep 17, 2024
f71d73d
simplified handleFocus function and small comments
dpitcock Sep 17, 2024
a9429f9
removing unneccessary data-shift-focus
dpitcock Sep 18, 2024
27871e3
cleanup tests
dpitcock Sep 18, 2024
04d5668
removing need to check for if event is from breadcrumb
dpitcock Sep 18, 2024
6f71c23
removing uneccessary blank lines in test
dpitcock Sep 18, 2024
33d1e1f
fix mispellings in comments
dpitcock Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pages/app-layout/utils/drawer-ids.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
export const drawerIds = {
security: 'security',
proHelp: 'pro-help',
links: 'links',
test1: 'test-1',
test2: 'test-2',
test3: 'test-3',
test4: 'test-4',
test5: 'test-5',
test6: 'test-6',
};
dpitcock marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 11 additions & 9 deletions pages/app-layout/utils/drawers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import React from 'react';

import { AppLayoutProps, Drawer, SpaceBetween } from '~components';

import { drawerIds } from './drawer-ids';

import styles from '../styles.scss';

const getAriaLabels = (title: string, badge: boolean) => {
Expand Down Expand Up @@ -31,7 +33,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
{
ariaLabels: getAriaLabels('Security', false),
content: <Security />,
id: 'security',
id: drawerIds.security,
resizable: true,
onResize: (event: any) => {
// A drawer implementer may choose to listen to THEIR drawer's
Expand All @@ -48,7 +50,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
content: <Drawer header={<h2>Pro help</h2>}>Pro help.</Drawer>,
badge: true,
defaultSize: 600,
id: 'pro-help',
id: drawerIds.proHelp,
trigger: {
iconName: 'contact',
},
Expand All @@ -58,7 +60,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
resizable: true,
defaultSize: 500,
content: <Drawer header={<h2>Links</h2>}>Links.</Drawer>,
id: 'links',
id: drawerIds.links,
trigger: {
iconName: 'share',
},
Expand All @@ -67,7 +69,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
ariaLabels: getAriaLabels('Test 1', true),
content: <Drawer header={<h2>Test 1</h2>}>Test 1.</Drawer>,
badge: true,
id: 'test-1',
id: drawerIds.test1,
trigger: {
iconName: 'contact',
},
Expand All @@ -77,7 +79,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
resizable: true,
defaultSize: 500,
content: <Drawer header={<h2>Test 2</h2>}>Test 2.</Drawer>,
id: 'test-2',
id: drawerIds.test2,
trigger: {
iconName: 'share',
},
Expand All @@ -86,7 +88,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
ariaLabels: getAriaLabels('Test 3', true),
content: <Drawer header={<h2>Test 3</h2>}>Test 3.</Drawer>,
badge: true,
id: 'test-3',
id: drawerIds.test3,
trigger: {
iconName: 'contact',
},
Expand All @@ -96,7 +98,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
resizable: true,
defaultSize: 500,
content: <Drawer header={<h2>Test 4</h2>}>Test 4.</Drawer>,
id: 'test-4',
id: drawerIds.test4,
trigger: {
iconName: 'edit',
},
Expand All @@ -106,7 +108,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
resizable: true,
defaultSize: 500,
content: <Drawer header={<h2>Test 5</h2>}>Test 5.</Drawer>,
id: 'test-5',
id: drawerIds.test5,
trigger: {
iconName: 'add-plus',
},
Expand All @@ -116,7 +118,7 @@ export const drawerItems: Array<AppLayoutProps.Drawer> = [
resizable: true,
defaultSize: 500,
content: <Drawer header={<h2>Test 6</h2>}>Test 6.</Drawer>,
id: 'test-6',
id: drawerIds.test6,
trigger: {
iconName: 'call',
},
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/documenter.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ Each Drawer is an item in the drawers wrapper with the following properties:
- \`iconSvg\` (React.ReactNode) - (Optional) Specifies the SVG of a custom icon. For more information, see [SVG icon guidelines](/components/icon/?tabId=api#slots)

#### DrawerAriaLabels
- \`drawerName\` (string) - Label for the drawer itself.
- \`drawerName\` (string) - Label for the drawer itself, and for the drawer trigger button tooltip text.
dpitcock marked this conversation as resolved.
Show resolved Hide resolved
- \`closeButton\` (string) - (Optional) Label for the close button.
- \`triggerButton\` (string) - (Optional) Label for the trigger button.
- \`resizeHandle\` (string) - (Optional) Label for the resize handle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
)
);

//TODO create separate split panel test for appLayoutWidget is true

Check warning on line 55 in src/app-layout/__integ__/app-layout-focus-delegation.test.ts

View workflow job for this annotation

GitHub Actions / build / build

Unexpected 'todo' comment: 'TODO create separate split panel test...'
testIf(theme !== 'visual-refresh-toolbar')(
'split panel focus moves to slider on open and open button on close',
setupTest(
Expand Down Expand Up @@ -84,7 +84,7 @@
)
);

//TODO create separate split panel test for 'visual-refresh-toolbar' theme

Check warning on line 87 in src/app-layout/__integ__/app-layout-focus-delegation.test.ts

View workflow job for this annotation

GitHub Actions / build / build

Unexpected 'todo' comment: 'TODO create separate split panel test...'
testIf(theme !== 'visual-refresh-toolbar')(
'navigation panel focus toggles between open and close buttons',
setupTest(
Expand All @@ -105,7 +105,7 @@
)
);

//todo create test specifically for mobile and visual-refresh-toolbar

Check warning on line 108 in src/app-layout/__integ__/app-layout-focus-delegation.test.ts

View workflow job for this annotation

GitHub Actions / build / build

Unexpected 'todo' comment: 'todo create test specifically for mobile...'
testIf(theme !== 'visual-refresh-toolbar')(
'focuses tools panel closed button when it is opened using keyboard and caused split panel to change position',
setupTest(
Expand Down Expand Up @@ -139,6 +139,8 @@
setupTest(
async page => {
await page.click(wrapper.findSplitPanel().findOpenButton().toSelector());
await expect(page.isExisting(wrapper.findSplitPanel().toSelector())).resolves.toBeTruthy();
await page.keys('Escape'); //escape tooltip from still hovering over open trigger button
await page.click(wrapper.findSplitPanel().findPreferencesButton().toSelector());
await page.keys(['Tab', 'Left', 'Tab', 'Tab', 'Enter']);
await expect(page.isFocused(wrapper.findSplitPanel().findPreferencesButton().toSelector())).resolves.toBe(
Expand Down Expand Up @@ -239,7 +241,7 @@
);

describe('drawer focus interaction with tools buttons', () => {
//todo resolve focus issue returning to previously focued element on mobile for drawer open button

Check warning on line 244 in src/app-layout/__integ__/app-layout-focus-delegation.test.ts

View workflow job for this annotation

GitHub Actions / build / build

Unexpected 'todo' comment: 'todo resolve focus issue returning to...'
testIf(theme !== 'visual-refresh-toolbar')(
'moves focus to close button when panel is opened from button',
setupTest(
Expand Down Expand Up @@ -311,7 +313,6 @@
await page.click(wrapper.findContentRegion().findContainer().toSelector());
await page.click(wrapper.findActiveDrawerCloseButton().toSelector());
await expect(page.isFocused(infoLink)).resolves.toBe(false);

await expect(page.isFocused(wrapper.findDrawerTriggerById('pro-help').toSelector())).resolves.toBe(true);
},
{ pageName: 'with-drawers', theme, mobile }
Expand Down
Loading
Loading