Skip to content

Commit

Permalink
add additional cases for ok and accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Nov 15, 2023
1 parent a784f4c commit 84bd2c3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
13 changes: 13 additions & 0 deletions static/previews.json
Original file line number Diff line number Diff line change
Expand Up @@ -6165,6 +6165,19 @@
]
}
},
{
"preview_path": "primer/alpha/text_field/with_auto_check_accepted",
"name": "with_auto_check_accepted",
"snapshot": "false",
"skip_rules": {
"wont_fix": [
"region"
],
"will_fix": [
"color-contrast"
]
}
},
{
"preview_path": "primer/alpha/text_field/with_auto_check_ok",
"name": "with_auto_check_ok",
Expand Down
30 changes: 29 additions & 1 deletion test/system/alpha/text_field_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,35 @@ def test_auto_check_error

find("input[type=text]").fill_in(with: "foobar")

assert_selector ".FormControl-inlineValidation", text: "Error! Error!"
assert_selector ".FormControl-inlineValidation.FormControl-inlineValidation--error", text: "The name foobar is already taken."
assert_selector ".FormControl-inlineValidation--visual .octicon-alert-fill"
refute_selector ".FormControl-inlineValidation--visual .octicon-check-circle-fill"
end

def test_auto_check_accepted
visit_preview(:with_auto_check_accepted)

assert_selector ".FormControl-inlineValidation", visible: :hidden, text: ""

find("input[type=text]").fill_in(with: "foobar")

assert_selector ".FormControl-inlineValidation.FormControl-inlineValidation--success" do |message|
assert_match "The name foobar is available.", message.text
end
refute_selector ".FormControl-inlineValidation--visual .octicon-alert-fill"
assert_selector ".FormControl-inlineValidation--visual .octicon-check-circle-fill"
end

def test_auto_check_ok
visit_preview(:with_auto_check_ok)

assert_selector ".FormControl-inlineValidation", visible: :hidden, text: ""

find("input[type=text]").fill_in(with: "foobar")

refute_selector ".FormControl-inlineValidation"
refute_selector ".FormControl-inlineValidation--visual .octicon-alert-fill"
refute_selector ".FormControl-inlineValidation--visual .octicon-check-circle-fill"
end

def test_custom_data_target
Expand Down

0 comments on commit 84bd2c3

Please sign in to comment.