Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Update git submodules
  Update git submodules
  Fix "TypeError: groups is not iterable" in _disableAgreements
  Fix typos: Aggreements -> Agreements

Change-Id: I36702d2b1d43958d149254113fb2172d6a5ff0fe
This commit is contained in:
David Pursehouse
2019-12-02 17:37:43 +09:00
3 changed files with 18 additions and 13 deletions

View File

@@ -78,10 +78,10 @@ limitations under the License.
data-name$="[[item.name]]"
data-url$="[[item.url]]"
on-click="_handleShowAgreement"
disabled$="[[_disableAggreements(item, _groups, _signedAgreements)]]">
disabled$="[[_disableAgreements(item, _groups, _signedAgreements)]]">
<label id="claNewAgreementsLabel">[[item.name]]</label>
</span>
<div class$="alreadySubmittedText [[_hideAggreements(item, _groups, _signedAgreements)]]">
<div class$="alreadySubmittedText [[_hideAgreements(item, _groups, _signedAgreements)]]">
Agreement already submitted.
</div>
<div class="agreementsUrl">

View File

@@ -110,7 +110,8 @@
return agreements ? 'show' : '';
},
_disableAggreements(item, groups, signedAgreements) {
_disableAgreements(item, groups, signedAgreements) {
if (!groups) return false;
for (const group of groups) {
if ((item && item.auto_verify_group &&
item.auto_verify_group.id === group.id) ||
@@ -121,8 +122,8 @@
return false;
},
_hideAggreements(item, groups, signedAgreements) {
return this._disableAggreements(item, groups, signedAgreements) ?
_hideAgreements(item, groups, signedAgreements) {
return this._disableAgreements(item, groups, signedAgreements) ?
'' : 'hide';
},
@@ -134,6 +135,7 @@
// if specified it returns 'hideAgreementsTextBox' which
// then hides the text box and submit button.
_computeHideAgreementClass(name, config) {
if (!config) return '';
for (const key in config) {
if (!config.hasOwnProperty(key)) {
continue;

View File

@@ -142,28 +142,31 @@ limitations under the License.
'none');
});
test('_disableAggreements', () => {
test('_disableAgreements', () => {
// In the auto verify group and have not yet signed agreement
assert.isTrue(
element._disableAggreements(auth, groups, signedAgreements));
element._disableAgreements(auth, groups, signedAgreements));
// Not in the auto verify group and have not yet signed agreement
assert.isFalse(
element._disableAggreements(auth2, groups, signedAgreements));
element._disableAgreements(auth2, groups, signedAgreements));
// Not in the auto verify group, have signed agreement
assert.isTrue(
element._disableAggreements(auth3, groups, signedAgreements));
element._disableAgreements(auth3, groups, signedAgreements));
// Make sure the undefined check works
assert.isFalse(
element._disableAgreements(auth, undefined, signedAgreements));
});
test('_hideAggreements', () => {
test('_hideAgreements', () => {
// Not in the auto verify group and have not yet signed agreement
assert.equal(
element._hideAggreements(auth, groups, signedAgreements), '');
element._hideAgreements(auth, groups, signedAgreements), '');
// In the auto verify group
assert.equal(
element._hideAggreements(auth2, groups, signedAgreements), 'hide');
element._hideAgreements(auth2, groups, signedAgreements), 'hide');
// Not in the auto verify group, have signed agreement
assert.equal(
element._hideAggreements(auth3, groups, signedAgreements), '');
element._hideAgreements(auth3, groups, signedAgreements), '');
});
test('_disableAgreementsText', () => {