2018-06-15 11:03:24 -04:00
|
|
|
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
2017-01-18 12:13:45 -05:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
moduleForWidget("topic-participant");
|
2017-01-18 12:13:45 -05:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("one post", {
|
2017-01-18 12:13:45 -05:00
|
|
|
template: '{{mount-widget widget="topic-participant" args=args}}',
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", {
|
|
|
|
username: "test",
|
|
|
|
avatar_template: "/images/avatar.png",
|
2017-01-18 12:13:45 -05:00
|
|
|
post_count: 1
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2018-06-15 11:03:24 -04:00
|
|
|
assert.ok(exists("a.poster.trigger-user-card"));
|
|
|
|
assert.ok(!exists("span.post-count"), "don't show count for only 1 post");
|
|
|
|
assert.ok(!exists(".avatar-flair"), "no avatar flair");
|
2017-01-18 12:13:45 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
widgetTest("many posts, a primary group with flair", {
|
2017-01-18 12:13:45 -05:00
|
|
|
template: '{{mount-widget widget="topic-participant" args=args}}',
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.set("args", {
|
|
|
|
username: "test",
|
|
|
|
avatar_template: "/images/avatar.png",
|
2017-01-18 12:13:45 -05:00
|
|
|
post_count: 5,
|
2018-06-15 11:03:24 -04:00
|
|
|
primary_group_name: "devs",
|
2017-02-17 15:00:38 -05:00
|
|
|
primary_group_flair_url: "/images/d-logo-sketch-small.png",
|
2017-01-18 12:13:45 -05:00
|
|
|
primary_group_flair_bg_color: "222"
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
test(assert) {
|
2018-06-15 11:03:24 -04:00
|
|
|
assert.ok(exists("a.poster.trigger-user-card"));
|
|
|
|
assert.ok(exists("span.post-count"), "show count for many posts");
|
|
|
|
assert.ok(
|
|
|
|
exists(".group-devs a.poster"),
|
|
|
|
"add class for the group outside the link"
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
exists(".avatar-flair.avatar-flair-devs"),
|
|
|
|
"show flair with group class"
|
|
|
|
);
|
2017-01-18 12:13:45 -05:00
|
|
|
}
|
|
|
|
});
|