summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-09-19 11:25:13 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-09-28 13:29:32 +0100
commit0269e8c5ef8966b84399376ae57567072f594070 (patch)
tree5aee02bca1c1279929014ac0fb73ac2136752058
parentae36ee6a149e532d594ef89195e8aebd257e0c66 (diff)
downloadgitlab-ce-0269e8c5ef8966b84399376ae57567072f594070.tar.gz
Add participants spec
-rw-r--r--spec/views/shared/issuable/_participants.html.haml.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/views/shared/issuable/_participants.html.haml.rb b/spec/views/shared/issuable/_participants.html.haml.rb
new file mode 100644
index 00000000000..6bc95846f63
--- /dev/null
+++ b/spec/views/shared/issuable/_participants.html.haml.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+require 'nokogiri'
+
+def expect_lazy_load_image(author)
+ avatar = author.find('img')
+
+ expect(avatar[:src]).to eql?('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==')
+ expect(avatar[:"data-src"]).to exist
+end
+
+describe 'shared/issuable/_participants.html.haml' do
+ let(:project) { create(:project) }
+ let(:participants) { create_list(:user, 10) }
+
+ before do
+ allow(view).to receive_messages(project: project,
+ participants: participants)
+ end
+
+ it 'displays' do
+ render 'shared/issuable/participants'
+
+ html = Nokogiri::HTML(rendered)
+
+ authors = html.css('.participants-author')
+ p authors
+ p authors.size
+ visible_authors = authors[0..6]
+ hidden_authors = authors[7..-1]
+
+ visible_authors.each do |author|
+ expect(author).not_to have_selector('js-participants-hidden')
+ expect_lazy_load_image(author)
+ end
+
+ hidden_authors.each do |author|
+ expect(author).to have_selector('js-participants-hidden')
+ expect_lazy_load_image(author)
+ end
+ end
+end