diff --git a/tests/functional/reporting-non-auth.js b/tests/functional/reporting-non-auth.js index 309539c1f..c1aa43506 100755 --- a/tests/functional/reporting-non-auth.js +++ b/tests/functional/reporting-non-auth.js @@ -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, diff --git a/webcompat/static/js/lib/bugform.js b/webcompat/static/js/lib/bugform.js index ddd2e8110..f8daca676 100644 --- a/webcompat/static/js/lib/bugform.js +++ b/webcompat/static/js/lib/bugform.js @@ -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; diff --git a/webcompat/templates/home-page/form.html b/webcompat/templates/home-page/form.html index 9c38bd656..0911b7054 100644 --- a/webcompat/templates/home-page/form.html +++ b/webcompat/templates/home-page/form.html @@ -124,7 +124,7 @@

Report Site Issue

{{ form.contact(class_='form-field text-field', placeholder='GitHub nickname', pattern='^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$') }} - + {% endif %}