it('can reset the children of a given DOM element', function() { var container = createDOMElement('container'); var child = createDOMElement('child'); container.appendChild(child); var aNewChild = createDOMElement('new-child'); var aWidget = new LabeledTextField('A field'); resetChildren(container, [aNewChild, aWidget]); assert.equal(container.children.length, 2, 'has the appropriate number of children'); assert.equal(container.children[0].tagName, aNewChild.tagName, 'contains the new children only'); assert.equal(container.children[1].tagName, 'LABELED-TEXT-FIELD', 'contains the new children only'); });
this.setData = function(todoItemData) { assert(Array.isArray(todoItemData), 'TodoList#setData expects the argument to be an array of objects'); items = createItems(todoItemData); resetChildren(domElement, items); };
this.setChildWidgets = function(childWidgets) { resetChildren(domElement, [label].concat(childWidgets)); };
this.setChildWidgets = function(childWidgets) { resetChildren(domElement, childWidgets); };
function setOptions(domElement, options) { var optionButtons = _.map(options, createOptionButton); resetChildren(domElement, optionButtons); }
this.setDetailWidgets = function(detailWidgets) { resetChildren(detailWidgetContainer, detailWidgets); };