Add Conrainer#removeAll()

This commit is contained in:
Andrey Sitnik
2014-12-27 00:24:14 +03:00
parent 61cbfd43dc
commit bf0faefca2
2 changed files with 21 additions and 0 deletions
+12
View File
@@ -297,6 +297,18 @@ class Container extends Node {
return this;
}
// Remove all children in node.
//
// css.removeAll();
removeAll() {
for ( var i = 0; i < this.nodes.length; i++ ) {
this.nodes[i].parent == undefined;
}
this.nodes = [];
return this;
}
// Return true if all nodes return true in `condition`.
// Just shorcut for `nodes.every`.
every(condition) {
+9
View File
@@ -493,6 +493,15 @@ describe('Container', () => {
});
describe('removeAll()', () => {
it('removes all children', () => {
this.rule.removeAll();
expect(this.rule.toString()).to.eql('a { }');
});
});
describe('any()', () => {
it('return true if all children return true', () => {