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

settings: Disable lock screen password prompt button when no password.

Test: covered by tests
Bug: 838103
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I0bde97d3398ae60968d3646ee8254d24270c84df
Reviewed-on: https://chromium-review.googlesource.com/1056227Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559299}
parent db576145
......@@ -29,6 +29,7 @@
invalid$="[[passwordInvalid_]]"
on-input="onPasswordChanged_"
error-message="$i18n{passwordPromptInvalidPassword}"
on-value-changed="onValueChanged_"
aria-disabled="false">
</paper-input>
</div>
......@@ -37,8 +38,8 @@
$i18n{cancel}
</paper-button>
<paper-button class="action-button" on-click="submitPassword_"
disabled$="[[!enableConfirm_(password_, passwordInvalid_)]]">
<paper-button id="confirmButton" class="action-button"
disabled$="[[!confirmEnabled_]]" on-click="submitPassword_">
$i18n{confirm}
</paper-button>
</div>
......
......@@ -44,7 +44,7 @@ Polymer({
},
/**
* Authhentication token used when calling setModes, returned by
* Authentication token used when calling setModes, returned by
* quickUnlockPrivate.getAuthToken. Reflected to lock-screen.
* @private
*/
......@@ -53,6 +53,13 @@ Polymer({
notify: true,
},
/**
* Helper property which marks whether the confirm button should be enabled
* or disabled.
* @private
*/
confirmEnabled_: Boolean,
/**
* Helper property which marks password as valid/invalid.
* @private
......@@ -165,8 +172,8 @@ Polymer({
},
/** @private */
enableConfirm_: function() {
return !!this.$.passwordInput.value && !this.passwordInvalid_;
onValueChanged_: function() {
this.confirmEnabled_ = this.$.passwordInput.value && !this.passwordInvalid_;
},
});
})();
......@@ -164,6 +164,18 @@ cr.define('settings_people_page_quick_unlock', function() {
done();
}, 0);
});
// Tests that he confirm button is diabled when there is nothing entered.
test('ConfirmButtonDisabled', function() {
let confirmButton = testElement.$$('#confirmButton');
assertTrue(!!confirmButton);
assertTrue(confirmButton.disabled);
passwordElement.value = 'foo';
assertFalse(!!confirmButton.disabled);
passwordElement.value = '';
assertTrue(confirmButton.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