Skip to content

Commit b3eef57

Browse files
committed
Remove counter-related tests
1 parent d86abed commit b3eef57

13 files changed

+1
-169
lines changed

test/custom_helpers_test.rb

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,6 @@ def extended_linter
2020
@linter.extend(ERBLint::Linters::CustomHelpers)
2121
end
2222

23-
def test_counter_correct_does_not_add_offense_if_counter_matches_offense_count
24-
@file = <<~HTML
25-
<%# erblint:counter CustomHelpersTest::FakeLinter 1 %>
26-
HTML
27-
@linter.offenses = ["fake offense"]
28-
29-
extended_linter.counter_correct?(processed_source)
30-
assert_empty @linter.offenses
31-
end
32-
33-
def test_counter_correct_add_offense_if_counter_comment_is_unused
34-
@file = <<~HTML
35-
<%# erblint:counter CustomHelpersTest::FakeLinter 1 %>
36-
HTML
37-
38-
extended_linter.counter_correct?(processed_source)
39-
assert_equal "Unused erblint:counter comment for CustomHelpersTest::FakeLinter", @linter.offenses.first.message
40-
end
41-
42-
def test_counter_correct_add_offense_if_counter_comment_count_is_incorrect
43-
@file = <<~HTML
44-
<%# erblint:counter CustomHelpersTest::FakeLinter 2 %>
45-
HTML
46-
@linter.offenses = ["fake offense"]
47-
48-
extended_linter.counter_correct?(processed_source)
49-
assert_equal "Incorrect erblint:counter number for CustomHelpersTest::FakeLinter. Expected: 2, actual: 1.", @linter.offenses.first.message
50-
end
51-
5223
def test_generate_offense_with_message_defined_in_linter_class
5324
@file = <<~HTML
5425
<%# erblint:disable CustomHelpersTest::FakeLinter %>

test/linters/accessibility/avoid_both_disabled_and_aria_disabled_test.rb

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,4 @@ def test_does_not_warn_if_only_aria_disabled_attribute_is_set
3535

3636
assert_empty @linter.offenses
3737
end
38-
39-
def test_adds_extra_offense_to_add_counter_comment_if_counter_config_enabled
40-
@file = ELEMENTS_WITH_NATIVE_DISABLED_ATTRIBUTE_SUPPORT.map do |element|
41-
"<#{element} aria-disabled='true' disabled> </#{element}>"
42-
end.join
43-
@linter.config.counter_enabled = true
44-
@linter.run(processed_source)
45-
46-
assert_equal @linter.offenses.count, 8
47-
assert_match(/If you must, add <%# erblint:disable GitHub::Accessibility::AvoidBothDisabledAndAriaDisabled %> at the end of the offending line to bypass this check./, @linter.offenses.last.message)
48-
end
49-
50-
def test_does_not_raise_when_ignore_comment_with_correct_count_if_counter_enabled
51-
@file = <<~ERB
52-
<%# erblint:counter GitHub::Accessibility::AvoidBothDisabledAndAriaDisabledCounter 1 %>
53-
<button disabled aria-disabled="true">Some text</button>
54-
ERB
55-
@linter.config.counter_enabled = true
56-
@linter.run(processed_source)
57-
assert_empty @linter.offenses
58-
end
5938
end

test/linters/accessibility/avoid_generic_link_text_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,4 @@ def test_handles_files_with_various_links
144144
refute_empty @linter.offenses
145145
assert_equal 3, @linter.offenses.count
146146
end
147-
148-
def test_does_not_warns_if_element_has_correct_counter_comment_if_config_enabled
149-
@file = <<~ERB
150-
<%# erblint:counter GitHub::Accessibility::AvoidGenericLinkTextCounter 1 %>
151-
<a>Link</a>
152-
ERB
153-
@linter.config.counter_enabled = true
154-
@linter.run(processed_source)
155-
156-
assert_equal 0, @linter.offenses.count
157-
end
158147
end

test/linters/accessibility/disabled_attribute_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,4 @@ def test_does_not_warn_if_valid_element_has_disabled_attribute
2222

2323
assert_empty @linter.offenses
2424
end
25-
26-
def test_does_not_warns_if_element_has_correct_counter_comment_if_config_enabled
27-
@file = <<~ERB
28-
<%# erblint:counter GitHub::Accessibility::DisabledAttributeCounter 1 %>
29-
<a href='https://github.com/' disabled>Go to GitHub</a>
30-
ERB
31-
@linter.config.counter_enabled = true
32-
@linter.run(processed_source)
33-
34-
assert_equal 0, @linter.offenses.count
35-
end
3625
end

test/linters/accessibility/iframe_has_title_test.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,4 @@ def test_does_not_warn_if_iframe_has_title_set_to_string
2727

2828
assert_empty @linter.offenses
2929
end
30-
31-
def test_does_not_raise_when_ignore_comment_with_correct_count_if_config_enabled
32-
@file = <<~ERB
33-
<%# erblint:counter GitHub::Accessibility::IframeHasTitleCounter 1 %>
34-
<iframe></iframe>
35-
ERB
36-
@linter.config.counter_enabled = true
37-
@linter.run(processed_source)
38-
assert_empty @linter.offenses
39-
end
4030
end

test/linters/accessibility/image_has_alt_test.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,4 @@ def test_does_not_warn_if_image_has_alt_attribute_set_to_string
2727

2828
assert_empty @linter.offenses
2929
end
30-
31-
def test_does_not_raise_when_ignore_comment_with_correct_count_if_config_enabled
32-
@file = <<~ERB
33-
<%# erblint:counter GitHub::Accessibility::ImageHasAltCounter 1 %>
34-
<img></img>
35-
ERB
36-
@linter.config.counter_enabled = true
37-
@linter.run(processed_source)
38-
assert_empty @linter.offenses
39-
end
4030
end

test/linters/accessibility/link_has_href_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,4 @@ def test_does_not_warn_if_link_has_href_attribute
2222

2323
assert_empty @linter.offenses
2424
end
25-
26-
def test_does_not_warn_if_link_has_href_attribute_and_has_correct_counter_comment
27-
@file = <<~ERB
28-
<%# erblint:counter GitHub::Accessibility::LinkHasHrefCounter 1 %>
29-
<a>Go to GitHub</a>
30-
ERB
31-
@linter.config.counter_enabled = true
32-
@linter.run(processed_source)
33-
34-
assert_equal 0, @linter.offenses.count
35-
end
3625
end

test/linters/accessibility/nested_interactive_elements_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,4 @@ def test_does_not_warn_if_there_are_not_nested_interactive_elements
2222

2323
assert_empty @linter.offenses
2424
end
25-
26-
def test_does_not_warn_if_there_are_not_nested_interactive_elements_and_has_correct_counter_comment_with_config_enabled
27-
@file = <<~ERB
28-
<%# erblint:counter GitHub::Accessibility::NestedInteractiveElementsCounter 1 %>
29-
<button><a href='https://github.com/'>Go to GitHub</a></button>
30-
ERB
31-
@linter.config.counter_enabled = true
32-
@linter.run(processed_source)
33-
34-
assert_equal 0, @linter.offenses.count
35-
end
3625
end

test/linters/accessibility/no_aria_label_misuse_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,4 @@ def test_does_not_warn_if_generic_elements_have_aria_label_and_allowed_role
7474
@linter.run(processed_source)
7575
assert_empty @linter.offenses
7676
end
77-
78-
def test_does_not_raise_when_ignore_comment_with_correct_count_and_config_enabled
79-
@file = <<~ERB
80-
<%# erblint:counter GitHub::Accessibility::NoAriaLabelMisuseCounter 2 %>
81-
<span aria-label="This is a bad idea">Some text</span>
82-
<span aria-label="This is still a bad idea">More text</span>
83-
ERB
84-
@linter.config.counter_enabled = true
85-
@linter.run(processed_source)
86-
assert_empty @linter.offenses
87-
end
8877
end

test/linters/accessibility/no_positive_tab_index_test.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,4 @@ def test_does_not_warn_if_zero_tabindex_is_used
2727

2828
assert_empty @linter.offenses
2929
end
30-
31-
def test_does_not_raise_when_ignore_comment_with_correct_count_and_config_enabled
32-
@file = <<~ERB
33-
<%# erblint:counter GitHub::Accessibility::NoPositiveTabIndexCounter 1 %>
34-
<button tabindex='1'></button>
35-
ERB
36-
@linter.config.counter_enabled = true
37-
@linter.run(processed_source)
38-
assert_empty @linter.offenses
39-
end
4030
end

0 commit comments

Comments
 (0)