接入原生壳生命周期事件
新增 app.lifecycle HostBridge 能力与 H5 订阅入口 Expo 壳通过 React Native AppState 注入真实前后台状态 Tauri 壳通过主窗口 focus 和 blur 注入真实激活状态 更新壳能力漂移检查、测试和架构文档
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { lifecyclePayloadFromAppState } from './mobileShellLifecycle';
|
||||
|
||||
describe('mobileShellLifecycle', () => {
|
||||
test('把 React Native AppState 映射为统一 HostBridge 生命周期状态', () => {
|
||||
expect(lifecyclePayloadFromAppState('active')).toEqual({
|
||||
state: 'active',
|
||||
focused: true,
|
||||
nativeState: 'active',
|
||||
});
|
||||
expect(lifecyclePayloadFromAppState('background')).toEqual({
|
||||
state: 'background',
|
||||
focused: false,
|
||||
nativeState: 'background',
|
||||
});
|
||||
expect(lifecyclePayloadFromAppState('inactive')).toEqual({
|
||||
state: 'inactive',
|
||||
focused: false,
|
||||
nativeState: 'inactive',
|
||||
});
|
||||
expect(lifecyclePayloadFromAppState('unknown')).toEqual({
|
||||
state: 'inactive',
|
||||
focused: false,
|
||||
nativeState: 'unknown',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user