diff --git a/app/pods/agendas/controller.js b/app/pods/agendas/controller.js index 881a650b70..c62614a678 100644 --- a/app/pods/agendas/controller.js +++ b/app/pods/agendas/controller.js @@ -21,9 +21,13 @@ export default class AgendasController extends Controller { dateRegex = /^(?:\d{1,2}\/)??(?:\d{1,2}\/)?\d{4}$/; @restartableTask - *setFilter(event) { + *debouncedSetFilter(event) { yield timeout(500); - const date = event.target.value; + this.setFilter(event.target.value); + } + + @action + setFilter(date) { if (this.dateRegex.test(date)) { this.filter = date; } else if (date === '') { diff --git a/app/pods/agendas/template.hbs b/app/pods/agendas/template.hbs index 1f5ae7bc2e..c369a11159 100644 --- a/app/pods/agendas/template.hbs +++ b/app/pods/agendas/template.hbs @@ -25,7 +25,8 @@ @icon="search" placeholder="bv. 01/2021" value={{this.filter}} - {{on "input" (perform this.setFilter)}} + {{on "input" (perform this.debouncedSetFilter)}} + @enter={{this.setFilter}} autocomplete="off" /> @@ -95,7 +96,10 @@ {{#if this.isLoadingModel}} - + {{t "loading"}} diff --git a/cypress/selectors/route.selectors.js b/cypress/selectors/route.selectors.js index 799f315e5e..9a6cb99ee7 100644 --- a/cypress/selectors/route.selectors.js +++ b/cypress/selectors/route.selectors.js @@ -24,6 +24,7 @@ const selectors = { // agendas/overview/template.hbs agendasOverview: { dataTable: '[data-test-route-agendas-overview-data-table]', + loader: '[data-test-route-agendas-overview-loader]', row: { title: '[data-test-route-agendas-overview-row-title]', kind: '[data-test-route-agendas-overview-row-kind]', diff --git a/cypress/support/commands/agenda-commands.js b/cypress/support/commands/agenda-commands.js index 615c34526e..1b1fe60a87 100644 --- a/cypress/support/commands/agenda-commands.js +++ b/cypress/support/commands/agenda-commands.js @@ -163,8 +163,11 @@ function openAgendaForDate(agendaDate, index = 0) { cy.visit(''); cy.get(route.agendasOverview.filter.container).within(() => { - cy.get(route.agendasOverview.filter.input).type(searchDate); + cy.get(route.agendasOverview.filter.input).type(`${searchDate}{enter}`); }); + cy.get(route.agendasOverview.loader, { + timeout: 5000, + }).should('not.exist'); cy.wait('@getFilteredAgendas', { timeout: 20000, });