-
Reiter, Christoph authored
In case the current state is the default one we don't redirect. This gets rid of the initial redirect/histroy entry when loading the page.
Reiter, Christoph authoredIn case the current state is the default one we don't redirect. This gets rid of the initial redirect/histroy entry when loading the page.
unit.js 634 B
import {assert} from '@esm-bundle/chai';
import {Router} from '../src/router.js';
suite('router', () => {
test('basics', () => {
const routes = [
{
name: 'foo',
path: '',
action: (context) => {
return {};
}
},
];
const router = new Router(routes, {
routeName: 'foo',
getState: () => { return {}; },
setState: (state) => { },
getDefaultState: () => { return {}; },
});
router.setStateFromCurrentLocation();
router.update();
router.updateFromPathname("/");
assert.equal(router.getPathname(), '/');
});
});