-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b89f01f
commit bb63fab
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
require "better_html" | ||
require "better_html/parser" | ||
require "better_html/tree/tag" | ||
|
||
class MissionControl::ErbInlineStylesTest < ActiveSupport::TestCase | ||
ERB_GLOB = Rails.root.join( | ||
"..", "..", "app", "views", "**", "{*.htm,*.html,*.htm.erb,*.html.erb,*.html+*.erb}" | ||
) | ||
|
||
Dir[ERB_GLOB].each do |filename| | ||
pathname = Pathname.new(filename).relative_path_from(Rails.root) | ||
|
||
test "No inline styles in /#{pathname.relative_path_from('../..')}" do | ||
buffer = Parser::Source::Buffer.new("") | ||
buffer.source = File.read(filename) | ||
parser = BetterHtml::Parser.new(buffer) | ||
|
||
parser.nodes_with_type(:tag).each do |tag_node| | ||
tag = BetterHtml::Tree::Tag.from_node(tag_node) | ||
assert_nil tag.attributes["style"] | ||
end | ||
end | ||
end | ||
end |