Sha256: 221bb71c689bd17ae2bb42a4cf065de50b1bb5f34be4c49fc78a85beb9f4695e

Contents?: true

Size: 1.82 KB

Versions: 8

Compression:

Stored size: 1.82 KB

Contents

#include Briar::Picker

# may only work on circular pickers - does _not_ work on non-circular pickers
# because the visible titles do _not_ follow the selected index
Then /^I should see picker "([^"]*)" with row "([^"]*)" selected$/ do |picker_name, row_named|
  should_see_picker picker_name
  selected_title = selected_title_for_column 0
  unless selected_title.eql?(row_named)
    screenshot_and_raise "found picker named #{picker_name} but #{row_named} was not selected - found #{selected_title}"
  end
end

Then /^I scroll (up|down) on picker "([^"]*)"$/ do |dir, picker_name|
  should_see_picker picker_name
  if dir.eql? 'down'
    picker_scroll_down_on_column 0
  else
    picker_scroll_up_on_column 0
  end
  step_pause
end

Then /^I scroll (up|down) on picker "([^"]*)" to row (\d+)$/ do |dir, picker, row|
  should_see_picker picker
  target_row = row.to_i
  unless picker_current_index_for_column_is(0, target_row)
    count = 0
    begin
      if dir.eql? 'down'
        picker_scroll_down_on_column 0
      else
        picker_scroll_up_on_column 0
      end
      count = count + 1
      step_pause
    end while ((not picker_current_index_for_column_is(0, target_row)) and count < 20)
  end

  unless picker_current_index_for_column_is(0, target_row)
    screenshot_and_raise "scrolled #{dir} on picker 20 times but never found row #{row}"
  end
end

Then /^I should see picker "([^"]*)" has selected row (\d+)$/ do |picker, row|
  should_see_picker picker
  unless picker_current_index_for_column_is(0, row.to_i)
    screenshot_and_raise "expected picker #{picker} to have #{row} selected but found #{picker_current_index_for_column 0}"
  end
end

Then /^I should (see|not see) picker "([^"]*)"$/ do |visibility, picker|
  target = visibility.eql? 'see'
  if target
    should_see_picker picker
  else
    should_not_see_picker picker
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
briar-0.1.3.b1 features/step_definitions/picker/picker_steps.rb
briar-0.1.2 features/step_definitions/picker/picker_steps.rb
briar-0.1.1 features/step_definitions/picker/picker_steps.rb
briar-0.1.0 features/step_definitions/picker/picker_steps.rb
briar-0.0.9 features/step_definitions/picker/picker_steps.rb
briar-0.0.8 features/step_definitions/picker/picker_steps.rb
briar-0.0.7 features/step_definitions/picker/picker_steps.rb
briar-0.0.6 features/step_definitions/picker/picker_steps.rb