FIX: error with tags enabled and no tags created (#6701)

This commit is contained in:
Joffrey JAFFEUX 2018-11-29 10:39:09 +01:00 committed by GitHub
parent ddd260941e
commit 4c7dfed32e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -120,7 +120,7 @@ export default ComboBoxComponent.extend(TagsMixin, {
if (this.siteSettings.tags_sort_alphabetically && topTags) {
return shortcuts.concat(topTags.sort());
} else {
return shortcuts.concat(topTags);
return shortcuts.concat(Ember.makeArray(topTags));
}
},

View File

@ -83,3 +83,24 @@ componentTest("default", {
);
}
});
componentTest("no tags", {
template: "{{tag-drop}}",
beforeEach() {
this.site.set("can_create_tag", true);
this.set("site.top_tags", undefined);
},
async test(assert) {
await this.get("subject").expand();
assert.equal(
this.get("subject")
.rowByIndex(1)
.name(),
undefined,
"it has no tags and doesnt crash"
);
}
});