feat: 优化 H5 线路切换逻辑;实现独立 WebView 管理和状态控制
This commit is contained in:
@@ -68,7 +68,7 @@ void main() {
|
||||
isFalse);
|
||||
});
|
||||
|
||||
test('keeps independent non-legacy H5 hosts when removing shell params', () {
|
||||
test('keeps H5 runtime URLs untouched during shell routing', () {
|
||||
final uri = Uri.parse(
|
||||
AppConfig.canonicalizeMainFrameUrl(
|
||||
'https://line-two.example/login?shell_app_name=Old'
|
||||
@@ -78,13 +78,13 @@ void main() {
|
||||
|
||||
expect(uri.host, 'line-two.example');
|
||||
expect(uri.path, '/login');
|
||||
expect(uri.queryParameters.containsKey('shell_app_name'), isFalse);
|
||||
expect(uri.queryParameters.containsKey('flutter_shell'), isFalse);
|
||||
expect(uri.queryParameters['shell_app_name'], 'Old');
|
||||
expect(uri.queryParameters['flutter_shell'], '1');
|
||||
expect(Uri.splitQueryString(uri.fragment).containsKey('shell_app_logo'),
|
||||
isFalse);
|
||||
isTrue);
|
||||
});
|
||||
|
||||
test('rewrites legacy H5 host main-frame URLs to the canonical host', () {
|
||||
test('does not rewrite H5 main-frame URLs for line switching', () {
|
||||
final uri = Uri.parse(
|
||||
AppConfig.canonicalizeMainFrameUrl(
|
||||
'https://h5-test.imharry.work/login?from=runtime'
|
||||
@@ -96,8 +96,9 @@ void main() {
|
||||
expect(uri.host, 'h5-test.imharry.work');
|
||||
expect(uri.path, '/login');
|
||||
expect(uri.queryParameters['from'], 'runtime');
|
||||
expect(uri.queryParameters.containsKey('shell_app_name'), isFalse);
|
||||
expect(uri.queryParameters['shell_app_name'], 'Old');
|
||||
expect(Uri.splitQueryString(uri.fragment).containsKey('shell_app_logo'),
|
||||
isFalse);
|
||||
isTrue);
|
||||
expect(AppConfig.shouldRewriteMainFrameUrl(uri.toString()), isFalse);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user