Added test for destroy cleanup

This commit is contained in:
Patrick Steele-Idem 2015-02-06 16:48:36 -07:00
parent 081fd49ee9
commit 7d72e56b6e

View File

@ -150,6 +150,19 @@ describe('widget' , function() {
expect(document.getElementById('target').childNodes[1]).to.equal(newWidget.el);
expect(document.getElementById('target').childNodes[2]).to.equal(nextSibling);
});
it('should remove destroyed widgets from scoped widget collection', function() {
var fooWidget = require('./fixtures/components/app-foo')
.render({})
.appendTo(document.getElementById('target'))
.getWidget();
expect(fooWidget.widgets.bar).to.not.be.empty;
fooWidget.widgets.bar.destroy();
expect(fooWidget.widgets.bar).to.be.empty;
});
});