Top Level Namespace

Defined Under Namespace

Modules: Accessibility, RSpec

Instance Method Summary collapse

Instance Method Details

#have_child(kind, filters = {}) { ... } ⇒ Object

Assert that the receiving element has the specified child element. You can use any filters you would normally use in a search, including a block.

Examples:


window.toolbar.should have_child(:search_field)
table.should have_child(:row, static_text: { value: /42/ })

search_field.should_not have_child(:busy_indicator)

Parameters:

  • kind (#to_s)
  • filters (Hash) (defaults to: {})

Yields:

  • An optional block to be used as part of the search qualifier



174
175
176
# File 'lib/rspec/expectations/ax_elements.rb', line 174

def have_child kind, filters = {}, &block
  Accessibility::HasChildMatcher.new kind, filters, &block
end

#have_descendent(kind, filters = {}) { ... } ⇒ Object Also known as: have_descendant

Assert that the given element has the specified descendent. You can pass any parameters you normally would use during a search, including a block.

Examples:


app.main_window.should have_descendent(:button, title: 'Press Me')

row.should_not have_descendent(:check_box)

Parameters:

  • kind (#to_s)
  • filters (Hash) (defaults to: {})

Yields:

  • An optional block to be used as part of the search qualifier



192
193
194
# File 'lib/rspec/expectations/ax_elements.rb', line 192

def have_descendent kind, filters = {}, &block
  Accessibility::HasDescendentMatcher.new kind, filters, &block
end

#shortly_have_child(kind, filters = {}) { ... } ⇒ Object

Assert that the given element has the specified child soon. This method will block until the child is found or a timeout occurs. You can pass any parameters you normally would use during a search, including a block.

Examples:


app.main_window.should shortly_have_child(:row, static_text: { value: 'Cake' })

row.should_not shortly_have_child(:check_box)

Parameters:

  • kind (#to_s)
  • filters (Hash) (defaults to: {})

Yields:

  • An optional block to be used as part of the search qualifier



212
213
214
# File 'lib/rspec/expectations/ax_elements.rb', line 212

def shortly_have_child kind, filters = {}, &block
  Accessibility::HasChildShortlyMatcher.new(kind, filters, &block)
end

#shortly_have_descendent(kind, filters = {}) { ... } ⇒ Object Also known as: shortly_have_descendant

Assert that the given element has the specified descendent soon. This method will block until the descendent is found or a timeout occurs. You can pass any parameters you normally would use during a search, including a block.

Examples:


app.main_window.should shortly_have_child(:row, static_text: { value: 'Cake' })

row.should_not shortly_have_child(:check_box)

Parameters:

  • kind (#to_s)
  • filters (Hash) (defaults to: {})

Yields:

  • An optional block to be used as part of the search qualifier



231
232
233
# File 'lib/rspec/expectations/ax_elements.rb', line 231

def shortly_have_descendent kind, filters = {}, &block
  Accessibility::HasDescendentShortlyMatcher.new kind, filters, &block
end