Skip to content

Commit

Permalink
fix: S3 resource selector findModal selector test util returning inco…
Browse files Browse the repository at this point in the history
…rrect modal (#2977)
  • Loading branch information
michaeldowseza authored Nov 4, 2024
1 parent 20fb841 commit 8aba95c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ exports[`test-utils selectors 1`] = `
"awsui_browse-button_1vtzr",
"awsui_layout-uri_1vtzr",
"awsui_layout-version_1vtzr",
"awsui_modal-root_rkh1e",
"awsui_root_1u0yw",
"awsui_root_1vtzr",
"awsui_submit-button_12hyz",
Expand Down
2 changes: 2 additions & 0 deletions src/s3-resource-selector/s3-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BucketsTable } from './buckets-table';
import { ObjectsTable } from './objects-table';
import { VersionsTable } from './versions-table';

import testUtilStyles from '../test-classes/styles.css.js';
import styles from './styles.css.js';

export interface S3ModalProps {
Expand Down Expand Up @@ -125,6 +126,7 @@ export function S3Modal({
return (
<div>
<InternalModal
className={testUtilStyles['modal-root']}
visible={true}
size="max"
getModalRoot={getModalRoot}
Expand Down
8 changes: 8 additions & 0 deletions src/s3-resource-selector/test-classes/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

.modal-root {
/* used in test-utils */
}
3 changes: 2 additions & 1 deletion src/test-utils/dom/s3-resource-selector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TableWrapper from '../table';
import inContextStyles from '../../../s3-resource-selector/s3-in-context/styles.selectors.js';
import modalStyles from '../../../s3-resource-selector/s3-modal/styles.selectors.js';
import styles from '../../../s3-resource-selector/styles.selectors.js';
import testUtilStyles from '../../../s3-resource-selector/test-classes/styles.selectors.js';

class S3ModalWrapper extends ModalWrapper {
findSubmitButton(): ButtonWrapper {
Expand Down Expand Up @@ -50,7 +51,7 @@ export default class S3ResourceSelectorWrapper extends ComponentWrapper {
}

findModal(): S3ModalWrapper | null {
const modal = createWrapper().findModal();
const modal = createWrapper().findModal(`.${testUtilStyles['modal-root']}`);
return modal && new S3ModalWrapper(modal.getElement());
}

Expand Down

0 comments on commit 8aba95c

Please sign in to comment.