Skip to content

Commit 123e3ee

Browse files
authored
fix: release audit pt 2 (#8576)
* fix: release audit pt 2 * fix tests * update toast testid * fix lint * add testing docs to toast * remove zindex * fix rac and rsp togglebutton types * updates from reviews
1 parent 29dcc16 commit 123e3ee

File tree

14 files changed

+52
-27
lines changed

14 files changed

+52
-27
lines changed

packages/@react-spectrum/dialog/docs/AlertDialog.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,8 @@ Please see the following sections in the testing docs for more information on ho
250250

251251
Please also refer to [React Spectrum's test suite](https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/contextualhelp/test/ContextualHelp.test.js) if you find that the above
252252
isn't sufficient when resolving issues in your own test cases.
253+
254+
To identify a particular instance of the cancel, secondary, or confirm button, you can use the following data-testid's respectively:
255+
- `"rsp-AlertDialog-cancelButton"`
256+
- `"rsp-AlertDialog-secondaryButton"`
257+
- `"rsp-AlertDialog-confirmButton"`

packages/@react-spectrum/dialog/src/AlertDialog.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
8787
variant="secondary"
8888
onPress={() => chain(onClose(), onCancel())}
8989
autoFocus={autoFocusButton === 'cancel'}
90-
data-testid="rsp-alertDialog-cancelButton">
90+
data-testid="rsp-AlertDialog-cancelButton">
9191
{cancelLabel}
9292
</Button>
9393
}
@@ -97,7 +97,7 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
9797
onPress={() => chain(onClose(), onSecondaryAction())}
9898
isDisabled={isSecondaryActionDisabled}
9999
autoFocus={autoFocusButton === 'secondary'}
100-
data-testid="rsp-alertDialog-secondaryButton">
100+
data-testid="rsp-AlertDialog-secondaryButton">
101101
{secondaryActionLabel}
102102
</Button>
103103
}
@@ -106,7 +106,7 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
106106
onPress={() => chain(onClose(), onPrimaryAction())}
107107
isDisabled={isPrimaryActionDisabled}
108108
autoFocus={autoFocusButton === 'primary'}
109-
data-testid="rsp-alertDialog-confirmButton">
109+
data-testid="rsp-AlertDialog-confirmButton">
110110
{primaryActionLabel}
111111
</Button>
112112
</ButtonGroup>

packages/@react-spectrum/dialog/test/AlertDialog.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ describe('AlertDialog', function () {
196196

197197
let dialog = getByTestId('alert-dialog');
198198
expect(dialog).toBeDefined();
199-
let cancelBtn = getByTestId('rsp-alertDialog-cancelButton');
199+
let cancelBtn = getByTestId('rsp-AlertDialog-cancelButton');
200200
expect(cancelBtn).toBeDefined();
201-
let secondaryBtn = getByTestId('rsp-alertDialog-secondaryButton');
201+
let secondaryBtn = getByTestId('rsp-AlertDialog-secondaryButton');
202202
expect(secondaryBtn).toBeDefined();
203-
let primaryBtn = getByTestId('rsp-alertDialog-confirmButton');
203+
let primaryBtn = getByTestId('rsp-AlertDialog-confirmButton');
204204
expect(primaryBtn).toBeDefined();
205205
});
206206
});

packages/@react-spectrum/s2/src/AlertDialog.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: AlertDialogPro
129129
onPress={() => chain(close(), onCancel())}
130130
variant="secondary"
131131
fillStyle="outline"
132-
autoFocus={autoFocusButton === 'cancel'}>
132+
autoFocus={autoFocusButton === 'cancel'}
133+
data-testid="rsp-AlertDialog-cancelButton">
133134
{cancelLabel}
134135
</Button>
135136
}
@@ -139,15 +140,17 @@ export const AlertDialog = forwardRef(function AlertDialog(props: AlertDialogPro
139140
variant="secondary"
140141
isDisabled={isSecondaryActionDisabled}
141142
fillStyle="outline"
142-
autoFocus={autoFocusButton === 'secondary'}>
143+
autoFocus={autoFocusButton === 'secondary'}
144+
data-testid="rsp-AlertDialog-secondaryButton">
143145
{secondaryActionLabel}
144146
</Button>
145147
}
146148
<Button
147149
variant={buttonVariant as 'primary' | 'accent' | 'negative'}
148150
isDisabled={isPrimaryActionDisabled}
149151
autoFocus={autoFocusButton === 'primary'}
150-
onPress={() => chain(close(), onPrimaryAction())}>
152+
onPress={() => chain(close(), onPrimaryAction())}
153+
data-testid="rsp-AlertDialog-confirmButton">
151154
{primaryActionLabel}
152155
</Button>
153156
</ButtonGroup>

packages/@react-spectrum/s2/src/Content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface ContentProps extends UnsafeStyles, SlotProps {
2828
}
2929

3030
interface HeadingProps extends Omit<ContentProps, 'children'> {
31-
children?: ReactNode,
31+
children: ReactNode,
3232
level?: number
3333
}
3434

packages/@react-spectrum/s2/src/Modal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ const modalOverlayStyles = style({
4444
transitionDuration: {
4545
default: 250,
4646
isExiting: 130
47-
},
48-
zIndex: 9999
47+
}
4948
});
5049

5150
/**

packages/@react-spectrum/s2/src/Picker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export interface PickerStyleProps {
8686
size?: 'S' | 'M' | 'L' | 'XL',
8787
/**
8888
* Whether the picker should be displayed with a quiet style.
89+
* @private
8990
*/
9091
isQuiet?: boolean
9192
}

packages/@react-spectrum/s2/src/Popover.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ let popover = style({
116116
isExiting: 'in'
117117
},
118118
isolation: 'isolate',
119-
zIndex: 9999,
120119
pointerEvents: {
121120
isExiting: 'none'
122121
},

packages/@react-spectrum/s2/src/Provider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ let providerStyles = style({
9191
'layer-1': '--s2-container-bg',
9292
'layer-2': '--s2-container-bg'
9393
}
94-
}
94+
},
95+
isolation: 'isolate'
9596
});
9697

9798
function ProviderInner(props: ProviderProps) {

packages/@react-spectrum/toast/docs/Toast.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,9 @@ By default, toasts are displayed at the bottom center of the screen. This can be
196196
<TypeContext.Provider value={docs.links}>
197197
<InterfaceType properties={docs.exports.ToastContainer.props.properties} showRequired showDefault isComponent />
198198
</TypeContext.Provider>
199+
200+
## Testing
201+
202+
To identify a particular instance of the secondary or close button, you can use the following data-testid's respectively:
203+
- `"rsp-Toast-secondaryButton"`
204+
- `"rsp-Toast-closeButton"`

0 commit comments

Comments
 (0)