Class: Capybara::BootstrapDatepicker::Picker

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara-bootstrap-datepicker.rb

Instance Method Summary collapse

Constructor Details

#initializePicker

Returns a new instance of Picker.



45
46
47
# File 'lib/capybara-bootstrap-datepicker.rb', line 45

def initialize
  @element = find_picker
end

Instance Method Details

#find_day(value) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/capybara-bootstrap-datepicker.rb', line 68

def find_day(value)
  day_xpath = "      .//*[contains(concat(' ', @class, ' '), ' day ')\n      and not(contains(concat(' ', @class, ' '), ' old '))\n      and not(contains(concat(' ', @class, ' '), ' new '))\n      and normalize-space(text())='\#{value}']\n  eos\n  days.find :xpath, day_xpath\nend\n"

#find_month(value) ⇒ Object



64
65
66
# File 'lib/capybara-bootstrap-datepicker.rb', line 64

def find_month(value)
  months.find '.month', text: value
end

#find_year(value) ⇒ Object



60
61
62
# File 'lib/capybara-bootstrap-datepicker.rb', line 60

def find_year(value)
  years.find '.year', text: value
end

#goto_decade_panelObject



49
50
51
52
# File 'lib/capybara-bootstrap-datepicker.rb', line 49

def goto_decade_panel
  current_month.click if days.visible?
  current_year.click if months.visible?
end


54
55
56
57
58
# File 'lib/capybara-bootstrap-datepicker.rb', line 54

def navigate_through_decades(value)
  decade_start, decade_end = current_decade_minmax
  goto_prev_decade(value, decade_start) if value < decade_start
  goto_next_decade(decade_end, value) if value > decade_end
end