Skip to content

Commit b488557

Browse files
committed
feat(Wizard,ClipboardCopy): add OUIA props to WizardNav, WizardNavItem, ClipboardCopy
1 parent b0280dc commit b488557

File tree

9 files changed

+83
-9
lines changed

9 files changed

+83
-9
lines changed

packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { GenerateId } from '../../helpers/GenerateId/GenerateId';
99
import { ClipboardCopyButton } from './ClipboardCopyButton';
1010
import { ClipboardCopyToggle } from './ClipboardCopyToggle';
1111
import { ClipboardCopyExpanded } from './ClipboardCopyExpanded';
12+
import { getOUIAProps, OUIAProps } from '../../helpers';
1213

1314
export const clipboardCopyFunc = (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => {
1415
const clipboard = event.currentTarget.parentElement;
@@ -32,7 +33,7 @@ export interface ClipboardCopyState {
3233
copied: boolean;
3334
}
3435

35-
export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
36+
export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'>, OUIAProps {
3637
/** Additional classes added to the clipboard copy container. */
3738
className?: string;
3839
/** Tooltip message to display when hover the copy button */
@@ -118,7 +119,8 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
118119
onChange: (): any => undefined,
119120
textAriaLabel: 'Copyable input',
120121
toggleAriaLabel: 'Show content',
121-
additionalActions: null
122+
additionalActions: null,
123+
ouiaSafe: true
122124
};
123125

124126
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -168,6 +170,8 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
168170
position,
169171
className,
170172
additionalActions,
173+
ouiaId,
174+
ouiaSafe,
171175
...divProps
172176
} = this.props;
173177
const textIdPrefix = 'text-input-';
@@ -183,6 +187,7 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
183187
className
184188
)}
185189
{...divProps}
190+
{...getOUIAProps(ClipboardCopy.displayName, ouiaId, ouiaSafe)}
186191
>
187192
{variant === 'inline-compact' && (
188193
<GenerateId prefix="">

packages/react-core/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopy.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ exports[`ClipboardCopy should match snapshot (auto-generated) 1`] = `
44
<DocumentFragment>
55
<div
66
class="pf-c-clipboard-copy string"
7+
data-ouia-component-type="PF4/ClipboardCopy"
8+
data-ouia-safe="true"
79
>
810
<div
911
class="pf-c-clipboard-copy__group"

packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ id: Clipboard copy
33
section: components
44
cssPrefix: pf-c-copyclipboard
55
propComponents: ['ClipboardCopy', 'ClipboardCopyButton']
6+
ouia: true
67
---
78

89
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';

packages/react-core/src/components/Wizard/WizardNav.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as React from 'react';
22
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
33
import { css } from '@patternfly/react-styles';
4+
import { useOUIAProps, OUIAProps } from '../../helpers';
45

5-
export interface WizardNavProps {
6+
export interface WizardNavProps extends OUIAProps {
67
/** children should be WizardNavItem components */
78
children?: any;
89
/** Aria-label applied to the nav element */
@@ -20,8 +21,12 @@ export const WizardNav: React.FunctionComponent<WizardNavProps> = ({
2021
'aria-label': ariaLabel,
2122
'aria-labelledby': ariaLabelledBy,
2223
isOpen = false,
23-
returnList = false
24+
returnList = false,
25+
ouiaId,
26+
ouiaSafe = true
2427
}: WizardNavProps) => {
28+
const ouiaProps = useOUIAProps(WizardNav.displayName, ouiaId, ouiaSafe);
29+
2530
const innerList = <ol className={css(styles.wizardNavList)}>{children}</ol>;
2631

2732
if (returnList) {
@@ -33,6 +38,7 @@ export const WizardNav: React.FunctionComponent<WizardNavProps> = ({
3338
className={css(styles.wizardNav, isOpen && styles.modifiers.expanded)}
3439
aria-label={ariaLabel}
3540
aria-labelledby={ariaLabelledBy}
41+
{...ouiaProps}
3642
>
3743
<ol className={css(styles.wizardNavList)}>{children}</ol>
3844
</nav>

packages/react-core/src/components/Wizard/WizardNavItem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import * as React from 'react';
22
import { css } from '@patternfly/react-styles';
33
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
44
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
5+
import { useOUIAProps, OUIAProps } from '../../helpers';
56

6-
export interface WizardNavItemProps {
7+
export interface WizardNavItemProps extends OUIAProps {
78
/** Can nest a WizardNav component for substeps */
89
children?: React.ReactNode;
910
/** The content to display in the nav item */
@@ -37,8 +38,11 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
3738
href = null,
3839
isExpandable = false,
3940
id,
41+
ouiaId,
42+
ouiaSafe = true,
4043
...rest
4144
}: WizardNavItemProps) => {
45+
const ouiaProps = useOUIAProps(WizardNavItem.displayName, ouiaId, ouiaSafe);
4246
const NavItemComponent = navItemComponent;
4347

4448
const [isExpanded, setIsExpanded] = React.useState(false);
@@ -82,6 +86,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
8286
aria-disabled={isDisabled ? true : null}
8387
aria-current={isCurrent && !children ? 'step' : false}
8488
{...(isExpandable && { 'aria-expanded': isExpanded })}
89+
{...ouiaProps}
8590
>
8691
{isExpandable ? (
8792
<>

packages/react-core/src/components/Wizard/__tests__/Generated/__snapshots__/WizardNav.test.tsx.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ exports[`WizardNav should match snapshot (auto-generated) 1`] = `
66
aria-label="string"
77
aria-labelledby="string"
88
class="pf-c-wizard__nav"
9+
data-ouia-component-id="OUIA-Generated-WizardNav-1"
10+
data-ouia-component-type="PF4/WizardNav"
11+
data-ouia-safe="true"
912
>
1013
<ol
1114
class="pf-c-wizard__nav-list"

packages/react-core/src/components/Wizard/__tests__/Generated/__snapshots__/WizardNavItem.test.tsx.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ exports[`WizardNavItem should match snapshot (auto-generated) 1`] = `
88
<button
99
aria-current="false"
1010
class="pf-c-wizard__nav-link"
11+
data-ouia-component-id="OUIA-Generated-WizardNavItem-1"
12+
data-ouia-component-type="PF4/WizardNavItem"
13+
data-ouia-safe="true"
1114
/>
1215
ReactNode
1316
</li>

packages/react-core/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
9494
<nav
9595
aria-labelledby="pf-wizard-title-1"
9696
class="pf-c-wizard__nav"
97+
data-ouia-component-id="OUIA-Generated-WizardNav-3"
98+
data-ouia-component-type="PF4/WizardNav"
99+
data-ouia-safe="true"
97100
>
98101
<ol
99102
class="pf-c-wizard__nav-list"
@@ -104,6 +107,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
104107
<button
105108
aria-current="step"
106109
class="pf-c-wizard__nav-link pf-m-current"
110+
data-ouia-component-id="OUIA-Generated-WizardNavItem-7"
111+
data-ouia-component-type="PF4/WizardNavItem"
112+
data-ouia-safe="true"
107113
>
108114
A
109115
</button>
@@ -115,6 +121,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
115121
aria-current="false"
116122
aria-expanded="false"
117123
class="pf-c-wizard__nav-link"
124+
data-ouia-component-id="OUIA-Generated-WizardNavItem-8"
125+
data-ouia-component-type="PF4/WizardNavItem"
126+
data-ouia-safe="true"
118127
>
119128
<span
120129
class="pf-c-wizard__nav-link-text"
@@ -152,6 +161,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
152161
<button
153162
aria-current="false"
154163
class="pf-c-wizard__nav-link"
164+
data-ouia-component-id="OUIA-Generated-WizardNavItem-9"
165+
data-ouia-component-type="PF4/WizardNavItem"
166+
data-ouia-safe="true"
155167
>
156168
B-1
157169
</button>
@@ -162,6 +174,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
162174
<button
163175
aria-current="false"
164176
class="pf-c-wizard__nav-link"
177+
data-ouia-component-id="OUIA-Generated-WizardNavItem-10"
178+
data-ouia-component-type="PF4/WizardNavItem"
179+
data-ouia-safe="true"
165180
>
166181
B-2
167182
</button>
@@ -174,6 +189,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
174189
<button
175190
aria-current="false"
176191
class="pf-c-wizard__nav-link"
192+
data-ouia-component-id="OUIA-Generated-WizardNavItem-11"
193+
data-ouia-component-type="PF4/WizardNavItem"
194+
data-ouia-safe="true"
177195
>
178196
C
179197
</button>
@@ -184,6 +202,9 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
184202
<button
185203
aria-current="false"
186204
class="pf-c-wizard__nav-link"
205+
data-ouia-component-id="OUIA-Generated-WizardNavItem-12"
206+
data-ouia-component-type="PF4/WizardNavItem"
207+
data-ouia-safe="true"
187208
>
188209
D
189210
</button>
@@ -341,6 +362,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
341362
<nav
342363
aria-labelledby="pf-wizard-title-0"
343364
class="pf-c-wizard__nav"
365+
data-ouia-component-id="OUIA-Generated-WizardNav-1"
366+
data-ouia-component-type="PF4/WizardNav"
367+
data-ouia-safe="true"
344368
>
345369
<ol
346370
class="pf-c-wizard__nav-list"
@@ -351,6 +375,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
351375
<button
352376
aria-current="step"
353377
class="pf-c-wizard__nav-link pf-m-current"
378+
data-ouia-component-id="OUIA-Generated-WizardNavItem-1"
379+
data-ouia-component-type="PF4/WizardNavItem"
380+
data-ouia-safe="true"
354381
id="step-A"
355382
>
356383
A
@@ -362,6 +389,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
362389
<button
363390
aria-current="false"
364391
class="pf-c-wizard__nav-link"
392+
data-ouia-component-id="OUIA-Generated-WizardNavItem-2"
393+
data-ouia-component-type="PF4/WizardNavItem"
394+
data-ouia-safe="true"
365395
id="step-B"
366396
>
367397
B
@@ -375,6 +405,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
375405
<button
376406
aria-current="false"
377407
class="pf-c-wizard__nav-link"
408+
data-ouia-component-id="OUIA-Generated-WizardNavItem-3"
409+
data-ouia-component-type="PF4/WizardNavItem"
410+
data-ouia-safe="true"
378411
id="step-B-1"
379412
>
380413
B-1
@@ -386,6 +419,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
386419
<button
387420
aria-current="false"
388421
class="pf-c-wizard__nav-link"
422+
data-ouia-component-id="OUIA-Generated-WizardNavItem-4"
423+
data-ouia-component-type="PF4/WizardNavItem"
424+
data-ouia-safe="true"
389425
id="step-B-2"
390426
>
391427
B-2
@@ -399,6 +435,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
399435
<button
400436
aria-current="false"
401437
class="pf-c-wizard__nav-link"
438+
data-ouia-component-id="OUIA-Generated-WizardNavItem-5"
439+
data-ouia-component-type="PF4/WizardNavItem"
440+
data-ouia-safe="true"
402441
id="step-C"
403442
>
404443
C
@@ -410,6 +449,9 @@ exports[`Wizard Wizard should match snapshot 1`] = `
410449
<button
411450
aria-current="false"
412451
class="pf-c-wizard__nav-link"
452+
data-ouia-component-id="OUIA-Generated-WizardNavItem-6"
453+
data-ouia-component-type="PF4/WizardNavItem"
454+
data-ouia-safe="true"
413455
id="step-D"
414456
>
415457
D
@@ -525,6 +567,9 @@ exports[`Wizard bare wiz 1`] = `
525567
>
526568
<nav
527569
class="pf-c-wizard__nav"
570+
data-ouia-component-id="OUIA-Generated-WizardNav-5"
571+
data-ouia-component-type="PF4/WizardNav"
572+
data-ouia-safe="true"
528573
>
529574
<ol
530575
class="pf-c-wizard__nav-list"
@@ -535,6 +580,9 @@ exports[`Wizard bare wiz 1`] = `
535580
<button
536581
aria-current="step"
537582
class="pf-c-wizard__nav-link pf-m-current"
583+
data-ouia-component-id="OUIA-Generated-WizardNavItem-13"
584+
data-ouia-component-type="PF4/WizardNavItem"
585+
data-ouia-safe="true"
538586
>
539587
A
540588
</button>

packages/react-core/src/components/Wizard/examples/Wizard.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ section: components
44
cssPrefix: pf-c-wizard
55
propComponents:
66
['Wizard', 'WizardNav', 'WizardNavItem', 'WizardHeader', 'WizardBody', 'WizardFooter', 'WizardToggle', 'WizardStep']
7+
ouia: true
78
---
89

910
import { Button, Drawer, DrawerActions, DrawerCloseButton, DrawerColorVariant,
@@ -812,10 +813,10 @@ class GetCurrentStepWizard extends React.Component {
812813
step: 1
813814
};
814815
this.onCurrentStepChanged = ({ id }) => {
815-
this.setState({
816-
step: id
817-
});
818-
}
816+
this.setState({
817+
step: id
818+
});
819+
};
819820
this.closeWizard = () => {
820821
console.log('close wizard');
821822
};

0 commit comments

Comments
 (0)