Fix append cucumber step to trigger keyup, so that it always copies the text from the placeholder input to the real input.

This commit is contained in:
Sarah Mei 2011-03-19 15:59:13 -07:00
parent 7cd1789669
commit b0ca6ead26
2 changed files with 7 additions and 5 deletions

View file

@ -55,7 +55,7 @@ Feature: posting
And I have turned off jQuery effects And I have turned off jQuery effects
And I click "Mention" button And I click "Mention" button
And I expand the publisher in the modal window And I expand the publisher in the modal window
And I append "#status_message_text" with "I am eating a yogurt" in the modal window And I append "I am eating a yogurt" to the publisher in the modal window
And I press "Share" in the modal window And I press "Share" in the modal window
And I follow "<aspect>" And I follow "<aspect>"
Then I should <see> "I am eating a yogurt" Then I should <see> "I am eating a yogurt"
@ -70,7 +70,7 @@ Feature: posting
And I have turned off jQuery effects And I have turned off jQuery effects
And I click "Mention" button And I click "Mention" button
And I expand the publisher in the modal window And I expand the publisher in the modal window
And I append "#status_message_text" with "I am eating a yogurt" in the modal window And I append "I am eating a yogurt" to the publisher in the modal window
And I follow "DidntPostTo" within "#publisher" in the modal window And I follow "DidntPostTo" within "#publisher" in the modal window
And I press "Share" in the modal window And I press "Share" in the modal window
And I follow "<aspect>" And I follow "<aspect>"

View file

@ -12,9 +12,11 @@ And /^I expand the publisher$/ do
end end
When /^(?:|I )append "([^"]*)" with "([^"]*)"$/ do |field, value| When /^I append "([^"]*)" to the publisher$/ do |stuff|
script = "$('#{ field }').val(function(index, value) { script = <<-JS
return value + ' ' + '#{value}'; });" $('#status_message_fake_text').val(
$('#status_message_fake_text').val() + '#{stuff}').keyup();
JS
page.execute_script(script) page.execute_script(script)
end end