Module: Pouch::Elements

Included in:
Pouch
Defined in:
lib/pouch/elements.rb

Instance Method Summary collapse

Instance Method Details

#button(name, identifier, *args, &block) ⇒ Object



11
12
13
# File 'lib/pouch/elements.rb', line 11

def button name, identifier, *args, &block
  element :button, name, identifier, args, &block
end

#checkbox(name, identifier, *args, &block) ⇒ Object



15
16
17
18
# File 'lib/pouch/elements.rb', line 15

def checkbox name, identifier, *args, &block
  identifier.merge! type: 'checkbox'
  element :input, name, identifier, args, &block
end

#div(name, identifier, *args, &block) ⇒ Object



20
21
22
# File 'lib/pouch/elements.rb', line 20

def div name, identifier, *args, &block
  element :div, name, identifier, args, &block
end

#element(tag, name, identifier, *args, &block) ⇒ Object



4
5
6
7
8
9
# File 'lib/pouch/elements.rb', line 4

def element tag, name, identifier, *args, &block
  define_method name do
    return browser.element tag, identifier unless block_given?
    block.call browser.send(:element, tag, identifier), *args
  end
end

#file_field(name, identifier, *args, &block) ⇒ Object



24
25
26
27
# File 'lib/pouch/elements.rb', line 24

def file_field name, identifier, *args, &block
  identifier.merge! type: 'file'
  element :input, name, identifier, args, &block
end

#form(name, identifier, *args, &block) ⇒ Object



29
30
31
# File 'lib/pouch/elements.rb', line 29

def form name, identifier, *args, &block
  element :form, name, identifier, args, &block
end

#h1(name, identifier, *args, &block) ⇒ Object



33
34
35
# File 'lib/pouch/elements.rb', line 33

def h1 name, identifier, *args, &block
  element :h1, name, identifier, args, &block
end

#h2(name, identifier, *args, &block) ⇒ Object



37
38
39
# File 'lib/pouch/elements.rb', line 37

def h2 name, identifier, *args, &block
  element :h2, name, identifier, args, &block
end

#h3(name, identifier, *args, &block) ⇒ Object



41
42
43
# File 'lib/pouch/elements.rb', line 41

def h3 name, identifier, *args, &block
  element :h3, name, identifier, args, &block
end

#h4(name, identifier, *args, &block) ⇒ Object



45
46
47
# File 'lib/pouch/elements.rb', line 45

def h4 name, identifier, *args, &block
  element :h4, name, identifier, args, &block
end

#h5(name, identifier, *args, &block) ⇒ Object



49
50
51
# File 'lib/pouch/elements.rb', line 49

def h5 name, identifier, *args, &block
  element :h5, name, identifier, args, &block
end

#h6(name, identifier, *args, &block) ⇒ Object



53
54
55
# File 'lib/pouch/elements.rb', line 53

def h6 name, identifier, *args, &block
  element :h6, name, identifier, args, &block
end

#image(name, identifier, *args, &block) ⇒ Object



57
58
59
# File 'lib/pouch/elements.rb', line 57

def image name, identifier, *args, &block
  element :img, name, identifier, args, &block
end


61
62
63
# File 'lib/pouch/elements.rb', line 61

def link name, identifier, *args, &block
  element :a, name, identifier, args, &block
end

#list_item(name, identifier, *args, &block) ⇒ Object



65
66
67
# File 'lib/pouch/elements.rb', line 65

def list_item name, identifier, *args, &block
  element :li, name, identifier, args, &block
end

#ordered_list(name, identifier, *args, &block) ⇒ Object



69
70
71
# File 'lib/pouch/elements.rb', line 69

def ordered_list name, identifier, *args, &block
  element :ol, name, identifier, args, &block
end

#paragraph(name, identifier, *args, &block) ⇒ Object



73
74
75
# File 'lib/pouch/elements.rb', line 73

def paragraph name, identifier, *args, &block
  element :p, name, identifier, args, &block
end

#radio_button(name, identifier, *args, &block) ⇒ Object



77
78
79
80
# File 'lib/pouch/elements.rb', line 77

def radio_button name, identifier, *args, &block
  identifier.merge! type: 'radio'
  element :input, name, identifier, args, &block
end

#select_list(name, identifier, *args, &block) ⇒ Object



82
83
84
# File 'lib/pouch/elements.rb', line 82

def select_list name, identifier, *args, &block
  element :select, name, identifier, args, &block
end

#span(name, identifier, *args, &block) ⇒ Object



86
87
88
# File 'lib/pouch/elements.rb', line 86

def span name, identifier, *args, &block
  element :span, name, identifier, args, &block
end

#table(name, identifier, *args, &block) ⇒ Object



90
91
92
# File 'lib/pouch/elements.rb', line 90

def table name, identifier, *args, &block
  element :table, name, identifier, args, &block
end

#table_cell(name, identifier, *args, &block) ⇒ Object



94
95
96
# File 'lib/pouch/elements.rb', line 94

def table_cell name, identifier, *args, &block
  element :td, name, identifier, args, &block
end

#table_header(name, identifier, *args, &block) ⇒ Object



98
99
100
# File 'lib/pouch/elements.rb', line 98

def table_header name, identifier, *args, &block
  element :th, name, identifier, args, &block
end

#table_row(name, identifier, *args, &block) ⇒ Object



102
103
104
# File 'lib/pouch/elements.rb', line 102

def table_row name, identifier, *args, &block
  element :tr, name, identifier, args, &block
end

#text_area(name, identifier, *args, &block) ⇒ Object



106
107
108
# File 'lib/pouch/elements.rb', line 106

def text_area name, identifier, *args, &block
  element :textarea, name, identifier, args, &block
end

#text_field(name, identifier, *args, &block) ⇒ Object



110
111
112
# File 'lib/pouch/elements.rb', line 110

def text_field name, identifier, *args, &block
  element :input, name, identifier, args, &block
end

#unordered_list(name, identifier, *args, &block) ⇒ Object



114
115
116
# File 'lib/pouch/elements.rb', line 114

def unordered_list name, identifier, *args, &block
  element :ul, name, identifier, args, &block
end