Skip to content

Commit

Permalink
rolled back escape calls for only tests that require them
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Oct 8, 2023
1 parent 76b4ef5 commit 4ed5ea3
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions app/javascript/__tests__/notifier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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) {
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -458,7 +458,7 @@ describe('Notifications', () => {
const notificationMessage = 'fd@4g*[email protected]{!^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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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')
Expand Down

0 comments on commit 4ed5ea3

Please sign in to comment.