Skip to content

Commit

Permalink
fix: CSS coverage should work with empty stylesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Jul 3, 2022
1 parent b291d0c commit f9bd036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/assets/csscoverage/empty.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<style></style>
<div>empty style tag</div>
9 changes: 9 additions & 0 deletions spec/integration/coverage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@
end
end

it 'should work with empty stylesheets', sinatra: true do
coverage = page.coverage.css_coverage do
page.goto("#{server_prefix}/csscoverage/empty.html")
end

expect(coverage.size).to eq(1)
expect(coverage.first.text).to eq('')
end

it 'should ignore injected stylesheets' do
coverage = page.coverage.css_coverage do
page.add_style_tag(content: 'body { margin: 10px;}')
Expand Down

0 comments on commit f9bd036

Please sign in to comment.