From 48f9f5513a7ca25242b12685df89e3d1d9a2b4aa Mon Sep 17 00:00:00 2001 From: Jan Bobisud Date: Thu, 15 Aug 2019 12:59:07 +0200 Subject: [PATCH] You modified name twice on in a single render --- tests/acceptance/will-destroy-test.js | 15 +++++++++++++++ tests/dummy/app/controllers/will-destroy.js | 13 +++++++++++++ tests/dummy/app/router.js | 4 +++- tests/dummy/app/templates/will-destroy.hbs | 10 ++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/acceptance/will-destroy-test.js create mode 100644 tests/dummy/app/controllers/will-destroy.js create mode 100644 tests/dummy/app/templates/will-destroy.hbs 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 @@ +
+ {{this.name}} +
+ +{{#link-to "index"}} + index +{{/link-to}} \ No newline at end of file