Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Prevent keymaster bindings from causing failed tests #976

Merged
merged 1 commit into from Mar 19, 2018

Conversation

kevinansfield
Copy link
Collaborator

no issue

Keymaster.js bindings could be kept around between tests with references to objects that should have been deleted. This was manifesting itself with a Tags acceptance test failing because one of the key binding tests triggered two actions, one on the route under test and another on a route that was kept around from a previous Error Handling acceptance test (previous test intentionally had an aborted transition so the action in the current test was complaining about the first transition not being complete).

  • add guard to ensure that shortcuts can't be registered multiple times on an object
  • remove all default scope keymaster bindings when destroying a test app instance

no issue
- keymaster bindings could be kept around between tests with references to objects that should have been deleted. This was manifesting itself with a Tags acceptance test failing because one of the key binding tests triggered two actions, one on the route under test and another on a route that was kept around from a previous Error Handling acceptance test (previous test intentionally had an aborted transition so the action in the current test was complaining about the first transition not being complete)
- add guard to ensure that shortcuts can't be registered multiple times on an object
- remove all `default` scope keymaster bindings when destroying a test app instance
@kevinansfield kevinansfield merged commit 6843eb4 into TryGhost:master Mar 19, 2018
kevinansfield added a commit to kevinansfield/Ghost-Admin that referenced this pull request Apr 9, 2018
…reen

closes TryGhost/Ghost#9543
- TryGhost#972 moved `keymaster` from Bower to NPM but version 1.6.3 is not published to NPM and it contains fixes for unbinding multiple keys (eg, `'down, j': 'moveDown'`). Switched to fetching directly from github to ensure we have the latest version
- removed the "has registered shortcuts" guard added in TryGhost#976 - it was working around the buggy keymaster version but was also buggy itself because it meant shortcuts could only be registered the first time a route was loaded even though we unregister all of the shortcuts when leaving the route
kevinansfield added a commit that referenced this pull request Apr 9, 2018
…reen (#1002)

closes TryGhost/Ghost#9543
- #972 moved `keymaster` from Bower to NPM but version 1.6.3 is not published to NPM and it contains fixes for unbinding multiple keys (eg, `'down, j': 'moveDown'`). Switched to fetching directly from github to ensure we have the latest version
- removed the "has registered shortcuts" guard added in #976 - it was working around the buggy keymaster version but was also buggy itself because it meant shortcuts could only be registered the first time a route was loaded even though we unregister all of the shortcuts when leaving the route
@kevinansfield kevinansfield deleted the fix-tags-test branch June 4, 2018 09:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant