lib/kelp/visibility.rb
# Verify that a button with the given text does not appear on the page.
# Works for `<input...>` as well as `<button...>` elements.
#
# @example
#   should_not_see_button "Delete"
#   should_not_see_button "Save changes", :within => "#read_only"
#
# @param [String] button_text
#   Visible button text to look for
# @param [Hash] scope
#   Scoping keywords as understood by {#in_scope}
#
# @raise [Kelp::Unexpected]
#   If a button with the given text does exist in the given scope
#
# @since 0.1.9
#
Verify that a button with the given text does not appear on the page.
Works for `` as well as `` elements.
Verify that a button with the given text does not appear on the page . Works for ` ` as well as ` ` elements .
def should_not_see_button(button_text, scope={})
      in_scope(scope) do
        xpath = XPath::HTML.button(button_text)[~ XPath.attr(:disabled)]
        if page.has_xpath?(xpath)
          raise Kelp::Unexpected, "Did not expect to see button '#{button_text}', but button exists."
        end
      end
    end
def should_not_see_button ( button_text , scope = { } ) in_scope ( scope ) do xpath = XPath :: HTML . button ( button_text ) [ ~ XPath . attr ( :disabled ) ] if page . has_xpath? ( xpath ) raise Kelp :: Unexpected , "Did not expect to see button '#{button_text}', but button exists." end end end
Verify that a button with the given text does not appear on the page.
Verify that a button with the given text does not appear on the page .
[Kelp::Unexpected] If a button with the given text does exist in the given scope
[ Kelp :: Unexpected ] If a button with the given text does exist in the given scope
button_text
<not_specific>
scope
<not_specific>
<not_specific>
scope Scoping keywords as understood by {#in_scope}
scope Scoping keywords as understood by { #in_scope }
example
should_not_see_button "Delete" should_not_see_button "Save changes", :within => "#read_only"
should_not_see_button " Delete " should_not_see_button " Save changes " : within = > " #read_only "
since
None