Skip to content

Commit a7c03cc

Browse files
author
Jon Willesen
committed
show attachments when expanding a non-threaded discussion
fixes #CNVS-1279 test plan: - create a discussion topic, reply to it, and create 5 side comments to the reply with at least one with an attachment - refresh the page and then click the arrow to show all the side comments - see that the side comment attachments are still visible Change-Id: I47b7795f4e44caad3ce42bf31af21d73bf6dc6bf Reviewed-on: https://gerrit.instructure.com/15797 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Zach Pendleton <zachp@instructure.com> QA-Review: Marc LeGendre <marc@instructure.com> Tested-by: Jon Willesen <jonw@instructure.com>
1 parent 75c88dd commit a7c03cc

3 files changed

Lines changed: 30 additions & 8 deletions

File tree

app/coffeescripts/views/DiscussionTopic/EntryCollectionView.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ define [
121121
if @options.threaded
122122
@collection.add @collection.fullCollection.getPage 'next'
123123
else
124-
@collection.reset @collection.fullCollection.toJSON()
124+
@collection.reset @collection.fullCollection.toArray()
125125
@renderNextLink()
126126

127127
filter: @::afterRender

spec/selenium/discussions_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@
7373
@last_entry.find_element(:css, '.message').text.should == message
7474
end
7575

76+
it "should show attachments after showing hidden replies" do
77+
@topic = @course.discussion_topics.create!(:title => 'test', :message => 'attachment test', :user => @user)
78+
@entry = @topic.discussion_entries.create!(:user => @user, :message => 'blah')
79+
@replies = []
80+
5.times do
81+
attachment = @course.attachments.create!(:context => @course, :filename => "text.txt", :user => @user, :uploaded_data => StringIO.new("testing"))
82+
reply = @entry.discussion_subentries.create!(
83+
:user => @user, :message => 'i haz attachments', :discussion_topic => @topic, :attachment => attachment)
84+
@replies << reply
85+
end
86+
@topic.create_materialized_view
87+
go_to_topic
88+
ffj('.comment_attachments').count.should == 3
89+
fj('.showMore').click
90+
wait_for_ajaximations
91+
ffj('.comment_attachments').count.should == @replies.count
92+
end
93+
7694
it "should show only 10 root replies per page"
7795
it "should paginate root entries"
7896
it "should show only three levels deep"

spec/selenium/helpers/discussions_common.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
shared_examples_for "discussions selenium tests" do
44
it_should_behave_like "in-process server selenium tests"
55

6+
def go_to_topic
7+
get "/courses/#{@course.id}/discussion_topics/#{@topic.id}"
8+
wait_for_ajax_requests
9+
end
10+
611
def create_and_go_to_topic(title = 'new topic', discussion_type = 'side_comment', is_locked = false)
7-
topic = @course.discussion_topics.create!(:title => title, :discussion_type => discussion_type)
12+
@topic = @course.discussion_topics.create!(:title => title, :discussion_type => discussion_type)
813
if is_locked
9-
topic.workflow_state = 'locked'
10-
topic.save!
11-
topic.reload
14+
@topic.workflow_state = 'locked'
15+
@topic.save!
16+
@topic.reload
1217
end
13-
get "/courses/#{@course.id}/discussion_topics/#{topic.id}"
14-
wait_for_ajax_requests
15-
topic
18+
go_to_topic
19+
@topic
1620
end
1721

1822
def create_discussion(discussion_name, discussion_type)

0 commit comments

Comments
 (0)