Only the last layer can have a color set.
var shallowClone = require('./clone').shallow;
-function background(property, compactable) {
+function background(property, compactable, lastInMultiplex) {
var components = property.components;
var restored = [];
var needsOne, needsBoth;
i--;
} else {
- if (!isDefault)
- restoreValue(component);
+ if (isDefault || compactable[component.name].multiplexLastOnly && !lastInMultiplex)
+ continue;
+
+ restoreValue(component);
}
}
function multipleValues(restoreWith) {
return function (property, compactable) {
if (!property.multiplex)
- return restoreWith(property, compactable);
+ return restoreWith(property, compactable, true);
var repeatCounts = property.components[0].value.length;
var restored = [];
_property.components.push(_component);
}
- var _restored = restoreWith(_property, compactable);
+ var lastInMultiplex = i == repeatCounts - 1;
+ var _restored = restoreWith(_property, compactable, lastInMultiplex);
Array.prototype.push.apply(restored, _restored);
if (i < repeatCounts - 1)
'topic': 'p{background:red;background-repeat:__ESCAPED_URL_CLEAN_CSS0__,__ESCAPED_URL_CLEAN_CSS1__}',
'into': function (topic) {
assert.deepEqual(_optimize(topic), [
- [['background', false , false], ['__ESCAPED_URL_CLEAN_CSS0__'], ['red'], [','], ['__ESCAPED_URL_CLEAN_CSS1__'], ['red']],
+ [['background', false , false], ['__ESCAPED_URL_CLEAN_CSS0__'], [','], ['__ESCAPED_URL_CLEAN_CSS1__'], ['red']],
]);
}
}
assert.deepEqual(restoredValue, [['0']]);
}
},
+ 'background color in multiplex': {
+ 'topic': function () {
+ return _restore(_breakUp([['background'], ['__ESCAPED_URL_CLEAN_CSS0__'], ['blue'], [','], ['__ESCAPED_URL_CLEAN_CSS1__'], ['red']]));
+ },
+ 'gives right value back': function (restoredValue) {
+ assert.deepEqual(restoredValue, [['__ESCAPED_URL_CLEAN_CSS0__'], [','], ['__ESCAPED_URL_CLEAN_CSS1__'], ['red']]);
+ }
+ }
},
'border radius': {
'4 values': {
return _restore(_breakUp([['background'], ['no-repeat'], ['padding-box'], [','], ['repeat'], ['10px'], ['10px'], ['/'], ['auto'], ['red'], [','], ['top'], ['left'], ['/'], ['30%']]));
},
'gives right value back': function (restoredValue) {
- assert.deepEqual(restoredValue, [['no-repeat'], ['padding-box'], [','], ['10px'], ['10px'], ['red'], [','], ['top'], ['left'], ['/'], ['30%']]);
+ assert.deepEqual(restoredValue, [['no-repeat'], ['padding-box'], [','], ['10px'], ['10px'], [','], ['top'], ['left'], ['/'], ['30%']]);
}
}
},