Class: GwtWidgets::SuggestBox

Inherits:
PageObject::Elements::TextField
  • Object
show all
Defined in:
lib/gwt_widgets/suggest_box.rb

Class Method Summary collapse

Class Method Details

.accessor_methods(accessor, name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gwt_widgets/suggest_box.rb', line 3

def self.accessor_methods(accessor, name)
  accessor.send :define_method, "#{name}" do
    suggestion_box = self.send "#{name}_element"
  end
  accessor.send :define_method, "#{name}=" do | value |
    suggestion_box = self.send "#{name}_element"
    suggestion_box.parent.text_field_element.value = value
  end
  accessor.send :define_method, "#{name}_suggestions" do
    browser.div(:class => 'gwt-SuggestBoxPopup').tds(:class => 'item').map(&:text)
  end
  accessor.send :define_method, "#{name}_choose" do | label |
    browser.div(:class => 'gwt-SuggestBoxPopup').td(:class => 'item', :text => label).click
  end
end