Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1893 from mozilla/issue-1891-signup-focus
Browse files Browse the repository at this point in the history
fix(client): Autofocus on /signup works again.
  • Loading branch information
nchapman committed Nov 14, 2014
2 parents 8e1b488 + 7f14242 commit 8093d8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/scripts/views/sign_up.js
Expand Up @@ -80,6 +80,8 @@ function (_, p, BaseView, FormView, Template, Session, AuthErrors,
this.showValidationError('input[type=email]',
AuthErrors.toError('DIFFERENT_EMAIL_REQUIRED'));
}

return FormView.prototype.afterVisible.call(this);
},

events: {
Expand Down
15 changes: 15 additions & 0 deletions app/tests/spec/views/sign_up.js
Expand Up @@ -174,6 +174,21 @@ function (chai, _, $, moment, sinon, p, View, Session, AuthErrors, Metrics,
assert.isTrue(view.showValidationError.called);
});
});

it('focuses the email element by default', function (done) {
$('html').addClass('no-touch');
TestHelpers.requiresFocus(function () {
view.render()
.then(function () {

view.$('input[type="email"]').one('focus', function () {
done();
});

view.afterVisible();
});
}, done);
});
});

describe('isValid', function () {
Expand Down

0 comments on commit 8093d8f

Please sign in to comment.