From 8a8fb10b18a80e91e362f846282a6f2dc2a71fd4 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Mon, 5 Aug 2013 14:20:48 +0200 Subject: [PATCH] auto expand post preview --- Changelog.md | 1 + app/assets/javascripts/app/views/publisher_view.js | 1 + features/post_preview.feature | 9 +++++++++ features/step_definitions/post_preview_steps.rb | 6 ++++++ features/step_definitions/posts_steps.rb | 4 ++++ 5 files changed, 21 insertions(+) diff --git a/Changelog.md b/Changelog.md index 8d560908a..22269e23a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -25,6 +25,7 @@ * Change image to ajax-loader when closing lightbox [#3229](https://github.com/diaspora/diaspora/issues/3229) * Fix pointer cursor on the file upload button [#4349](https://github.com/diaspora/diaspora/pull/4349) * Resize preview button [#4355](https://github.com/diaspora/diaspora/pull/4355) +* Don't collapse the post preview [#4346](https://github.com/diaspora/diaspora/issues/4346) ## Features * Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252) diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index dcb8471f5..c99584919 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -202,6 +202,7 @@ app.views.Publisher = Backbone.View.extend(_.extend( modifyPostPreview : function(post) { post.addClass('post_preview'); + $('.collapsible',post).removeClass('collapsed').addClass('opened'); $('a.delete.remove_post',post).hide(); $('a.like, a.focus_comment_textarea',post).removeAttr("href"); $('a.like',post).addClass("like_preview"); diff --git a/features/post_preview.feature b/features/post_preview.feature index 628c264f3..5daeee0cf 100644 --- a/features/post_preview.feature +++ b/features/post_preview.feature @@ -34,6 +34,15 @@ Feature: preview posts in the stream Then "I like rocks" should be post 1 And I should not see "This preview rocks" + Scenario: preview a very long message + Given I expand the publisher + When I insert an extremely long status message + And I press "Preview" + Then the preview should not be collapsed + + When I press "Share" + Then the post should be collapsed + Scenario: preview a photo with text Given I expand the publisher When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" diff --git a/features/step_definitions/post_preview_steps.rb b/features/step_definitions/post_preview_steps.rb index e7129d73c..015400e15 100644 --- a/features/step_definitions/post_preview_steps.rb +++ b/features/step_definitions/post_preview_steps.rb @@ -1,3 +1,9 @@ Then /^the first post should be a preview$/ do find(".post_preview .post-content").text.should == first_post_text end + +Then /^the preview should not be collapsed$/ do + find(".post_preview").should_not have_selector('.collapsed') + find(".post_preview").should have_selector('.opened') +end + diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index 38c2777c8..b410b8f09 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -66,6 +66,10 @@ When /^I post an extremely long status message$/ do click_and_post("I am a very interesting message " * 64) end +When /^I insert an extremely long status message$/ do + fill_in 'status_message_fake_text', :with => "I am a very interesting message " * 64 +end + When /^I open the show page of the "([^"]*)" post$/ do |post_text| visit post_path_by_content(post_text) end