mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-18 05:30:21 -04:00
Merge pull request #2957 from alphagov/add-js-tests-for-list-entry
Add JS tests for list entry module
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
(function (Modules) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var root = this,
|
||||
$ = this.jQuery;
|
||||
|
||||
var lists = [],
|
||||
listEntry,
|
||||
ListEntry;
|
||||
@@ -62,6 +58,7 @@
|
||||
getAttributesHTML = function (attrsByElm) {
|
||||
var attrStr = '',
|
||||
elmIdx = attrsByElm.length,
|
||||
existingAttributes = [],
|
||||
elmAttrs,
|
||||
attrIdx;
|
||||
|
||||
@@ -69,7 +66,11 @@
|
||||
elmAttrs = attrsByElm[elmIdx];
|
||||
attrIdx = elmAttrs.length;
|
||||
while (attrIdx--) {
|
||||
attrStr += attributeTemplate.render({ 'name': elmAttrs[attrIdx].name, 'value': elmAttrs[attrIdx].value });
|
||||
// prevent duplicates
|
||||
if ($.inArray(elmAttrs[attrIdx].name, existingAttributes) === -1) {
|
||||
attrStr += attributeTemplate.render({ 'name': elmAttrs[attrIdx].name, 'value': elmAttrs[attrIdx].value });
|
||||
existingAttributes.push(elmAttrs[attrIdx].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return attrStr;
|
||||
|
||||
Reference in New Issue
Block a user