Skip to content
Browse files

Merge pull request #9 from bengourley/master

Precedence issue
  • Loading branch information...
2 parents dd5fd51 + 0c266ca commit 8689fc77bdca5fcc578a547349e742f005773e1d @serby committed May 22, 2012
Showing with 27 additions and 1 deletion.
  1. +1 −1 lib/compact.js
  2. +1 −0 test/assets-alt/a.js
  3. +25 −0 test/compact.test.js
View
2 lib/compact.js
@@ -69,7 +69,7 @@ module.exports.createCompact = function(options) {
for (var i = 0; i < paths.length; i++) {
if (path.existsSync(paths[i])) {
jsPath = paths[i];
- continue;
+ break;
}
}
View
1 test/assets-alt/a.js
@@ -0,0 +1 @@
+console.log("hello from alt!")
View
25 test/compact.test.js
@@ -359,5 +359,30 @@ describe('compact.js', function() {
});
+
+ it('should give higher precedence to the added srcPath', function (done) {
+
+ compact.addNamespace('alternative', altPath);
+ compact.ns.alternative.addJs('a.js');
+
+ var app = {
+ helpers: function (helper) {},
+ configure: function(fn) {
+ fn();
+ }
+ };
+
+ compact.js(['alternative'])({ app : app }, {}, function () {
+
+ var compacted = fs.readFileSync(destPath + '/alternative.js', 'utf8')
+ , raw = fs.readFileSync(altPath + '/a.js', 'utf8');
+
+ compacted.should.equal(raw);
+ done();
+
+ });
+
+ });
+
});
});

0 comments on commit 8689fc7

Please sign in to comment.
Something went wrong with that request. Please try again.