Skip to content

Commit

Permalink
refactor(router): use afterDeactivate hook for stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
fkleuver committed Oct 5, 2020
1 parent 79282ad commit 3683586
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion packages/__tests__/router/__smoke-tests.spec.ts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ async function createFixture<T extends Constructable>(
// scheduler.getRenderTaskQueue().flush();
// assert.isSchedulerEmpty();

router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down
3 changes: 0 additions & 3 deletions packages/__tests__/router/_shared/create-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export async function createFixture<T extends Constructable>(
logConfig.level = level;
},
async tearDown() {

router.stop();

assert.isSchedulerEmpty();

hia.setPhase('stop');
Expand Down
2 changes: 0 additions & 2 deletions packages/__tests__/router/configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('Configuration', function () {
await au.start().wait();

async function tearDown() {
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down Expand Up @@ -112,7 +111,6 @@ describe('Configuration', function () {

await au.stop().wait();
ctx.doc.body.removeChild(host);
router.stop();

au.dispose();
assert.isSchedulerEmpty();
Expand Down
1 change: 0 additions & 1 deletion packages/__tests__/router/hook-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ describe('HookManager', function () {

async function tearDown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
RouterConfiguration.customize();
await au.stop().wait();

Expand Down
1 change: 0 additions & 1 deletion packages/__tests__/router/instruction-resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('InstructionResolver', function () {
await au.start().wait();

async function tearDown() {
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down
1 change: 0 additions & 1 deletion packages/__tests__/router/nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('Nav', function () {
await au.start().wait();

async function tearDown() {
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down
6 changes: 0 additions & 6 deletions packages/__tests__/router/router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ describe('Router', function () {

async function tearDown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);
}
Expand Down Expand Up @@ -960,7 +959,6 @@ describe('Router', function () {
async function $teardown() {
await au.stop().wait();
ctx.doc.body.removeChild(host);
router.stop();

au.dispose();
assert.isSchedulerEmpty();
Expand Down Expand Up @@ -1210,7 +1208,6 @@ describe('Router', function () {

async function $teardown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down Expand Up @@ -1342,7 +1339,6 @@ describe('Router', function () {

async function $teardown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down Expand Up @@ -1612,7 +1608,6 @@ describe('Router', function () {

async function $teardown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down Expand Up @@ -1835,7 +1830,6 @@ describe('Router', function () {

async function $teardown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.stop();
await au.stop().wait();
ctx.doc.body.removeChild(host);

Expand Down
1 change: 0 additions & 1 deletion packages/__tests__/router/viewport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('Viewport', function () {
await au.start().wait();

async function tearDown() {
router.stop();
RouterConfiguration.customize();
await au.stop().wait();

Expand Down
1 change: 1 addition & 0 deletions packages/router/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const routerConfiguration = {
...DefaultResources,
StartTask.with(IRouter).beforeActivate().call(configurationCall),
StartTask.with(IRouter).afterActivate().call(router => router.loadUrl()),
StartTask.with(IRouter).afterDeactivate().call(router => router.stop()),
);
},
/**
Expand Down

0 comments on commit 3683586

Please sign in to comment.