* view.js: bunch of utility functions for parsing and composing query strings for hash routing (plus tests).
23 lines
472 B
JavaScript
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);
|