-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various fixes in Notifications (#161)
* fix: preset in Description component * fix: minor layout fixes * fix: missing onDismiss, add null to duration in toast, remove the duplicate module * fix: review issues
- Loading branch information
1 parent
f0ac89a
commit f5976df
Showing
13 changed files
with
75 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@cube-dev/ui-kit": patch | ||
--- | ||
|
||
Fixed description preset in notificaiton |
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
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
14 changes: 0 additions & 14 deletions
14
src/components/overlays/NewNotifications/NotificationsContext/use-notifications-api.ts
This file was deleted.
Oops, something went wrong.
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
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,30 @@ | ||
import { Toast } from './Toast'; | ||
import { renderWithRoot, screen } from '../../../test'; | ||
|
||
describe('useToastsApi', () => { | ||
beforeAll(() => jest.useFakeTimers('modern')); | ||
afterAll(() => jest.useRealTimers()); | ||
|
||
it('should add and dismiss toast on timeout', async () => { | ||
const dismiss = jest.fn(); | ||
renderWithRoot(<Toast description="Test" onDismiss={dismiss} />); | ||
|
||
jest.runAllTimers(); | ||
|
||
expect( | ||
screen.queryByTestId('floating-notification'), | ||
).not.toBeInTheDocument(); | ||
expect(dismiss).toBeCalledTimes(1); | ||
}); | ||
|
||
it('should not unmount if duration is null', async () => { | ||
const dismiss = jest.fn(); | ||
renderWithRoot( | ||
<Toast description="Test" duration={null} onDismiss={dismiss} />, | ||
); | ||
|
||
jest.runAllTimers(); | ||
expect(screen.getByTestId('floating-notification')).toBeInTheDocument(); | ||
expect(dismiss).not.toBeCalled(); | ||
}); | ||
}); |
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