mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
[web] Update the url when route is replaced (#13003)
This commit is contained in:
@@ -153,6 +153,7 @@ class EngineWindow extends ui.Window {
|
||||
final Map<String, dynamic> message = decoded.arguments;
|
||||
switch (decoded.method) {
|
||||
case 'routePushed':
|
||||
case 'routeReplaced':
|
||||
_browserHistory.setRouteName(message['routeName']);
|
||||
break;
|
||||
case 'routePopped':
|
||||
|
||||
@@ -22,7 +22,7 @@ void main() {
|
||||
engine.window.locationStrategy = _strategy = null;
|
||||
});
|
||||
|
||||
test('Tracks pushed and popped routes', () {
|
||||
test('Tracks pushed, replaced and popped routes', () {
|
||||
engine.window.sendPlatformMessage(
|
||||
'flutter/navigation',
|
||||
codec.encodeMethodCall(const engine.MethodCall(
|
||||
@@ -62,5 +62,18 @@ void main() {
|
||||
emptyCallback,
|
||||
);
|
||||
expect(_strategy.path, '/bar/baz');
|
||||
|
||||
engine.window.sendPlatformMessage(
|
||||
'flutter/navigation',
|
||||
codec.encodeMethodCall(const engine.MethodCall(
|
||||
'routeReplaced',
|
||||
<String, dynamic>{
|
||||
'previousRouteName': '/bar/baz',
|
||||
'routeName': '/bar/baz2',
|
||||
},
|
||||
)),
|
||||
emptyCallback,
|
||||
);
|
||||
expect(_strategy.path, '/bar/baz2');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user