diff --git a/app/javascript/__tests__/notifier.test.js b/app/javascript/__tests__/notifier.test.js index 6b8ba65643..acdce50ae1 100644 --- a/app/javascript/__tests__/notifier.test.js +++ b/app/javascript/__tests__/notifier.test.js @@ -34,9 +34,9 @@ describe('Notifier', () => { const successMessages = notificationsElement.find('.success-indicator') - // Notifications contain the "Saved" message and the new message + // Notifications contain the hidden "Saved" message and the new message expect(successMessages.length).toBe(2) - expect(successMessages[1].innerHTML).toContain(escape(notificationMessage)) + expect(successMessages[1].innerHTML).toContain(notificationMessage) done() } catch (error) { done(error) @@ -54,7 +54,7 @@ describe('Notifier', () => { const failureMessages = notificationsElement.find('.failure-indicator') expect(failureMessages.length).toBe(1) - expect(failureMessages[0].innerHTML).toContain(escape(notificationMessage)) + expect(failureMessages[0].innerHTML).toContain(notificationMessage) done() } catch (error) { done(error) @@ -328,10 +328,10 @@ describe('Notifications', () => { test('removes the notification elements', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) notification.dismiss() - expect(notificationsElement[0].innerHTML).not.toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage) done() } catch (error) { done(error) @@ -342,10 +342,10 @@ describe('Notifications', () => { test('should throw an error if the notification has already been dismissed', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) notification.dismiss() - expect(notificationsElement[0].innerHTML).not.toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage) expect(() => { notification.dismiss() @@ -362,8 +362,8 @@ describe('Notifications', () => { test('should return the text of the notification', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) - expect(notification.getText()).toBe(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) + expect(notification.getText()).toBe(notificationDefaultMessage) done() } catch (error) { @@ -377,7 +377,7 @@ describe('Notifications', () => { test('returns a truthy value if there is a dismiss button, false otherwise', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) expect(notification.isUserDismissable()).toBeTruthy() notification.notificationElement.children('button').remove() @@ -428,7 +428,7 @@ describe('Notifications', () => { const notificationMessage = 'mn6#:6C^*hnQ/:cC;2mM' notification = notifier.notify(notificationMessage, 'info', false) - expect(notificationsElement[0].innerHTML).toContain(escape(notificationMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationMessage) expect(notification.notificationElement.children('button').length).toBe(0) notification.setUserDismissable(true) @@ -448,7 +448,7 @@ describe('Notifications', () => { test('does nothing if the notification is already in the desired state', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) expect(notification.notificationElement.children('button').length).toBe(1) notification.setUserDismissable(true) @@ -458,7 +458,7 @@ describe('Notifications', () => { const notificationMessage = 'fd@4g*G@.6sV{!^Yj*TR' notification = notifier.notify(notificationMessage, 'info', false) - expect(notificationsElement[0].innerHTML).toContain(escape(notificationMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationMessage) expect(notification.notificationElement.children('button').length).toBe(0) notification.setUserDismissable(false) @@ -474,7 +474,7 @@ 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(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) expect(notification.notificationElement.children('button').length).toBe(1) notification.setUserDismissable(false) @@ -491,7 +491,7 @@ describe('Notifications', () => { $(() => { try { notification.notificationElement.remove() - expect(notificationsElement[0].innerHTML).not.toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage) expect(() => { notification.setUserDismissable(true) @@ -508,13 +508,13 @@ describe('Notifications', () => { test('changes the text of the notification', (done) => { $(() => { try { - expect(notificationsElement[0].innerHTML).toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage) const newNotificationMessage = 'VOr%%:#Vc*tbNbM}iUT}' notification.setText(newNotificationMessage) - expect(notification.notificationElement.text()).toContain(escape(newNotificationMessage)) + expect(notification.notificationElement.text()).toContain(newNotificationMessage) done() } catch (error) { done(error) @@ -526,7 +526,7 @@ describe('Notifications', () => { $(() => { try { notification.notificationElement.remove() - expect(notificationsElement[0].innerHTML).not.toContain(escape(notificationDefaultMessage)) + expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage) expect(() => { notification.setText('new Text')