Sha256: 24c5fa52f9c30f7bf89da4481dad2dca9d191b8963bf76c86b76f7d4f8b6df81

Contents?: true

Size: 949 Bytes

Versions: 20

Compression:

Stored size: 949 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#assert_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_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_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_style({ 'font-size': '50px' }, wait: 3)
    end.not_to raise_error
  end
end

Version data entries

20 entries across 19 versions & 2 rubygems

Version Path
tdiary-5.0.11 vendor/bundle/gems/capybara-3.12.0/lib/capybara/spec/session/assert_style_spec.rb
tdiary-5.0.11 vendor/bundle/gems/capybara-3.6.0/lib/capybara/spec/session/assert_style_spec.rb
capybara-3.12.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.11.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.11.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.10.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.10.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.9.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.8.2 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.8.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.8.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.7.2 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.7.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.7.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.6.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.5.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.5.0 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.4.2 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.4.1 lib/capybara/spec/session/assert_style_spec.rb
capybara-3.4.0 lib/capybara/spec/session/assert_style_spec.rb