feat: 对齐常驻商城与七鱼客服交互
- 同步商城 H5 登录态与原生 token - 完善商城/原生 tab 切换、动画及返回交互 - 修复七鱼客服键盘避让和状态栏恢复 - 调整开屏跳过按钮与登录入口交互
This commit is contained in:
1 parent
b4343ea528
commit
3b089e2205
37 files changed
+2970
-375
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/features/web/application/mall_web_host_controller.dart';
|
||||
|
||||
void main() {
|
||||
final host = MallWebHostController.instance;
|
||||
|
||||
setUp(() async => host.clear());
|
||||
tearDown(() async => host.clear());
|
||||
|
||||
test('opens and dismisses the resident full-screen mall host', () {
|
||||
final uri = Uri.parse('https://mall.example.com/?isNight=0');
|
||||
|
||||
host.open(uri);
|
||||
expect(host.state.value.url, uri.toString());
|
||||
expect(host.state.value.visible, isTrue);
|
||||
|
||||
host.dismiss();
|
||||
expect(host.state.value.url, uri.toString());
|
||||
expect(host.state.value.visible, isFalse);
|
||||
});
|
||||
|
||||
test('cache identity ignores attribution but includes theme', () {
|
||||
const first =
|
||||
'https://mall.example.com/path?isNight=0&click_id=a&tracking_id=t1';
|
||||
const second =
|
||||
'https://mall.example.com/path?isNight=0&click_id=b&tracking_id=t2';
|
||||
const dark = 'https://mall.example.com/path?isNight=1&click_id=b';
|
||||
|
||||
expect(
|
||||
MallWebHostController.cacheKeyFor(first),
|
||||
MallWebHostController.cacheKeyFor(second),
|
||||
);
|
||||
expect(
|
||||
MallWebHostController.cacheKeyFor(first),
|
||||
isNot(MallWebHostController.cacheKeyFor(dark)),
|
||||
);
|
||||
});
|
||||
|
||||
test('defers a changed preload while the mall is visible', () {
|
||||
final active = Uri.parse('https://mall.example.com/?isNight=0');
|
||||
final refreshed = Uri.parse('https://mall.example.com/?isNight=1');
|
||||
|
||||
host.open(active);
|
||||
host.preload(refreshed);
|
||||
expect(host.state.value.url, active.toString());
|
||||
expect(host.state.value.visible, isTrue);
|
||||
|
||||
host.dismiss();
|
||||
expect(host.state.value.url, refreshed.toString());
|
||||
expect(host.state.value.visible, isFalse);
|
||||
});
|
||||
|
||||
test('themed URL replaces a stale isNight value', () {
|
||||
final uri = MallWebHostController.uriForTheme(
|
||||
Uri.parse('https://mall.example.com/?from=jinzhi&isNight=1'),
|
||||
isDark: false,
|
||||
);
|
||||
|
||||
expect(uri.queryParameters['from'], 'jinzhi');
|
||||
expect(uri.queryParameters['isNight'], '0');
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user