Commit df86ed71 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

settings: Issues with confirming PIN on lock screen.

This CL does:
1) Keeps the confirm button disabled until something has been entered.
2) Enables the confirm button after a new digit has been pressed after a wrong PIN has been entered.
3) Focuses and highlights the wrong PIN after one has been entered.

Test: browser_tests "CrSettingsPeoplePageSetupPinDialogTest.*"
Bug: 751079,751312
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ife71bc02f6955a819cbb65f9d937eb6dd4a78863
Reviewed-on: https://chromium-review.googlesource.com/596922Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491512}
parent c3c269a3
...@@ -256,10 +256,7 @@ Polymer({ ...@@ -256,10 +256,7 @@ Polymer({
} }
this.hideProblem_(); this.hideProblem_();
if (this.canSubmit_()) { this.enableSubmit_ = this.pinKeyboardValue_.length > 0;
this.enableSubmit_ = true;
return;
}
}, },
/** @private */ /** @private */
...@@ -277,6 +274,9 @@ Polymer({ ...@@ -277,6 +274,9 @@ Polymer({
// The PIN is not guaranteed to be valid in that case. // The PIN is not guaranteed to be valid in that case.
if (!this.canSubmit_()) { if (!this.canSubmit_()) {
this.showProblem_(MessageType.MISMATCH, ProblemType.ERROR); this.showProblem_(MessageType.MISMATCH, ProblemType.ERROR);
this.enableSubmit_ = false;
// Focus the PIN keyboard and highlight the entire PIN.
this.$.pinKeyboard.focus(0, this.pinKeyboardValue_.length + 1);
return; return;
} }
......
...@@ -500,6 +500,28 @@ cr.define('settings_people_page_quick_unlock', function() { ...@@ -500,6 +500,28 @@ cr.define('settings_people_page_quick_unlock', function() {
assertDeepEquals(['PIN'], quickUnlockPrivateApi.activeModes); assertDeepEquals(['PIN'], quickUnlockPrivateApi.activeModes);
assertDeepEquals(['1111'], quickUnlockPrivateApi.credentials); assertDeepEquals(['1111'], quickUnlockPrivateApi.credentials);
}); });
test('TestContinueButtonState', function() {
pinKeyboard.value = '1111';
MockInteractions.tap(continueButton);
// Verify the button is disabled when we first enter the confirm step,
// since the PIN value is empty.
assertEquals('', pinKeyboard.value);
assertTrue(continueButton.disabled);
// Verify the button is enabled after we enter one digit.
pinKeyboard.value = '1';
assertFalse(continueButton.disabled);
// Verify the button is disabled after we try to submit a wrong PIN.
MockInteractions.tap(continueButton);
assertTrue(continueButton.disabled);
// Verify the button is enabled after we enter one digit again.
pinKeyboard.value = '11';
assertFalse(continueButton.disabled);
});
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment