Skip to content

Commit 7cb2884

Browse files
authored
Lazy loading fix due to filter on applications page with delete option (#856)
* Display applied filters on applications page with clear option * Added test case and feature falg for filter * fixed the lazy loading bug due to filter
1 parent 39cae15 commit 7cb2884

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

__tests__/applications/applications.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ describe('Applications page', () => {
153153
).toBe(true, 'status query param is not removed from url');
154154
expect(applicationCards.length).toBe(6);
155155
});
156+
156157
it('should load more applications on going to the bottom of the page', async function () {
157158
let applicationCards = await page.$$('.application-card');
158159
expect(applicationCards.length).toBe(6);
@@ -184,6 +185,25 @@ describe('Applications page', () => {
184185
expect(urlAfterOpeningModal.searchParams.get('id') !== null).toBe(true);
185186
});
186187

188+
it('under feature flag should open application details modal for application, when user click on view details on any card', async function () {
189+
await page.goto(`${SITE_URL}/applications/?dev=true`);
190+
await page.waitForNetworkIdle();
191+
const applicationDetailsModal = await page.$('.application-details');
192+
expect(
193+
await applicationDetailsModal.evaluate((el) =>
194+
el.classList.contains('hidden'),
195+
),
196+
).toBe(true);
197+
await page.click('.view-details-button');
198+
expect(
199+
await applicationDetailsModal.evaluate((el) =>
200+
el.classList.contains('hidden'),
201+
),
202+
).toBe(false);
203+
const urlAfterOpeningModal = new URL(page.url());
204+
expect(urlAfterOpeningModal.searchParams.get('id') !== null).toBe(true);
205+
});
206+
187207
it('should close application details modal, when user clicks the close button', async function () {
188208
const applicationDetailsModal = await page.$('.application-details');
189209
await page.click('.view-details-button');

applications/script.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,11 @@ if (isDev) {
480480
}
481481

482482
function showAppliedFilter(filterApplied) {
483-
filterLabel.classList.remove('hidden');
484-
filterText.textContent =
485-
'Status :' + filterApplied[0].toUpperCase() + filterApplied.substring(1);
483+
if (filterApplied) {
484+
filterLabel.classList.remove('hidden');
485+
filterText.textContent =
486+
'Status :' + filterApplied[0].toUpperCase() + filterApplied.substring(1);
487+
}
486488
}
487489

488490
function applyFilter(filter) {

0 commit comments

Comments
 (0)