From 222125de10c60bcd7bffdaef2873b9f14f13a2a5 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 18 Jan 2017 12:13:45 -0500 Subject: [PATCH] oops here's the test --- .../widgets/topic-participant-test.js.es6 | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/javascripts/widgets/topic-participant-test.js.es6 diff --git a/test/javascripts/widgets/topic-participant-test.js.es6 b/test/javascripts/widgets/topic-participant-test.js.es6 new file mode 100644 index 00000000000..fe436524564 --- /dev/null +++ b/test/javascripts/widgets/topic-participant-test.js.es6 @@ -0,0 +1,43 @@ +import { moduleForWidget, widgetTest } from 'helpers/widget-test'; + +moduleForWidget('topic-participant'); + +widgetTest('one post', { + template: '{{mount-widget widget="topic-participant" args=args}}', + + setup() { + this.set('args', { + username: 'test', + avatar_template: 'stubbed', + post_count: 1 + }); + }, + + test(assert) { + 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"); + } +}); + +widgetTest('many posts, a primary group with flair', { + template: '{{mount-widget widget="topic-participant" args=args}}', + + setup() { + this.set('args', { + username: 'test', + avatar_template: 'stubbed', + post_count: 5, + primary_group_name: 'devs', + primary_group_flair_url: "http://devs.example.com/img/devs.png", + primary_group_flair_bg_color: "222" + }); + }, + + test(assert) { + 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"); + } +});