From 1bfe68aae04dc1e31a8bcc4f4ab92af55998a728 Mon Sep 17 00:00:00 2001 From: firelemons Date: Tue, 26 Sep 2023 19:14:16 -0500 Subject: [PATCH] rename some async notifier symbols to just notifier --- app/assets/stylesheets/shared/notifier.scss | 2 +- app/javascript/__tests__/notifier.test.js | 24 +++++++++---------- .../src/all_casa_admin/patch_notes.js | 2 +- app/javascript/src/case_emancipation.js | 4 ++-- app/javascript/src/dashboard.js | 8 +++---- app/views/layouts/_notifier.erb | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/assets/stylesheets/shared/notifier.scss b/app/assets/stylesheets/shared/notifier.scss index dfb441b2b5..e9965b5689 100644 --- a/app/assets/stylesheets/shared/notifier.scss +++ b/app/assets/stylesheets/shared/notifier.scss @@ -7,7 +7,7 @@ } } -#async-notifications { +#notifications { bottom: 2em; display: flex; flex-direction: column; diff --git a/app/javascript/__tests__/notifier.test.js b/app/javascript/__tests__/notifier.test.js index 033dc57170..62e3900893 100644 --- a/app/javascript/__tests__/notifier.test.js +++ b/app/javascript/__tests__/notifier.test.js @@ -3,11 +3,11 @@ require('jest') const Notifier = require('../src/notifier.js') -let asyncNotificationsElement +let notificationsElement let notifier beforeEach(() => { - document.body.innerHTML = `
+ document.body.innerHTML = `
@@ -17,8 +17,8 @@ beforeEach(() => {
` $(document).ready(() => { - asyncNotificationsElement = $('#async-notifications') - notifier = new Notifier(asyncNotificationsElement) + notificationsElement = $('#notifications') + notifier = new Notifier(notificationsElement) }) }) @@ -30,7 +30,7 @@ describe('notify', () => { try { notifier.notify(notificationMessage, 'info') - const successMessages = asyncNotificationsElement.find('.async-success-indicator') + const successMessages = notificationsElement.find('.async-success-indicator') // Notifications contain the "Saved" message and the new message expect(successMessages.length).toBe(2) @@ -49,7 +49,7 @@ describe('notify', () => { try { notifier.notify(notificationMessage, 'error') - const failureMessages = asyncNotificationsElement.find('.async-failure-indicator') + const failureMessages = notificationsElement.find('.async-failure-indicator') expect(failureMessages.length).toBe(1) expect(failureMessages[0].innerHTML).toContain(notificationMessage) @@ -60,25 +60,25 @@ describe('notify', () => { }) }) - test('notify should append a dismissable message to the async-notifications widget', (done) => { + test('notify should append a dismissable message to the notifications widget', (done) => { $(document).ready(() => { try { notifier.notify('', 'error') notifier.notify('', 'info') - let failureMessages = asyncNotificationsElement.find('.async-failure-indicator') - let successMessages = asyncNotificationsElement.find('.async-success-indicator') + let failureMessages = notificationsElement.find('.async-failure-indicator') + let successMessages = notificationsElement.find('.async-success-indicator') expect(failureMessages.length).toBe(1) expect(successMessages.length).toBe(2) failureMessages.children('button').click() - failureMessages = asyncNotificationsElement.find('.async-failure-indicator') + failureMessages = notificationsElement.find('.async-failure-indicator') expect(failureMessages.length).toBe(0) $(successMessages[1]).children('button').click() - successMessages = asyncNotificationsElement.find('.async-success-indicator') + successMessages = notificationsElement.find('.async-success-indicator') expect(successMessages.length).toBe(1) @@ -199,7 +199,7 @@ describe('stopAsyncOperation', () => { notifier.startAsyncOperation() notifier.stopAsyncOperation(errorMessage) - const failureMessages = asyncNotificationsElement.find('.async-failure-indicator') + const failureMessages = notificationsElement.find('.async-failure-indicator') expect(failureMessages.length).toBe(1) expect(failureMessages[0].innerHTML).toContain(errorMessage) diff --git a/app/javascript/src/all_casa_admin/patch_notes.js b/app/javascript/src/all_casa_admin/patch_notes.js index 0ffbda5928..ee5ead9a86 100644 --- a/app/javascript/src/all_casa_admin/patch_notes.js +++ b/app/javascript/src/all_casa_admin/patch_notes.js @@ -502,7 +502,7 @@ $(() => { // JQuery's callback for the DOM loading } try { - const asyncNotificationsElement = $('#async-notifications') + const asyncNotificationsElement = $('#notifications') pageNotifier = new AsyncNotifier(asyncNotificationsElement) $('#new-patch-note button').on('click', patchNoteFunctions.onCreate) diff --git a/app/javascript/src/case_emancipation.js b/app/javascript/src/case_emancipation.js index 71186de527..17566463e2 100644 --- a/app/javascript/src/case_emancipation.js +++ b/app/javascript/src/case_emancipation.js @@ -104,8 +104,8 @@ $(() => { // JQuery's callback for the DOM loading return } - const asyncNotificationsElement = $('#async-notifications') - emancipationPage.notifier = new Notifier(asyncNotificationsElement) + const notificationsElement = $('#notifications') + emancipationPage.notifier = new Notifier(notificationsElement) $('.category-collapse-icon').on('click', function () { const categoryCollapseIcon = $(this) diff --git a/app/javascript/src/dashboard.js b/app/javascript/src/dashboard.js index 7059e798d0..25cc432d51 100644 --- a/app/javascript/src/dashboard.js +++ b/app/javascript/src/dashboard.js @@ -1,6 +1,6 @@ /* global alert */ /* global $ */ -const AsyncNotifier = require('./notifier') +const Notifier = require('./notifier') let pageNotifier const defineCaseContactsTable = function () { @@ -14,10 +14,10 @@ const defineCaseContactsTable = function () { } $(() => { // JQuery's callback for the DOM loading - const asyncNotificationsElement = $('#async-notifications') + const notificationsElement = $('#notifications') - if (asyncNotificationsElement.length) { - pageNotifier = new AsyncNotifier(asyncNotificationsElement) + if (notificationsElement.length) { + pageNotifier = new Notifier(notificationsElement) } $.fn.dataTable.ext.search.push( diff --git a/app/views/layouts/_notifier.erb b/app/views/layouts/_notifier.erb index e2daae7948..10536fa046 100644 --- a/app/views/layouts/_notifier.erb +++ b/app/views/layouts/_notifier.erb @@ -1,4 +1,4 @@ -
+