Ghost/ghost/admin/tests/helpers/destroy-app.js
Kevin Ansfield 069bccdd94 Prevent keymaster bindings from causing failed tests (#976)
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
2018-03-19 18:39:17 +00:00

16 lines
417 B
JavaScript

/* global key */
import {run} from '@ember/runloop';
export default function destroyApp(application) {
// this is required to fix "second Pretender instance" warnings
if (server) {
server.shutdown();
}
// extra check to ensure we don't have references hanging around via key
// bindings on supposedly destroyed objects
key.deleteScope('default');
run(application, 'destroy');
}