Example #1
0
  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');
  });
Example #2
0
  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);
  };
Example #3
0
 this.setChildWidgets = function(childWidgets) {
   resetChildren(domElement, [label].concat(childWidgets));
 };
Example #4
0
 this.setChildWidgets = function(childWidgets) {
   resetChildren(domElement, childWidgets);
 };
Example #5
0
 function setOptions(domElement, options) {
   var optionButtons = _.map(options, createOptionButton);
   resetChildren(domElement, optionButtons);
 }
Example #6
0
 this.setDetailWidgets = function(detailWidgets) {
   resetChildren(detailWidgetContainer, detailWidgets);
 };