Skip to content

Fixes #2788 - Make GitHub username regex case-insensitive #2789

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

Merged
merged 1 commit into from
Jan 31, 2019
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
54 changes: 54 additions & 0 deletions tests/functional/reporting-non-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,60 @@ registerSuite("Reporting (non-auth)", {
.end();
},

"Mixed and lowercase GitHub usernames are valid"() {
return (
FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-report-buttons"
)
.findByCssSelector("#contact")
.click()
.type("WebCompat-Bot")
.end()
.sleep(500)
// make sure we can see the valid checkbox (i.e. it's background image is non-empty)
.execute(function() {
return window
.getComputedStyle(
document.querySelector(".js-bug-form-contact"),
":after"
)
.getPropertyValue("background-image");
})
.then(function(bgImage) {
assert.include(
bgImage,
"checkmark.svg",
"The valid checkbox pseudo is visible"
);
})
.end()
.findByCssSelector("#contact")
.click()
.type("webcompat-bot")
.end()
.sleep(500)
// make sure we can see the valid checkbox (i.e. it's background image is non-empty)
.execute(function() {
return window
.getComputedStyle(
document.querySelector(".js-bug-form-contact"),
":after"
)
.getPropertyValue("background-image");
})
.then(function(bgImage) {
assert.include(
bgImage,
"checkmark.svg",
"The valid checkbox pseudo is visible"
);
})
.end()
);
},

"GitHub contact name with two consecutives --"() {
return FunctionalHelpers.openPage(
this,
Expand Down
2 changes: 1 addition & 1 deletion webcompat/static/js/lib/bugform.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function BugForm() {
this.submitTypeInput = $("#submit_type:hidden");
this.uploadLabel = $(".js-label-upload");
this.urlParamRegExp = /url=([^&]+)/;
this.githubRegexp = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/;
this.githubRegexp = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i;

this.UPLOAD_LIMIT = 1024 * 1024 * 4;

Expand Down
2 changes: 1 addition & 1 deletion webcompat/templates/home-page/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h1 class="headline-1">Report Site Issue</h1>
{{ form.contact(class_='form-field text-field',
placeholder='GitHub nickname',
pattern='^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$') }}
<span class="form-input-validation check error"></span>
<span class="form-input-validation check error js-bug-form-contact"></span>
</div>
{% endif %}
<div class="form-button form-button-multiple form-element js-Form-group js-report-buttons">
Expand Down