2014-01-06 04:46:19 -06:00
|
|
|
module("Discourse.URL");
|
|
|
|
|
|
|
|
test("navigatedToHome", function() {
|
|
|
|
var fakeListController = { refresh: function() { return true; } };
|
|
|
|
var mock = sinon.mock(fakeListController);
|
|
|
|
this.stub(Discourse.URL, "controllerFor").returns(fakeListController);
|
|
|
|
|
|
|
|
mock.expects("refresh").twice();
|
|
|
|
ok(Discourse.URL.navigatedToHome("/", "/"));
|
|
|
|
|
2014-01-13 18:02:14 -06:00
|
|
|
var defaultFilter = "/" + Discourse.ListController.FILTERS[0];
|
2014-01-06 04:46:19 -06:00
|
|
|
ok(Discourse.URL.navigatedToHome(defaultFilter, "/"));
|
|
|
|
|
|
|
|
ok(!Discourse.URL.navigatedToHome("/old", "/new"));
|
|
|
|
|
|
|
|
// make sure we called the .refresh() method
|
|
|
|
mock.verify();
|
|
|
|
});
|