From f198bb8a45303c8dc45460de8e1a77b20716abec Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 4 Jun 2020 11:30:30 +0530 Subject: [PATCH] Enabled auto reset state for action buttons no issue - By default, action buttons had auto-reset off and reset had to be explicitly set - Auto reset for action buttons is on by default now, and any button that should not reset should explicitly switch it off --- ghost/admin/app/components/gh-task-button.js | 2 +- ghost/admin/tests/acceptance/staff-test.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ghost/admin/app/components/gh-task-button.js b/ghost/admin/app/components/gh-task-button.js index bd2e8b776b..60c8940f95 100644 --- a/ghost/admin/app/components/gh-task-button.js +++ b/ghost/admin/app/components/gh-task-button.js @@ -35,7 +35,7 @@ const GhTaskButton = Component.extend({ idleClass: '', runningClass: '', showSuccess: true, // set to false if you want the spinner to show until a transition occurs - autoReset: false, // set to false if you want don't want task button to reset after timeout + autoReset: true, // set to false if you want don't want task button to reset after timeout successText: 'Saved', successClass: 'gh-btn-green', failureText: 'Retry', diff --git a/ghost/admin/tests/acceptance/staff-test.js b/ghost/admin/tests/acceptance/staff-test.js index 5306e19cb2..158a3abfd0 100644 --- a/ghost/admin/tests/acceptance/staff-test.js +++ b/ghost/admin/tests/acceptance/staff-test.js @@ -522,7 +522,12 @@ describe('Acceptance: Staff', function () { // Save changes await click('[data-test-save-button]'); - expect(find('[data-test-save-button]').textContent.trim(), 'save button text').to.equal('Saved'); + // Since we reset save status so there's no on-screen indication + // that we've had a save, check the request was fired instead + let [lastRequest] = this.server.pretender.handledRequests.slice(-1); + let params = JSON.parse(lastRequest.requestBody); + + expect(params.users[0].name).to.equal('Test User'); // CMD-S shortcut works await fillIn('[data-test-slug-input]', 'Test User'); @@ -532,10 +537,10 @@ describe('Acceptance: Staff', function () { ctrlKey: ctrlOrCmd === 'ctrl' }); - // we've already saved in this test so there's no on-screen indication - // that we've had another save, check the request was fired instead - let [lastRequest] = this.server.pretender.handledRequests.slice(-1); - let params = JSON.parse(lastRequest.requestBody); + // Since we reset save status so there's no on-screen indication + // that we've had a save, check the request was fired instead + [lastRequest] = this.server.pretender.handledRequests.slice(-1); + params = JSON.parse(lastRequest.requestBody); expect(params.users[0].name).to.equal('Test User');