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 @@ ...@@ -29,6 +29,7 @@
invalid$="[[passwordInvalid_]]" invalid$="[[passwordInvalid_]]"
on-input="onPasswordChanged_" on-input="onPasswordChanged_"
error-message="$i18n{passwordPromptInvalidPassword}" error-message="$i18n{passwordPromptInvalidPassword}"
on-value-changed="onValueChanged_"
aria-disabled="false"> aria-disabled="false">
</paper-input> </paper-input>
</div> </div>
...@@ -37,8 +38,8 @@ ...@@ -37,8 +38,8 @@
$i18n{cancel} $i18n{cancel}
</paper-button> </paper-button>
<paper-button class="action-button" on-click="submitPassword_" <paper-button id="confirmButton" class="action-button"
disabled$="[[!enableConfirm_(password_, passwordInvalid_)]]"> disabled$="[[!confirmEnabled_]]" on-click="submitPassword_">
$i18n{confirm} $i18n{confirm}
</paper-button> </paper-button>
</div> </div>
......
...@@ -44,7 +44,7 @@ Polymer({ ...@@ -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. * quickUnlockPrivate.getAuthToken. Reflected to lock-screen.
* @private * @private
*/ */
...@@ -53,6 +53,13 @@ Polymer({ ...@@ -53,6 +53,13 @@ Polymer({
notify: true, 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. * Helper property which marks password as valid/invalid.
* @private * @private
...@@ -165,8 +172,8 @@ Polymer({ ...@@ -165,8 +172,8 @@ Polymer({
}, },
/** @private */ /** @private */
enableConfirm_: function() { onValueChanged_: function() {
return !!this.$.passwordInput.value && !this.passwordInvalid_; this.confirmEnabled_ = this.$.passwordInput.value && !this.passwordInvalid_;
}, },
}); });
})(); })();
...@@ -164,6 +164,18 @@ cr.define('settings_people_page_quick_unlock', function() { ...@@ -164,6 +164,18 @@ cr.define('settings_people_page_quick_unlock', function() {
done(); done();
}, 0); }, 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