Sha256: 6aaf4eb045d799fa4bd7c690af8d6ddfcdf405db8f257d18d9860d6a100342d4

Contents?: true

Size: 546 Bytes

Versions: 13

Compression:

Stored size: 546 Bytes

Contents

Capybara::SpecHelper.spec '#match_css?' do
  before do
    @session.visit('/with_html')
    @element = @session.find(:css, 'span', text: '42')
  end

  it "should be true if the given selector matches the element" do
    expect(@element).to match_css("span")
    expect(@element).to match_css("span.number")
  end

  it "should be false if the given selector does not match" do
    expect(@element).not_to match_css("div")
    expect(@element).not_to match_css("p a#doesnotexist")
    expect(@element).not_to match_css("p.nosuchclass")
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
capybara-2.10.2 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.10.1 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.10.0 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.9.2 lib/capybara/spec/session/element/match_css_spec.rb
tdiary-5.0.2 vendor/bundle/gems/capybara-2.8.0/lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.9.1 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.9.0 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.8.1 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.8.0 lib/capybara/spec/session/element/match_css_spec.rb
tdiary-5.0.1 vendor/bundle/gems/capybara-2.7.1/lib/capybara/spec/session/element/match_css_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/capybara-2.7.1/lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.7.1 lib/capybara/spec/session/element/match_css_spec.rb
capybara-2.7.0 lib/capybara/spec/session/element/match_css_spec.rb