Skip to content

Commit

Permalink
added tests preventing setUserDismissable from making unexpected changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Oct 7, 2023
1 parent d42f3fb commit 90248cb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/javascript/__tests__/notifier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,22 @@ describe('Notifications', () => {
test('does nothing if the notification is already in the desired state', (done) => {
$(() => {
try {
expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage)
expect(notification.notificationElement.children('button').length).toBe(1)

notification.setUserDismissable(true)

expect(notification.notificationElement.children('button').length).toBe(1)

const notificationMessage = 'fd@4g*[email protected]{!^Yj*TR'
notification = notifier.notify(notificationMessage, 'info', false)

expect(notificationsElement[0].innerHTML).toContain(notificationMessage)
expect(notification.notificationElement.children('button').length).toBe(0)

notification.setUserDismissable(false)

expect(notification.notificationElement.children('button').length).toBe(0)
done()
} catch (error) {
done(error)
Expand Down

0 comments on commit 90248cb

Please sign in to comment.