-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor UI adjustments and ManifestActionBtns test suite
Adjust ManifestForm test suite to accommodate multiple save buttons (one floating action button, one regular) Minor changes to make HtSpinner for flexible and use correct profile selector in Profile Feature
- Loading branch information
1 parent
82fa663
commit 5a63be3
Showing
14 changed files
with
258 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
client/src/components/Manifest/ActionBtns/ManifestActionBtns.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import '@testing-library/jest-dom'; | ||
import { ManifestActionBtns } from 'components/Manifest/ActionBtns/ManifestActionBtns'; | ||
import React from 'react'; | ||
import { cleanup, renderWithProviders, screen } from 'test-utils'; | ||
import { afterEach, describe, expect, test } from 'vitest'; | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); | ||
|
||
describe('ManifestActionBtns', () => { | ||
test.each([ | ||
['Scheduled', true], | ||
['Scheduled', false], | ||
['NotAssigned', false], | ||
['NotAssigned', true], | ||
])('renders a save button when editing and {status: "%s", signAble: %s}', (status, signAble) => { | ||
renderWithProviders( | ||
// @ts-ignore - Status is expected to be a ManifestStatus, but we're passing a string | ||
<ManifestActionBtns readOnly={false} manifestStatus={status} signAble={signAble} /> | ||
); | ||
expect(screen.queryByRole('button', { name: /Save/i })).toBeInTheDocument(); | ||
}); | ||
test.each([[true, false]])( | ||
'renders a edit button when {readOnly: %s, signAble: %s}', | ||
(readOnly, signAble) => { | ||
renderWithProviders( | ||
// @ts-ignore - Status is expected to be a ManifestStatus, but we're passing a string | ||
<ManifestActionBtns readOnly={readOnly} manifestStatus={'Scheduled'} signAble={signAble} /> | ||
); | ||
expect(screen.queryByRole('button', { name: /Edit/i })).toBeInTheDocument(); | ||
expect(screen.queryByRole('button', { name: /Sign/i })).not.toBeInTheDocument(); | ||
expect(screen.queryByRole('button', { name: /Save/i })).not.toBeInTheDocument(); | ||
} | ||
); | ||
test.each([[true, true]])( | ||
'renders a sign button when {readOnly: %s, signAble: %s}', | ||
(readOnly, signAble) => { | ||
renderWithProviders( | ||
// @ts-ignore - Status is expected to be a ManifestStatus, but we're passing a string | ||
<ManifestActionBtns readOnly={readOnly} manifestStatus={'Scheduled'} signAble={signAble} /> | ||
); | ||
expect(screen.queryByRole('button', { name: /Sign/i })).toBeInTheDocument(); | ||
} | ||
); | ||
test.each([ | ||
[true, true], | ||
[true, false], | ||
[false, false], | ||
[false, true], | ||
])( | ||
'never renders a sign button when draft status with {readOnly: %s, signAble: %s}', | ||
(readOnly, signAble) => { | ||
renderWithProviders( | ||
// @ts-ignore - Status is expected to be a ManifestStatus, but we're passing a string | ||
<ManifestActionBtns | ||
readOnly={readOnly} | ||
manifestStatus={'NotAssigned'} | ||
signAble={signAble} | ||
/> | ||
); | ||
expect(screen.queryByRole('button', { name: /Sign/i })).not.toBeInTheDocument(); | ||
} | ||
); | ||
}); |
44 changes: 25 additions & 19 deletions
44
client/src/components/Manifest/ActionBtns/ManifestActionBtns.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.