Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pattern for needle tag #6024

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions t/ui/12-needle-edit.t
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,18 @@ my $needlename = 'test-newneedle';
my $xoffset = my $yoffset = 200;

subtest 'Create new needle' => sub {
subtest 'invalid needle tag is rejected' => sub {
$elem = $driver->find_element_by_id('newtag');
$elem->send_keys('123');
my $button = $driver->find_element_by_id('tag_add_button');
ok !$button->is_enabled, 'tag too short, Add button not enabled';
$elem->send_keys('4');
ok $button->is_enabled, 'tag valid, Add button enabled';
$elem->send_keys('!');
ok !$button->is_enabled, 'tag invalid, Add button not enabled';
$elem->clear;
};

add_needle_tag();

# check needle name input
Expand Down
2 changes: 1 addition & 1 deletion templates/webapi/step/edit.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<div class="mb-3 row">
<div class="col-sm-10">
<input type="text" class="form-control" id="newtag" placeholder="Add new tags here"
pattern="^[A-Za-z0-9-_]+$" minLength=4 title="[A-Za-z0-9-_], at least 4 characters">
pattern="^[A-Za-z0-9\-_]+$" minLength=4 title="[A-Za-z0-9-_], at least 4 characters">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-secondary form-control" id="tag_add_button" disabled>Add</button>
Expand Down
Loading