Fix "TypeError: groups is not iterable" in _disableAgreements
This fixes an issue by adding a undefined check to _disableAgreements in addition to that we also add the check to _computeHideAgreementClass too. Bug: Issue 12020 Change-Id: Icf444aa315d24b34b5bf1cd62173ae62f6b84931
This commit is contained in:
committed by
David Pursehouse
parent
8083ea4fc6
commit
fa1e1f1a5d
@@ -108,6 +108,7 @@
|
||||
},
|
||||
|
||||
_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) ||
|
||||
@@ -131,6 +132,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; }
|
||||
for (const prop in config[key]) {
|
||||
|
||||
@@ -150,6 +150,9 @@ limitations under the License.
|
||||
// Not in the auto verify group, have signed agreement
|
||||
assert.isTrue(
|
||||
element._disableAgreements(auth3, groups, signedAgreements));
|
||||
// Make sure the undefined check works
|
||||
assert.isFalse(
|
||||
element._disableAgreements(auth, undefined, signedAgreements));
|
||||
});
|
||||
|
||||
test('_hideAgreements', () => {
|
||||
|
||||
Reference in New Issue
Block a user