Skip to content

Commit

Permalink
fix: changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Jan 11, 2024
1 parent bc966b4 commit 3cf5758
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/taxonomy/manage-orgs/ManageOrgsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ManageOrgsModal = ({
if (setToastMessage) {
setToastMessage(intl.formatMessage(messages.assignOrgsSuccess));
}
} catch (/** @type {any} */ error) {
} catch (error) {
// ToDo: display the error to the user
} finally {
enableDialog();
Expand Down Expand Up @@ -131,9 +131,9 @@ const ManageOrgsModal = ({
useEffect(() => {
if (selectedOrgs) {
// This is a hack to force the Form.Autosuggest to clear its value after a selection is made.
const inputRef = /** @type {null|HTMLInputElement} */ (document.querySelector('.pgn__form-group input'));
const inputRef = /** @type {null|HTMLInputElement} */ (document.querySelector('.manage-orgs .pgn__form-group input'));
if (inputRef) {
// @ts-ignore
// @ts-ignore value can be null
inputRef.value = null;
const event = new Event('change', { bubbles: true });
inputRef.dispatchEvent(event);
Expand All @@ -153,7 +153,6 @@ const ManageOrgsModal = ({
isOpen={isOpen}
onClose={onClose}
size="lg"
disabled={isDialogDisabled}
hasCloseButton
isFullscreenOnMobile
>
Expand Down
9 changes: 6 additions & 3 deletions src/taxonomy/taxonomy-menu/TaxonomyMenu.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ describe.each([true, false])('<TaxonomyMenu iconMenu=%s />', async (iconMenu) =>
});

it('should open manage orgs dialog menu click', async () => {
const { getByTestId, getByText, queryByText } = render(<TaxonomyMenuComponent iconMenu={iconMenu} />);
const {
findByText, getByTestId, getByText, queryByText,
} = render(<TaxonomyMenuComponent iconMenu={iconMenu} />);

// We need to provide a taxonomy or the modal will not open
getTaxonomy.mockResolvedValue({
id: 1,
Expand All @@ -267,12 +270,12 @@ describe.each([true, false])('<TaxonomyMenu iconMenu=%s />', async (iconMenu) =>
fireEvent.click(getByTestId('taxonomy-menu-manageOrgs'));

// Modal opened
await waitFor(() => expect(getByText('Assign to organizations')).toBeInTheDocument());
expect(await findByText('Assign to organizations')).toBeInTheDocument();

// Click on cancel button
fireEvent.click(getByText('Cancel'));

// Modal closed
expect(() => getByText('Assign to organizations')).toThrow();
expect(queryByText('Assign to organizations')).not.toBeInTheDocument();
});
});

0 comments on commit 3cf5758

Please sign in to comment.