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,54 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/features/web/application/mall_bridge_state.dart';
|
||||
|
||||
void main() {
|
||||
test('updates state and forwards tab interactions before ready', () async {
|
||||
final bridge = MallBridgeController.instance;
|
||||
bridge.detach();
|
||||
addTearDown(bridge.detach);
|
||||
MallBridgeTab? activated;
|
||||
bool? reselected;
|
||||
var backCalls = 0;
|
||||
bridge.attach(
|
||||
activateTab: (tab, reselect) async {
|
||||
activated = tab;
|
||||
reselected = reselect;
|
||||
},
|
||||
goBack: () async => backCalls++,
|
||||
);
|
||||
|
||||
await bridge.activate(MallBridgeTab.orders);
|
||||
expect(activated, MallBridgeTab.orders);
|
||||
expect(bridge.state.value.activeTab, MallBridgeTab.orders);
|
||||
|
||||
bridge.update(const {
|
||||
'ready': true,
|
||||
'activeTab': 'orders',
|
||||
'canGoBack': true,
|
||||
});
|
||||
await bridge.activate(MallBridgeTab.orders, reselect: true);
|
||||
await bridge.goBack();
|
||||
|
||||
expect(bridge.state.value.activeTab, MallBridgeTab.orders);
|
||||
expect(bridge.state.value.canGoBack, isTrue);
|
||||
expect(activated, MallBridgeTab.orders);
|
||||
expect(reselected, isTrue);
|
||||
expect(backCalls, 1);
|
||||
});
|
||||
|
||||
test('accepts numeric and string booleans from H5', () {
|
||||
final bridge = MallBridgeController.instance;
|
||||
bridge.detach();
|
||||
addTearDown(bridge.detach);
|
||||
|
||||
bridge.update(const {
|
||||
'ready': 1,
|
||||
'activeTab': 'market',
|
||||
'canGoBack': 'true',
|
||||
});
|
||||
|
||||
expect(bridge.state.value.ready, isTrue);
|
||||
expect(bridge.state.value.activeTab, MallBridgeTab.market);
|
||||
expect(bridge.state.value.canGoBack, isTrue);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user