makes mini-tag-chooser test use can_create_tag (#6402)

This commit is contained in:
Joffrey JAFFEUX
2018-09-14 13:30:55 +02:00
committed by GitHub
parent d2ea618af1
commit 754d5b62a8

View File

@ -11,6 +11,7 @@ componentTest("default", {
template: "{{mini-tag-chooser allowAny=true filterable=true tags=tags}}", template: "{{mini-tag-chooser allowAny=true filterable=true tags=tags}}",
beforeEach() { beforeEach() {
this.site.set("can_create_tag", true);
this.set("tags", ["jeff", "neil", "arpit"]); this.set("tags", ["jeff", "neil", "arpit"]);
const response = object => { const response = object => {
@ -19,7 +20,7 @@ componentTest("default", {
// prettier-ignore // prettier-ignore
server.get("/tags/filter/search", (params) => { //eslint-disable-line server.get("/tags/filter/search", (params) => { //eslint-disable-line
if (params.queryParams.q === "rég") { if (params.queryParams.q === "régis") {
return response({ return response({
results: [{ text: "régis", count: 5 }] results: [{ text: "régis", count: 5 }]
}); });
@ -54,7 +55,7 @@ componentTest("default", {
"it has the correct tag" "it has the correct tag"
); );
await this.get("subject").fillInFilter("rég"); await this.get("subject").fillInFilter("régis");
await this.get("subject").keyboard("enter"); await this.get("subject").keyboard("enter");
assert.deepEqual( assert.deepEqual(
this.get("tags"), this.get("tags"),
@ -67,7 +68,7 @@ componentTest("default", {
await this.get("subject").keyboard("enter"); await this.get("subject").keyboard("enter");
assert.deepEqual( assert.deepEqual(
this.get("tags"), this.get("tags"),
["jeff", "neil", "arpit", "régis"], ["jeff", "neil", "arpit", "régis", "joffrey"],
"it creates the tag" "it creates the tag"
); );
@ -79,7 +80,7 @@ componentTest("default", {
); );
assert.deepEqual( assert.deepEqual(
this.get("tags"), this.get("tags"),
["jeff", "neil", "arpit"], ["jeff", "neil", "arpit", "régis"],
"it removes the tag" "it removes the tag"
); );
} }