Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from mobify/PROD-1722-cache-breaker
Browse files Browse the repository at this point in the history
PROD-1722: Add support for cache breaker option
  • Loading branch information
jansepar committed Mar 24, 2014
2 parents 133ec86 + 812db1b commit d86b79d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
machine:
node:
version: 0.10.22

dependencies:
pre:
- npm install -g grunt-cli bower
override:
- npm install
- bower install

test:
override:
- grunt test
- grunt test
3 changes: 2 additions & 1 deletion jazzcat.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,10 @@
var options = Utils.extend({}, Jazzcat.defaults, options || {});
return options.base +
(options.projectName ? '/project-' + options.projectName : '') +
(options.cacheBreaker ? '/cb' + options.cacheBreaker : '') +
'/' + options.responseType +
(options.responseType === 'jsonp' ? '/' + options.loadCallback : '') +
'/' + encodeURIComponent(JSON.stringify(urls.slice().sort())); // TODO only sort for jsonp
'/' + encodeURIComponent(JSON.stringify(urls.slice().sort()));
};

var scriptSplitRe = /(<\/scr)(ipt\s*>)/ig;
Expand Down
5 changes: 3 additions & 2 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,12 @@
try {
var projectName = "qux";
var callback = "bar";
expected = "//jazzcat.mobify.com/project-qux/jsonp/bar/%5B%22%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.0.5%2Fangular.min.js%22%2C%22%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.9.1%2Fjquery.min.js%22%5D";
expected = "//jazzcat.mobify.com/project-qux/cb1234/jsonp/bar/%5B%22%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.0.5%2Fangular.min.js%22%2C%22%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.9.1%2Fjquery.min.js%22%5D";

equal(Jazzcat.getURL(urls, {
loadCallback: callback,
projectName: projectName
projectName: projectName,
cacheBreaker: 1234
}), expected);
// Reset projectName
} finally {
Expand Down

0 comments on commit d86b79d

Please sign in to comment.