datahub/test/util.test.js
Rufus Pollock ed3d20b20f [#42,flot-graph][s]: reinstate configuration of graph from routing info lost in penultimate commit a9cfd4412c8a4b9645e100997a4d1898620b0290.
* view.js: bunch of utility functions for parsing and composing query strings for hash routing (plus tests).
2012-02-17 21:47:51 +00:00

23 lines
472 B
JavaScript

(function ($) {
module("Util");
test('parseHashUrl', function () {
var out = recline.View.parseHashUrl('graph?x=y');
equal(out.path, 'graph');
equal(out.query, '?x=y');
var out = recline.View.parseHashUrl('graph');
equal(out.path, 'graph');
equal(out.query, '');
});
test('composeQueryString', function () {
var params = {
x: 'y',
a: 'b'
};
var out = recline.View.composeQueryString(params);
equal(out, '?x="y"&a="b"');
});
})(this.jQuery);