mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 09:08:15 +00:00
Add missing tests about DeepLinking (#4451)
* Fix #1950 (Deep link not working when nesting have more than two levels.) * Fix test
This commit is contained in:
parent
7345634493
commit
b68c3a755d
@ -426,12 +426,47 @@ describe('StackRouter', () => {
|
|||||||
expect(state3 && state3.index).toEqual(0);
|
expect(state3 && state3.index).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Handle navigation to nested navigator', () => {
|
||||||
|
const state = TestStackRouter.getStateForAction({
|
||||||
|
type: NavigationActions.INIT,
|
||||||
|
});
|
||||||
|
const action = TestStackRouter.getActionForPathAndParams('fo/22/b/hello');
|
||||||
|
/* $FlowFixMe */
|
||||||
|
const state2 = TestStackRouter.getStateForAction(action);
|
||||||
|
expect(state2).toEqual({
|
||||||
|
index: 0,
|
||||||
|
isTransitioning: false,
|
||||||
|
key: 'StackRouterRoot',
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
index: 0,
|
||||||
|
key: 'id-4',
|
||||||
|
isTransitioning: false,
|
||||||
|
routeName: 'foo',
|
||||||
|
params: {
|
||||||
|
fooThing: '22',
|
||||||
|
},
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
routeName: 'bar',
|
||||||
|
key: 'id-3',
|
||||||
|
params: {
|
||||||
|
barThing: 'hello',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('popToTop bubbles up', () => {
|
test('popToTop bubbles up', () => {
|
||||||
const ChildNavigator = () => <div />;
|
const ChildNavigator = () => <div />;
|
||||||
ChildNavigator.router = StackRouter({
|
ChildNavigator.router = StackRouter({
|
||||||
Baz: { screen: () => <div /> },
|
Baz: { screen: () => <div /> },
|
||||||
Qux: { screen: () => <div /> },
|
Qux: { screen: () => <div /> },
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = StackRouter({
|
const router = StackRouter({
|
||||||
Foo: { screen: () => <div /> },
|
Foo: { screen: () => <div /> },
|
||||||
Bar: { screen: ChildNavigator },
|
Bar: { screen: ChildNavigator },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user