зеркало из https://github.com/mozilla/commonplace.git
Merge pull request #28 from muffinresearch/fireplace-pr409
Uplift from mozilla/fireplace#409
This commit is contained in:
Коммит
3729b22ba2
|
@ -21,9 +21,10 @@ define('navigation',
|
|||
return url;
|
||||
}
|
||||
|
||||
var used_params = _.pick(utils.querystring(url), settings.param_whitelist);
|
||||
// We can't use urlparams() because that only extends, not replaces.
|
||||
return utils.baseurl(url) + '?' + utils.urlencode(used_params);
|
||||
var used_params = _.pick(utils.querystring(url), settings.param_whitelist);
|
||||
var queryParams = utils.urlencode(used_params);
|
||||
return utils.baseurl(url) + (queryParams.length ? '?' + queryParams : '');
|
||||
}
|
||||
|
||||
function canNavigate() {
|
||||
|
@ -224,7 +225,8 @@ define('navigation',
|
|||
return {
|
||||
'back': back,
|
||||
'stack': function() {return stack;},
|
||||
'navigationFilter': navigationFilter
|
||||
'navigationFilter': navigationFilter,
|
||||
'extract_nav_url': extract_nav_url
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<script type="text/javascript" src="/tests/cache.js"></script>
|
||||
<script type="text/javascript" src="/tests/l10n.js"></script>
|
||||
<script type="text/javascript" src="/tests/models.js"></script>
|
||||
<script type="text/javascript" src="/tests/navigation.js"></script>
|
||||
<script type="text/javascript" src="/tests/requests.js"></script>
|
||||
<script type="text/javascript" src="/tests/urls.js"></script>
|
||||
<script type="text/javascript" src="/tests/utils.js"></script>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
(function() {
|
||||
var a = require('assert');
|
||||
var assert = a.assert;
|
||||
var eq_ = a.eq_;
|
||||
|
||||
var navigation = require('navigation');
|
||||
test('navigation url extraction', function(done) {
|
||||
eq_(navigation.extract_nav_url('/foo/bar?src=all-popular'), '/foo/bar');
|
||||
eq_(navigation.extract_nav_url('/foo/bar?src=all-popular&q=bar'), '/foo/bar?q=bar');
|
||||
done();
|
||||
});
|
||||
})();
|
Загрузка…
Ссылка в новой задаче