Add username to registration dialog
Also adds a recommendation to go to the settings page for more advanced
configuration, and a link.
Bug: Issue 7303
Change-Id: Ib6d03e0411d1db7c55c412d352cb84bf5724b814
diff --git a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.html b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.html
index 858c3ae..15b4fa2 100644
--- a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.html
+++ b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.html
@@ -41,13 +41,16 @@
suite('gr-registration-dialog tests', () => {
let element;
let account;
+ let sandbox;
let _listeners;
setup(done => {
+ sandbox = sinon.sandbox.create();
_listeners = {};
account = {
name: 'name',
+ username: 'username',
email: 'email',
secondary_emails: [
'email2',
@@ -65,6 +68,10 @@
account.name = name;
return Promise.resolve();
},
+ setAccountUsername(username) {
+ account.username = username;
+ return Promise.resolve();
+ },
setPreferredAccountEmail(email) {
account.email = email;
return Promise.resolve();
@@ -75,6 +82,7 @@
});
teardown(() => {
+ sandbox.restore();
for (const eventType in _listeners) {
if (_listeners.hasOwnProperty(eventType)) {
element.removeEventListener(eventType, _listeners[eventType]);
@@ -119,32 +127,26 @@
}).then(done);
});
- test('saves name and preferred email', done => {
+ test('saves account details', done => {
flush(() => {
element.$.name.value = 'new name';
+ element.$.username.value = 'new username';
element.$.email.value = 'email3';
// Nothing should be committed yet.
assert.equal(account.name, 'name');
+ assert.equal(account.username, 'username');
assert.equal(account.email, 'email');
// Save and verify new values are committed.
save().then(() => {
assert.equal(account.name, 'new name');
+ assert.equal(account.username, 'new username');
assert.equal(account.email, 'email3');
}).then(done);
});
});
- test('pressing enter saves name', done => {
- element.$.name.value = 'entered name';
- save(() => {
- MockInteractions.pressAndReleaseKeyOn(element.$.name, 13); // 'enter'
- }).then(() => {
- assert.equal(account.name, 'entered name');
- }).then(done);
- });
-
test('email select properly populated', done => {
element._account = {email: 'foo', secondary_emails: ['bar', 'baz']};
flush(() => {
@@ -152,5 +154,15 @@
done();
});
});
+
+ test('save btn disabled', () => {
+ const compute = element._computeSaveDisabled;
+ assert.isTrue(compute('', '', '', false));
+ assert.isTrue(compute('', 'test', 'test', false));
+ assert.isTrue(compute('test', '', 'test', false));
+ assert.isTrue(compute('test', 'test', '', false));
+ assert.isTrue(compute('test', 'test', 'test', true));
+ assert.isFalse(compute('test', 'test', 'test', false));
+ });
});
</script>