senny / corner_stones

capybara building blocks for acceptance tests.
18 stars 8 forks source link

ignore dismiss button of alert message #44

Closed siegy22 closed 8 years ago

siegy22 commented 8 years ago

If a bootstrap 3 alert has a close button it will have a <a> or a <button> inside which has data-dismiss="alert" or the class close

If corner stones gets the flash message of an alert with a close button it will return the X (close button text) within the text of the flash message.

With this commit corner stones will ignore elements inside an alert which have the data-dismiss="alert" or class="close" attributes.

senny commented 8 years ago
          native = message.native.dup
          Array(@options[:ignore_selectors]).each do |ignore_selector|
            native.css(ignore_selector).remove
          end

          present_messages[type] << {text: native.text.strip}
    subject { CornerStones::FlashMessages.new(message_types: [:'alert-info', :'alert-danger', :'alert-warning'],
                                              ignore_selectors: '.close')}