From dbb5b7deec0b2de4c7ff04fa1e59f7c894838058 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 24 Oct 2022 21:15:30 +0200 Subject: [PATCH] clean(js): remove unused autosave:reset --- app/javascript/controllers/autosave_status_controller.ts | 6 ------ spec/support/system_helpers.rb | 1 - 2 files changed, 7 deletions(-) diff --git a/app/javascript/controllers/autosave_status_controller.ts b/app/javascript/controllers/autosave_status_controller.ts index 8a24aa0f4..b0df9e295 100644 --- a/app/javascript/controllers/autosave_status_controller.ts +++ b/app/javascript/controllers/autosave_status_controller.ts @@ -27,8 +27,6 @@ export class AutosaveStatusController extends ApplicationController { connect(): void { this.onGlobal('autosave:enqueue', () => this.didEnqueue()); this.onGlobal('autosave:end', () => this.didSucceed()); - // This event is used in tests to reset the state of the controller - this.onGlobal('autosave:reset', () => this.didReset()); this.onGlobal('autosave:error', (event) => this.didFail(event) ); @@ -63,10 +61,6 @@ export class AutosaveStatusController extends ApplicationController { this.debounce(this.hideSucceededStatus, AUTOSAVE_STATUS_VISIBLE_DURATION); } - private didReset() { - this.setState('idle'); - } - private didFail(event: CustomEvent<{ error: ResponseError }>) { const error = event.detail.error; diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index 3047292e2..eb0e006d8 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -176,7 +176,6 @@ module SystemHelpers blur expect(page).to have_css('.debounced-empty') # no more debounce expect(page).to have_css('.autosave-state-idle') # no more in flight promise - page.execute_script("document.documentElement.dispatchEvent(new CustomEvent('autosave:reset'));") end end