FIX: Reset tags on category change (#6363)

This commit is contained in:
Joffrey JAFFEUX
2018-09-05 17:18:52 +02:00
committed by GitHub
parent f3aef2cc83
commit 17087eff2a
8 changed files with 117 additions and 4 deletions
@@ -0,0 +1,39 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("CategoryChooser - with tags", {
loggedIn: true,
site: { can_tag_topics: true },
settings: {
tagging_enabled: true,
allow_uncategorized_topics: false
}
});
QUnit.test("resets tags when changing category", async assert => {
const categoryChooser = selectKit(".category-chooser");
const miniTagChooser = selectKit(".mini-tag-chooser");
const findSelected = () =>
find(".mini-tag-chooser .mini-tag-chooser-header .selected-name").text();
await visit("/");
await click("#create-topic");
await miniTagChooser.expand();
await miniTagChooser.selectRowByValue("monkey");
assert.equal(findSelected(), "monkey");
await categoryChooser.expand();
await categoryChooser.selectRowByValue(6);
assert.equal(findSelected(), "optional tags");
await miniTagChooser.expand();
await miniTagChooser.selectRowByValue("monkey");
assert.equal(findSelected(), "monkey");
await categoryChooser.expand();
await categoryChooser.selectNoneRow();
assert.equal(findSelected(), "optional tags");
});
@@ -501,6 +501,32 @@ componentTest("support modifying on select behavior through plugin api", {
}
});
componentTest("support modifying on select none behavior through plugin api", {
template:
'<span class="on-select-none-test"></span>{{single-select none="none" content=content}}',
beforeEach() {
withPluginApi("0.8.25", api => {
api.modifySelectKit("select-kit").onSelectNone(() => {
find(".on-select-none-test").html("NONE");
});
});
this.set("content", [{ id: "1", name: "robin" }]);
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue(1);
await this.get("subject").expand();
await this.get("subject").selectNoneRow();
assert.equal(find(".on-select-none-test").html(), "NONE");
clearCallbacks();
}
});
componentTest("with nameChanges", {
template: "{{single-select content=content nameChanges=true}}",