Skip to content

Commit e5d538e

Browse files
committed
More test fixes
1 parent 6410319 commit e5d538e

2 files changed

Lines changed: 8 additions & 50 deletions

File tree

test/system/alpha/text_area_test.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,32 @@ def test_character_limit_screen_reader_not_announced_on_load
9595
visit_preview(:with_character_limit)
9696

9797
sr_element = find("span.sr-only[aria-live='polite']")
98-
99-
# Screen reader element should be empty on initial load
98+
10099
assert_equal "", sr_element.text
101-
102-
# Only populated after user input
100+
103101
textarea = find("textarea[data-target='primer-text-area.inputElement']")
104102
textarea.fill_in(with: "Test")
105-
103+
106104
sleep 0.6 # Wait for debounced update
107-
105+
108106
assert_equal "6 characters remaining", sr_element.text
109107
end
110108

111109
def test_character_limit_icon_visibility
112110
visit_preview(:with_character_limit)
113111

114-
# Icon should be hidden initially
115112
assert_selector "span.FormControl-caption .FormControl-caption-icon[hidden]"
116-
113+
117114
textarea = find("textarea[data-target='primer-text-area.inputElement']")
118-
119-
# Icon should remain hidden when under limit
115+
120116
textarea.fill_in(with: "Hello")
121117
sleep 0.3
122118
assert_selector "span.FormControl-caption .FormControl-caption-icon[hidden]"
123-
124-
# Icon should be visible when over limit
119+
125120
textarea.fill_in(with: "Hello World!")
126121
sleep 0.3
127122
assert_selector "span.FormControl-caption .FormControl-caption-icon:not([hidden])", visible: :visible
128-
129-
# Icon should be hidden again when back under limit
123+
130124
textarea.fill_in(with: "Hi")
131125
sleep 0.3
132126
assert_selector "span.FormControl-caption .FormControl-caption-icon[hidden]"

test/system/alpha/text_field_test.rb

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -155,40 +155,18 @@ def test_character_limit_clears_validation_when_back_under_limit
155155
input.fill_in(with: "Hello World!") # 12 characters
156156
sleep 0.3
157157

158-
assert_selector "span.FormControl-caption .FormControl-caption-icon:not([hidden])", visible: :visible
159158
assert_selector "input[invalid='true'][aria-invalid='true']"
160159

161160
input.fill_in(with: "Hello") # 5 characters
162161
sleep 0.3
163162

164163
assert_selector "span.FormControl-caption[data-max-length='10'] .FormControl-caption-text", text: "5 characters remaining"
165-
refute_selector "span.FormControl-caption .FormControl-caption-icon[hidden]", visible: :all
166164
refute_selector "span.FormControl-caption.fgColor-danger"
167165

168166
refute_selector "input[invalid='true']"
169167
refute_selector "input[aria-invalid='true']"
170168
end
171169

172-
def test_character_limit_screen_reader_text_updates
173-
visit_preview(:with_character_limit)
174-
175-
input = find("input[type=text][data-target*='primer-text-field.inputElement']")
176-
177-
sr_element = find("span.sr-only[aria-live='polite']")
178-
179-
input.fill_in(with: "Test")
180-
181-
# Wait for debounced update (500ms + buffer)
182-
sleep 0.6
183-
184-
assert_equal "6 characters remaining", sr_element.text
185-
186-
input.fill_in(with: "Hello World!") # 12 characters
187-
sleep 0.6
188-
189-
assert_equal "2 characters over", sr_element.text
190-
end
191-
192170
def test_character_limit_singular_vs_plural
193171
visit_preview(:with_character_limit)
194172

@@ -204,19 +182,5 @@ def test_character_limit_singular_vs_plural
204182

205183
assert_selector "span.FormControl-caption[data-max-length='10'] .FormControl-caption-text", text: "1 character over"
206184
end
207-
208-
def test_character_limit_screen_reader_not_announced_on_load
209-
visit_preview(:with_character_limit)
210-
211-
sr_element = find("span.sr-only[aria-live='polite']")
212-
213-
assert_equal "", sr_element.text
214-
215-
input = find("input[type=text][data-target*='primer-text-field.inputElement']")
216-
input.fill_in(with: "Test")
217-
218-
sleep 0.6 # Wait for debounced update
219-
assert_equal "6 characters remaining", sr_element.text
220-
end
221185
end
222186
end

0 commit comments

Comments
 (0)