diaspora/features/step_definitions/post_with_poll_steps.rb
op48 66fcfcfcbc Ignoring validation for last poll answer input
last input field is only deleted if there are more than three input fields and the last one is empty

poll is validated only if the last input is empty, and the first three have been filled

Removed duplicate remove last answer.

Dont need to check that the last value is populated as we are ignoring last value

Fixing poll step

Placeholder text edited

Fixed translations for poll answer placeholder text

Removed numbers on publisher option

Removed numbers in placeholder for poll answers
2014-08-13 13:40:14 +01:00

44 lines
1.1 KiB
Ruby

Then /^I should see ([1-9]+) options?$/ do |number|
find("#publisher-poll-creator").all(".poll-answer").count.should eql(number.to_i)
end
And /^I delete the last option$/ do
find("#publisher-poll-creator").all(".poll-answer .remove-answer").first.click
end
And /^I should not see a remove icon$/ do
page.should_not have_css(".remove-answer")
end
When /^I fill in the following for the options:$/ do |table|
i = 0
table.raw.flatten.each do |value|
all(".poll-answer input")[i].set(value)
i+=1
end
end
When /^I check the first option$/ do
page.should have_css('.poll_form input')
first(".poll_form input").click
end
When(/^I press the element "(.*?)"$/) do |selector|
page.should have_css(selector)
find(selector).click
end
When(/^I fill in values for the first two options$/) do
all(".poll-answer input").each_with_index do |answer, i|
answer.set "answer option #{i}"
end
end
When(/^I lose focus$/) do
find("#publisher-poll-creator").click
end
Then /^I should see an element "([^"]*)"$/ do |selector|
page.should have_css(selector)
end