mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: Sync client & server rules regarding tag names. (#6400)
This commit is contained in:

committed by
Guo Xiang Tan

parent
da9eee5262
commit
719a433c03
@ -11,6 +11,8 @@ componentTest("default", {
|
||||
template: "{{mini-tag-chooser allowAny=true filterable=true tags=tags}}",
|
||||
|
||||
beforeEach() {
|
||||
this.siteSettings.max_tag_length = 24;
|
||||
|
||||
this.site.set("can_create_tag", true);
|
||||
this.set("tags", ["jeff", "neil", "arpit"]);
|
||||
|
||||
@ -26,7 +28,7 @@ componentTest("default", {
|
||||
});
|
||||
}
|
||||
|
||||
if (params.queryParams.q === "joffrey") {
|
||||
if (params.queryParams.q === "joffrey" || params.queryParams.q === "invalid'tag" || params.queryParams.q === "01234567890123456789012345") {
|
||||
return response({results: []});
|
||||
}
|
||||
|
||||
@ -72,6 +74,24 @@ componentTest("default", {
|
||||
"it creates the tag"
|
||||
);
|
||||
|
||||
await this.get("subject").expand();
|
||||
await this.get("subject").fillInFilter("invalid'tag");
|
||||
await this.get("subject").keyboard("enter");
|
||||
assert.deepEqual(
|
||||
this.get("tags"),
|
||||
["jeff", "neil", "arpit", "régis", "joffrey", "invalidtag"],
|
||||
"it strips invalid characters in tag"
|
||||
);
|
||||
|
||||
await this.get("subject").expand();
|
||||
await this.get("subject").fillInFilter("01234567890123456789012345");
|
||||
await this.get("subject").keyboard("enter");
|
||||
assert.deepEqual(
|
||||
this.get("tags"),
|
||||
["jeff", "neil", "arpit", "régis", "joffrey", "invalidtag"],
|
||||
"it does not allow creating long tags"
|
||||
);
|
||||
|
||||
await click(
|
||||
this.get("subject")
|
||||
.el()
|
||||
@ -80,7 +100,7 @@ componentTest("default", {
|
||||
);
|
||||
assert.deepEqual(
|
||||
this.get("tags"),
|
||||
["jeff", "neil", "arpit", "régis"],
|
||||
["jeff", "neil", "arpit", "régis", "joffrey"],
|
||||
"it removes the tag"
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user