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

调整get-battery-info测试例

上级 94bad925
......@@ -7,6 +7,12 @@ describe('ExtApi-GetBatteryInfo', () => {
})
return
}
if(process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
it('dummyTest', () => {
expect(1).toBe(1)
})
return
}
let page;
let res;
......
......@@ -5,7 +5,7 @@ import { Int } from 'Swift';
import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoResult, GetBatteryInfoSync } from '../interface.uts';
/**
* 导出 获取电量方法
* 导出 获取电量方法
*/
export const getBatteryInfo : GetBatteryInfo = function (options) {
......@@ -15,7 +15,7 @@ export const getBatteryInfo : GetBatteryInfo = function (options) {
// 返回数据
const res : GetBatteryInfoSuccess = {
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,
};
options.success?.(res);
......@@ -29,8 +29,8 @@ export const getBatteryInfoSync : GetBatteryInfoSync = function (): GetBatteryIn
// 返回数据
const res : GetBatteryInfoResult = {
level: Number(UIDevice.current.batteryLevel * 100),
level: Math.abs(Number(UIDevice.current.batteryLevel * 100)),
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
};
return res;
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册