From 4746f016c7184fae3eac085974cf010e906d4f0f Mon Sep 17 00:00:00 2001 From: Raido Kuli Date: Thu, 3 Sep 2020 11:29:19 +0300 Subject: [PATCH] Avoid crashing the playground app --- .../app/components/page-title-pane/component.js | 15 +++++---------- .../page-title-pane/nested-template/component.js | 6 +++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/dummy/app/components/page-title-pane/component.js b/tests/dummy/app/components/page-title-pane/component.js index 1a40e1b4..964d9489 100644 --- a/tests/dummy/app/components/page-title-pane/component.js +++ b/tests/dummy/app/components/page-title-pane/component.js @@ -8,23 +8,18 @@ export default Component.extend({ titleList: service(), - lastIndex: computed('titleList.{sortedTokens.length,tokens.length}', { + lastIndex: computed('titleList.{tokens.length}', { get() { - return this.titleList.sortedTokens.length - 1; + return this.titleList.tokens.length - 1; }, }), actions: { highlight(token) { - let sortedTokens = A(this.titleList.sortedTokens); + let tokens = A(this.titleList.tokens); let wasActive = token.active; - this.titleList.tokens.setEach('active', false); - sortedTokens.setEach('active', false); - - if (!wasActive) { - set(sortedTokens.findBy('id', token.id), 'active', true); - set(token, 'active', true); - } + tokens.setEach('active', false); + set(token, 'active', !wasActive); }, }, }); diff --git a/tests/dummy/app/components/page-title-pane/nested-template/component.js b/tests/dummy/app/components/page-title-pane/nested-template/component.js index 8bff1506..cb93fbb9 100644 --- a/tests/dummy/app/components/page-title-pane/nested-template/component.js +++ b/tests/dummy/app/components/page-title-pane/nested-template/component.js @@ -7,10 +7,10 @@ export default Component.extend({ classNames: ['nested-template'], classNameBindings: ['active:active'], - active: computed('titleList.{sortedTokens,tokens.@each.active}', 'token.id', { + active: computed('titleList.{tokens.@each.active}', 'token.id', { get() { - let sortedTokens = A(this.titleList.sortedTokens); - let token = sortedTokens.findBy('id', this.token.id); + let tokens = A(this.titleList.tokens); + let token = tokens.findBy('id', this.token.id); return token && token.active; }, }),