Sha256: 3022d4d2cad907df15efe79c691a9a1cd942aa63808c5e8c0e7af9b0caa40d55

Contents?: true

Size: 981 Bytes

Versions: 77

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#assert_matches_style', requires: [:css] do
  it 'should not raise if the elements style contains the given properties' do
    @session.visit('/with_html')
    expect do
      @session.find(:css, '#first').assert_matches_style(display: 'block')
    end.not_to raise_error
  end

  it "should raise error if the elements style doesn't contain the given properties" do
    @session.visit('/with_html')
    expect do
      @session.find(:css, '#first').assert_matches_style(display: 'inline')
    end.to raise_error(Capybara::ExpectationNotMet, 'Expected node to have styles {"display"=>"inline"}. Actual styles were {"display"=>"block"}')
  end

  it 'should wait for style', requires: %i[css js] do
    @session.visit('/with_js')
    el = @session.find(:css, '#change')
    @session.click_link('Change size')
    expect do
      el.assert_matches_style({ 'font-size': '50px' }, wait: 3)
    end.not_to raise_error
  end
end

Version data entries

77 entries across 64 versions & 5 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/assert_style_spec.rb
capybara-3.35.3 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.35.2 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.35.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.35.0 lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/assert_style_spec.rb
capybara-3.34.0 lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/capybara-3.32.2/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/capybara-3.33.0/lib/capybara/spec/session/assert_style_spec.rb
capybara-3.33.0 lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.29.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/capybara-3.32.2/lib/capybara/spec/session/assert_style_spec.rb