diff --git a/tests/acceptance/will-destroy-test.js b/tests/acceptance/will-destroy-test.js new file mode 100644 index 0000000..888cdd5 --- /dev/null +++ b/tests/acceptance/will-destroy-test.js @@ -0,0 +1,15 @@ +import { module, test } from 'qunit'; +import { visit, click, currentURL } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; + +module('Acceptance | will destroy', function(hooks) { + setupApplicationTest(hooks); + + test('transitioning from /will-destroy does not throw error', async function(assert) { + await visit('/will-destroy'); + assert.equal(currentURL(), '/will-destroy'); + + await click('a'); + assert.equal(currentURL(), '/'); + }); +}); diff --git a/tests/dummy/app/controllers/will-destroy.js b/tests/dummy/app/controllers/will-destroy.js new file mode 100644 index 0000000..c4d2142 --- /dev/null +++ b/tests/dummy/app/controllers/will-destroy.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + name: 'Bob', + + update() { + console.log(this.name); + }, + + clear() { + this.set('name', null); + }, +}); diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 8f6f459..3107fd7 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -6,6 +6,8 @@ const Router = EmberRouter.extend({ rootURL: config.rootURL, }); -Router.map(function() {}); +Router.map(function() { + this.route('will-destroy'); +}); export default Router; diff --git a/tests/dummy/app/templates/will-destroy.hbs b/tests/dummy/app/templates/will-destroy.hbs new file mode 100644 index 0000000..3337f48 --- /dev/null +++ b/tests/dummy/app/templates/will-destroy.hbs @@ -0,0 +1,10 @@ +