
buster.testCase('View#remove()', {

  "Should remove the child passed from the parent's children array": function() {
    var list = new helpers.Views.Layout();
    var Apple = helpers.Views.Apple;
    var apple1 = new Apple();
    var apple2 = new Apple();

    list
      .add(apple1)
      .add(apple2);

    list.remove(apple1);

    assert(!~list.children.indexOf(apple1));
  },

  "Should remove all lookup references": function() {
    var list = new helpers.Views.Layout();
    var Apple = helpers.Views.Apple;
    var apple = new Apple({ id: 'foo' });

    list.add(apple);

    assert(list._ids.foo);
    assert.equals(list._modules.apple[0], apple);

    list.remove(apple);

    refute(list._ids.foo);
    refute(list._modules.apple[0]);
  },

  "Should remove the child from the DOM by default": function() {
    var sandbox = document.createElement('div');
    var list = new helpers.Views.Layout();
    var Apple = helpers.Views.Apple;
    var apple = new Apple({ id: 'slot_1' });
    var inDOM;

    list
      .add(apple)
      .render()
      .setup()
      .inject(sandbox);

    assert(!!sandbox.querySelector('#' + apple._fmid));

    list.remove(apple);

    refute(!!sandbox.querySelector('#' + apple._fmid));
  },

  "Should *not* remove the child from the DOM if `fromDOM` option is false": function() {
    var sandbox = document.createElement('div');
    var list = new helpers.Views.Layout();
    var Apple = helpers.Views.Apple;
    var apple = new Apple({ id: 'slot_1' });
    var inDOM;

    list
      .add(apple)
      .render()
      .setup()
      .inject(sandbox);

    assert(sandbox.querySelector('#' + apple._fmid));

    list.remove(apple, { fromDOM: false });

    assert(sandbox.querySelector('#' + apple._fmid));
  },

  "Should remove itself if called with no arguments": function() {
    var list = new helpers.Views.Layout();
    var Apple = helpers.Views.Apple;
    var apple = new Apple({ id: 'foo' });

    list.add(apple);
    apple.remove();

    refute(~list.children.indexOf(apple));
    refute(list._ids.foo);
  }
});
@@ -2058,15 +2058,266 @@
 s.foo);%0A
+  %7D,%0A%0A  %22Should remove slot reference%22: function() %7B%0A    var layout = new Layout();%0A    var apple = new Apple(%7B slot: 1 %7D);%0A%0A    layout.add(apple);%0A%0A    assert.equals(layout._slots%5B1%5D, apple);%0A%0A    layout.remove(apple);%0A%0A    refute(layout._slots%5B1%5D);%0A
   %7D%0A%7D);

Test that slot ref is removed