Class: Capybara::BootstrapDatepicker::Picker
- Inherits:
-
Object
- Object
- Capybara::BootstrapDatepicker::Picker
- Defined in:
- lib/capybara-bootstrap-datepicker.rb
Instance Method Summary collapse
- #find_day(value) ⇒ Object
- #find_month(value) ⇒ Object
- #find_year(value) ⇒ Object
- #goto_decade_panel ⇒ Object
-
#initialize ⇒ Picker
constructor
A new instance of Picker.
- #navigate_through_decades(value) ⇒ Object
Constructor Details
#initialize ⇒ Picker
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_panel ⇒ Object
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 |
#navigate_through_decades(value) ⇒ Object
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 |