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-name$="[[item.name]]"
data-url$="[[item.url]]" data-url$="[[item.url]]"
on-click="_handleShowAgreement" on-click="_handleShowAgreement"
disabled$="[[_disableAggreements(item, _groups, _signedAgreements)]]"> disabled$="[[_disableAgreements(item, _groups, _signedAgreements)]]">
<label id="claNewAgreementsLabel">[[item.name]]</label> <label id="claNewAgreementsLabel">[[item.name]]</label>
</span> </span>
<div class$="alreadySubmittedText [[_hideAggreements(item, _groups, _signedAgreements)]]"> <div class$="alreadySubmittedText [[_hideAgreements(item, _groups, _signedAgreements)]]">
Agreement already submitted. Agreement already submitted.
</div> </div>
<div class="agreementsUrl"> <div class="agreementsUrl">

View File

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

View File

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