Sha256: e4cfce8db380018d438a11b27db3ad0bcb7381ea51a6961add04d03875019df0
Contents?: true
Size: 1.05 KB
Versions: 20
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true Capybara::SpecHelper.spec '#has_style?', requires: [:css] do before do @session.visit('/with_html') end it 'should be true if the element has the given style' do expect(@session.find(:css, '#first')).to have_style(display: 'block') expect(@session.find(:css, '#first').has_style?(display: 'block')).to be true expect(@session.find(:css, '#second')).to have_style('display' => 'inline') expect(@session.find(:css, '#second').has_style?('display' => 'inline')).to be true end it 'should be false if the element does not have the given style' do expect(@session.find(:css, '#first').has_style?('display' => 'inline')).to be false expect(@session.find(:css, '#second').has_style?(display: 'block')).to be false end it 'allows Regexp for value matching' do expect(@session.find(:css, '#first')).to have_style(display: /^bl/) expect(@session.find(:css, '#first').has_style?('display' => /^bl/)).to be true expect(@session.find(:css, '#first').has_style?(display: /^in/)).to be false end end
Version data entries
20 entries across 19 versions & 2 rubygems