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

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uts into dev

...@@ -22,9 +22,6 @@ import AlertDialog from 'android.app.AlertDialog'; ...@@ -22,9 +22,6 @@ import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface'; import DialogInterface from 'android.content.DialogInterface';
import EditText from 'android.widget.EditText'; import EditText from 'android.widget.EditText';
import {
UTSAndroid
} from "io.dcloud.uts";
import array from 'android.R.array'; import array from 'android.R.array';
import File from 'java.io.File'; import File from 'java.io.File';
......
import {
UTSAndroid
} from "io.dcloud.uts";
import MediaStore from "android.provider.MediaStore"; import MediaStore from "android.provider.MediaStore";
import Activity from "android.app.Activity"; import Activity from "android.app.Activity";
import Bitmap from "android.graphics.Bitmap"; import Bitmap from "android.graphics.Bitmap";
......
...@@ -10,6 +10,19 @@ export function testDate() : Result { ...@@ -10,6 +10,19 @@ export function testDate() : Result {
expect(secondsElapsed).toEqual(2); expect(secondsElapsed).toEqual(2);
}, 2000) }, 2000)
}) })
test('valueOf', () => {
const date1 = new Date('December 17, 1995 03:24:00');
expect(date1.valueOf()).toEqual(819141840000);
const date2 = new Date('1995-12-17T03:24:00');
expect(date2.valueOf()).toEqual(819141840000);
})
test('parse', () => {
const unixTimeZero = Date.parse('01 Jan 1970 00:00:00 GMT');
const javaScriptRelease = Date.parse('04 Dec 1995 00:12:00 GMT');
expect(unixTimeZero.toString()).toEqual("Thu Jan 01 1970 08:00:00 GMT+0800");
expect(javaScriptRelease.toString()).toEqual("Mon Dec 04 1995 08:12:00 GMT+0800");
})
test('getDate', () => { test('getDate', () => {
const birthday = new Date('August 19, 1975 23:15:30'); const birthday = new Date('August 19, 1975 23:15:30');
const date1 = birthday.getDate(); const date1 = birthday.getDate();
......
...@@ -236,5 +236,10 @@ export function testMath(): Result { ...@@ -236,5 +236,10 @@ export function testMath(): Result {
expect(Math.trunc(42.84)).toEqual(42); expect(Math.trunc(42.84)).toEqual(42);
expect(Math.trunc(0.123)).toEqual(0); expect(Math.trunc(0.123)).toEqual(0);
}) })
test('round', () => {
expect(Math.round(0.9)).toEqual(1);
expect(Math.round(5.95)).toEqual(6);
expect(Math.round(-5.05)).toEqual(-5);
})
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册