Issue #1126 - When the last photo is deleted from the publisher, we now collapse the publisher if no status text had been entered.
This commit is contained in:
parent
92a0b568c3
commit
ba98043412
4 changed files with 52 additions and 0 deletions
|
|
@ -72,6 +72,10 @@
|
|||
if ( $('.publisher_photo').length == 0){
|
||||
textarea.removeClass("with_attachments");
|
||||
textarea.css('paddingBottom', '');
|
||||
|
||||
if( $('#status_message_text').attr("value") == ""){
|
||||
Publisher.close()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,38 @@ Feature: posting
|
|||
And I go to "bob@bob.bob"'s page
|
||||
Then I should see a "img" within ".stream_element:first div.photo_attachments"
|
||||
|
||||
Scenario: back out of posting a photo-only post
|
||||
Given I expand the publisher
|
||||
And I have turned off jQuery effects
|
||||
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
|
||||
And I wait for the ajax to finish
|
||||
And I click to delete the first uploaded photo
|
||||
And I wait for the ajax to finish
|
||||
Then I should not see an uploaded image within the photo drop zone
|
||||
And the publisher should be collapsed
|
||||
|
||||
Scenario: back out of uploading a picture to a post with text
|
||||
Given I expand the publisher
|
||||
And I have turned off jQuery effects
|
||||
When I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
|
||||
And I wait for the ajax to finish
|
||||
And I click to delete the first uploaded photo
|
||||
And I wait for the ajax to finish
|
||||
Then I should not see an uploaded image within the photo drop zone
|
||||
And the publisher should be expanded
|
||||
|
||||
Scenario: back out of uploading a picture when another has been attached
|
||||
Given I expand the publisher
|
||||
And I have turned off jQuery effects
|
||||
When I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
|
||||
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
|
||||
And I wait for the ajax to finish
|
||||
And I click to delete the first uploaded photo
|
||||
And I wait for the ajax to finish
|
||||
Then I should see an uploaded image within the photo drop zone
|
||||
And the publisher should be expanded
|
||||
|
||||
Scenario: post a photo with text
|
||||
Given I expand the publisher
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ And /^I expand the publisher$/ do
|
|||
')
|
||||
end
|
||||
|
||||
Then /^the publisher should be collapsed$/ do
|
||||
find("#publisher")["class"].should include("closed")
|
||||
end
|
||||
|
||||
Then /^the publisher should be expanded$/ do
|
||||
find("#publisher")["class"].should_not include("closed")
|
||||
end
|
||||
|
||||
When /^I append "([^"]*)" to the publisher$/ do |stuff|
|
||||
# Wait for the publisher to appear and all the elements to lay out
|
||||
wait_until { evaluate_script("$('#status_message_fake_text').focus().length == 1") }
|
||||
|
|
@ -52,6 +60,10 @@ When /^I click to delete the first comment$/ do
|
|||
page.execute_script('$(".comment.posted").first().find(".comment_delete").click()')
|
||||
end
|
||||
|
||||
When /^I click to delete the first uploaded photo$/ do
|
||||
page.execute_script('$("#photodropzone").find(".x").first().click()')
|
||||
end
|
||||
|
||||
And /^I click "([^"]*)" button$/ do |arg1|
|
||||
page.execute_script('$(".button:contains('+arg1+')").click()')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ Then /^I should see an uploaded image within the photo drop zone$/ do
|
|||
find("#photodropzone img")["src"].should include("uploads/images")
|
||||
end
|
||||
|
||||
Then /^I should not see an uploaded image within the photo drop zone$/ do
|
||||
find("#photodropzone img").should be_nil
|
||||
end
|
||||
|
||||
Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text|
|
||||
user = User.find_by_email(email)
|
||||
user.post(:status_message, :text => text, :public => true, :to => user.aspects)
|
||||
|
|
|
|||
Loading…
Reference in a new issue