-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtag-icons-test.js
More file actions
68 lines (52 loc) · 2.21 KB
/
Copy pathtag-icons-test.js
File metadata and controls
68 lines (52 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Topic with tags", function (needs) {
needs.settings({ tagging_enabled: true, force_lowercase_tags: false });
const topicResponse = topicFixtures["/t/280/1.json"];
topicResponse.tags = ["tag1", "Tag2", "newsman"];
test("Decorate topic title", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.dom(".title-wrapper .discourse-tags").exists("has tags");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon")
.exists("has tag icon");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon")
.hasStyle(
{ color: "rgb(100, 100, 100)" },
"tag icon color matches default value"
);
});
test("Tag icon exact matches only", async function (assert) {
settings.tag_icon_list = "news,question-circle|newsman,gear";
await visit("/t/internationalization-localization/280");
assert.dom(".title-wrapper .discourse-tags").exists("has tags");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon")
.exists("has tag icon");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon .d-icon")
.hasClass("d-icon-gear", "tag matches correct icon");
});
test("Tag uppercase matches", async function (assert) {
settings.tag_icon_list = "Tag2,star";
await visit("/t/internationalization-localization/280");
assert.dom(".title-wrapper .discourse-tags").exists("has tags");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon")
.exists("has tag icon");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon .d-icon")
.hasClass("d-icon-star", "tag matches correct icon");
});
test("Ensure non-HEX colors do not throw an error", async function (assert) {
settings.tag_icon_list = "Tag2,star,rgba(0,0,0)";
await visit("/t/internationalization-localization/280");
assert.dom(".title-wrapper .discourse-tags").exists("has tags");
assert
.dom(".discourse-tags a.discourse-tag .tag-icon")
.exists("has tag icon");
});
});