提交 b51203e1 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整get-battery-info测试例

上级 94bad925
...@@ -7,6 +7,12 @@ describe('ExtApi-GetBatteryInfo', () => { ...@@ -7,6 +7,12 @@ describe('ExtApi-GetBatteryInfo', () => {
}) })
return return
} }
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
it('dummyTest', () => {
expect(1).toBe(1)
})
return
}
let page; let page;
let res; let res;
......
...@@ -15,7 +15,7 @@ export const getBatteryInfo : GetBatteryInfo = function (options) { ...@@ -15,7 +15,7 @@ export const getBatteryInfo : GetBatteryInfo = function (options) {
// 返回数据 // 返回数据
const res : GetBatteryInfoSuccess = { const res : GetBatteryInfoSuccess = {
errMsg: "getBatteryInfo:ok", errMsg: "getBatteryInfo:ok",
level: new Int(UIDevice.current.batteryLevel * 100), level: Math.abs(Number(UIDevice.current.batteryLevel * 100)),
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging, isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
}; };
options.success?.(res); options.success?.(res);
...@@ -29,7 +29,7 @@ export const getBatteryInfoSync : GetBatteryInfoSync = function (): GetBatteryIn ...@@ -29,7 +29,7 @@ export const getBatteryInfoSync : GetBatteryInfoSync = function (): GetBatteryIn
// 返回数据 // 返回数据
const res : GetBatteryInfoResult = { const res : GetBatteryInfoResult = {
level: Number(UIDevice.current.batteryLevel * 100), level: Math.abs(Number(UIDevice.current.batteryLevel * 100)),
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging, isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
}; };
return res; return res;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册