Permalink
Browse files

Fixed precedence bug and added test

  • Loading branch information...
bengourley committed May 22, 2012
1 parent b4eb59a commit 0c266ca630f77c13c5528b2aae2ba13182399f0a
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
@@ -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
@@ -0,0 +1 @@
+console.log("hello from alt!")
View
@@ -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 0c266ca

Please sign in to comment.