mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
Fix Processor instance in postcssed object
This commit is contained in:
+4
-2
@@ -19,8 +19,10 @@ export default class Processor {
|
||||
for ( let i of plugins ) {
|
||||
let type = typeof i;
|
||||
if ( (type === 'object' || type === 'function') && i.postcss ) {
|
||||
normalized.push(i.postcss);
|
||||
} else if ( type === 'object' && Array.isArray(i.plugins) ) {
|
||||
i = i.postcss;
|
||||
}
|
||||
|
||||
if ( typeof i === 'object' && Array.isArray(i.plugins) ) {
|
||||
normalized = normalized.concat(i.plugins);
|
||||
} else {
|
||||
normalized.push(i);
|
||||
|
||||
@@ -44,6 +44,14 @@ describe('Processor', () => {
|
||||
expect(processor.plugins).to.eql([a]);
|
||||
});
|
||||
|
||||
it('adds new processors from object', () => {
|
||||
let a = () => 1;
|
||||
let processor = new Processor();
|
||||
let other = new Processor([a]);
|
||||
processor.use({ postcss: other });
|
||||
expect(processor.plugins).to.eql([a]);
|
||||
});
|
||||
|
||||
it('returns itself', () => {
|
||||
let a = () => 1;
|
||||
let b = () => 2;
|
||||
|
||||
Reference in New Issue
Block a user