Skip to content

Commit

Permalink
Add test for detecting sass variables in compiled css
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Dec 8, 2022
1 parent 0b5f100 commit a3ea629
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/components/component_css_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ def test_css_is_compiled_correctly
Dir["app/components/**/*.css"].each do |file|
css = File.read(file)

# remove comments
css.gsub!(/\/\*((?!\*\/).)*\*\//m, "")

refute(css.include?("@import"), "CSS files should not import other CSS files:\n#{file} contains @import")
refute(css.include?("&"), "CSS Nesting wasn't compiled correctly:\n#{file} contains &")
refute(css.include?("$"), "Sass variable(s) detected:\n#{file} contains $")
end
end
end

0 comments on commit a3ea629

Please sign in to comment.