function removeUnused(properties) {
for (var i = properties.length - 1; i >= 0; i--) {
- if (properties[i].unused)
- properties[i].all.splice(i, 1);
+ var property = properties[i];
+
+ if (property.unused)
+ property.all.splice(property.position, 1);
}
}
assert.lengthOf(properties, 1);
assert.equal(properties[0][0], 'color');
}
+ },
+ 'it respects comments': {
+ 'topic': function () {
+ var properties = [
+ [['background'], ['none']],
+ '__ESCAPED_COMMENT_CLEAN_CSS0__',
+ [['color'], ['red']]
+ ];
+ var _properties = wrapForOptimizing(properties);
+ _properties[1].unused = true;
+
+ removeUnused(_properties);
+ return properties;
+ },
+ 'it has one property left': function (properties) {
+ assert.lengthOf(properties, 2);
+ assert.equal(properties[0][0], 'background');
+ assert.equal(properties[1], '__ESCAPED_COMMENT_CLEAN_CSS0__');
+ }
}
})
.export(module);