Skip to content

Commit

Permalink
filled in rest of setUserDismissable
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Oct 7, 2023
1 parent 90248cb commit effe696
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/javascript/__tests__/notifier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ describe('Notifications', () => {
expect(() => {
notification.dismiss()
}).toThrow(ReferenceError)

done()
} catch (error) {
done(error)
Expand Down Expand Up @@ -474,6 +473,12 @@ describe('Notifications', () => {
test('removes the dismiss button that removes the notification element when clicked if the button is present', (done) => {
$(() => {
try {
expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage)
expect(notification.notificationElement.children('button').length).toBe(1)

notification.setUserDismissable(false)

expect(notification.notificationElement.children('button').length).toBe(0)
done()
} catch (error) {
done(error)
Expand All @@ -484,6 +489,12 @@ describe('Notifications', () => {
test('throws an error if the notification is dismissed', (done) => {
$(() => {
try {
notification.notificationElement.remove()
expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage)

expect(() => {
notification.setUserDismissable(true)
}).toThrow(ReferenceError)
done()
} catch (error) {
done(error)
Expand Down

0 comments on commit effe696

Please sign in to comment.