Skip to content

Commit

Permalink
Fix rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Jan 19, 2023
1 parent d6b8e38 commit be3fafa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion previews/primer/beta/clipboard_copy_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ def element(aria_label: "Copy text to the system clipboard")
end
end
end
end
end
24 changes: 12 additions & 12 deletions test/system/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ def format_accessibility_errors(violations)
summary["nodes"].map do |node|
index += 1
%{
#{index}) #{summary["id"]}: #{summary["description"]} (#{summary["impact"]})
#{summary["helpUrl"]}
The following #{node["any"].size} node violate this rule:
#{node["any"].map do |_violation|
items = node["failureSummary"].sub("Fix any of the following:", "").split("\n")
%{Selector: #{node["target"].join(', ')}
HTML: #{node["html"]}
#{index}) #{summary['id']}: #{summary['description']} (#{summary['impact']})
#{summary['helpUrl']}
The following #{node['any'].size} node violate this rule:
#{node['any'].map do |_violation|
items = node['failureSummary'].sub('Fix any of the following:', '').split("\n")
%(Selector: #{node['target'].join(', ')}
HTML: #{node['html']}
Fix any of the following:
#{items.map { |item| "- #{item.strip}" }.join}
}
)
end.join}
}
end.join
end.join
%{
%(
Found #{violations.size} accessibility violations:
#{results}
}
)
end

def assert_accessible(excludes: [])
Expand All @@ -76,7 +76,7 @@ def assert_accessible(excludes: [])

results = driver.evaluate_async_script <<~JS
const callback = arguments[arguments.length - 1];
#{File.read("node_modules/axe-core/axe.min.js") unless axe_exists}
#{File.read('node_modules/axe-core/axe.min.js') unless axe_exists}
// Remove cyclic references
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#examples
const getCircularReplacer = () => {
Expand Down Expand Up @@ -109,7 +109,7 @@ def assert_accessible(excludes: [])

message = format_accessibility_errors(violations)

assert violations.size == 0, message
assert violations.size.zero?, message
end

# Capybara Overrides to run accessibility checks when UI changes.
Expand Down

0 comments on commit be3fafa

Please sign in to comment.