From b0ca6ead26c0a2b4f1fab502d0070d2e1b341881 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sat, 19 Mar 2011 15:59:13 -0700 Subject: [PATCH] Fix append cucumber step to trigger keyup, so that it always copies the text from the placeholder input to the real input. --- features/posts.feature | 4 ++-- features/step_definitions/custom_web_steps.rb | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/features/posts.feature b/features/posts.feature index 38bb349f4..1c8f2e900 100644 --- a/features/posts.feature +++ b/features/posts.feature @@ -55,7 +55,7 @@ Feature: posting And I have turned off jQuery effects And I click "Mention" button 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 follow "" Then I should "I am eating a yogurt" @@ -70,7 +70,7 @@ Feature: posting And I have turned off jQuery effects And I click "Mention" button 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 press "Share" in the modal window And I follow "" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index b162fd491..e04352ea1 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -12,9 +12,11 @@ And /^I expand the publisher$/ do end -When /^(?:|I )append "([^"]*)" with "([^"]*)"$/ do |field, value| - script = "$('#{ field }').val(function(index, value) { - return value + ' ' + '#{value}'; });" +When /^I append "([^"]*)" to the publisher$/ do |stuff| + script = <<-JS + $('#status_message_fake_text').val( + $('#status_message_fake_text').val() + '#{stuff}').keyup(); +JS page.execute_script(script) end