Skip to content

Commit

Permalink
remove necessity for specifying empty post in flow
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Apr 13, 2015
1 parent d6ed1d2 commit b96d3c7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Flow.prototype.post = function (blockType) {
//
Flow.prototype.setPost = function (post) {
// FIXME: Check format !!!
this._post = post;
this._post = post || {};
};


Expand Down
13 changes: 13 additions & 0 deletions test/test-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,17 @@ describe('ConfigWriter', function () {
assert.deepEqual(flow.post('js'), ['foo', 'bar']);
});

it('should default to empty post', function () {
// default flow
var flow = new Flow({
steps: {
js: ['concat', 'uglify'],
css: ['concat', 'cssmin']
},
post: {}
});
// this might be called if someone define a flow without adding a `post` entry
flow.setPost();
assert.deepEqual(flow._post, {});
});
});
9 changes: 3 additions & 6 deletions test/test-usemin-prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ describe('useminPrepare', function () {
flow: {
steps: {
js: ['uglify']
},
post: {}
}
}
}
});
Expand Down Expand Up @@ -257,8 +256,7 @@ describe('useminPrepare', function () {
html: {
steps: {
js: ['uglify']
},
post: {}
}
}
}
}
Expand Down Expand Up @@ -302,8 +300,7 @@ describe('useminPrepare', function () {
flow: {
steps: {
js: [copy]
},
post: {}
}
}
}
});
Expand Down

0 comments on commit b96d3c7

Please sign in to comment.