From 15aa7122277ca038df75f1af2a11c50674ca6cad Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 27 Mar 2018 14:11:05 +0200 Subject: [PATCH] fix category-row regressions --- .../javascripts/select-kit/components/category-row.js.es6 | 4 +++- test/javascripts/components/category-chooser-test.js.es6 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/select-kit/components/category-row.js.es6 b/app/assets/javascripts/select-kit/components/category-row.js.es6 index 2f52887b989..74f146e51c7 100644 --- a/app/assets/javascripts/select-kit/components/category-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-row.js.es6 @@ -82,6 +82,8 @@ export default SelectKitRowComponent.extend({ @computed("category.description") description(description) { - return `${description.substr(0, 200)}${description.length > 200 ? '…' : ''}`; + if (description) { + return `${description.substr(0, 200)}${description.length > 200 ? '…' : ''}`; + } } }); diff --git a/test/javascripts/components/category-chooser-test.js.es6 b/test/javascripts/components/category-chooser-test.js.es6 index bb129c872bd..ad94f675b0c 100644 --- a/test/javascripts/components/category-chooser-test.js.es6 +++ b/test/javascripts/components/category-chooser-test.js.es6 @@ -35,9 +35,9 @@ componentTest('with scopedCategoryId', { this.get('subject').expand(); andThen(() => { - assert.equal(this.get('subject').rowByIndex(0).title(), 'feature'); + assert.equal(this.get('subject').rowByIndex(0).title(), 'Discussion about features or potential features of Discourse: how they work, why they work, etc.'); assert.equal(this.get('subject').rowByIndex(0).value(), 2); - assert.equal(this.get('subject').rowByIndex(1).title(), 'spec'); + assert.equal(this.get('subject').rowByIndex(1).title(), 'My idea here is to have mini specs for features we would like built but have no bandwidth to build'); assert.equal(this.get('subject').rowByIndex(1).value(), 26); assert.equal(this.get('subject').rows().length, 2); });