Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a0ac6cf9
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a0ac6cf9
编写于
6月 20, 2022
作者:
L
lixingyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
https://gitee.com/openharmony/xts_acts/issues/I5D091`
Signed-off-by:
N
lixingyang
<
lixingyang8@huawei.com
>
上级
550dfdbf
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
154 addition
and
0 deletion
+154
-0
compileruntime/url_lib_standard/src/main/js/test/url.test.js
compileruntime/url_lib_standard/src/main/js/test/url.test.js
+154
-0
未找到文件。
compileruntime/url_lib_standard/src/main/js/test/url.test.js
浏览文件 @
a0ac6cf9
...
...
@@ -239,6 +239,98 @@ describe('UrlFunTest', function () {
expect
(
arr
[
4
]).
assertEqual
(
"
jss
"
)
})
/**
* @tc.name: testUrl[Symbol.iterator]()001
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.author: zhangyouyou
*/
it
(
'
testUrl[Symbol.iterator]001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
);
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
[
Symbol
.
iterator
]())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
1
]).
assertEqual
(
"
value1
"
);
})
/**
* @tc.name: testUrl[Symbol.iterator]()002
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.author: zhangyouyou
*/
it
(
'
testUrl[Symbol.iterator]()002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
[
Symbol
.
iterator
]())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
2
]).
assertEqual
(
"
key2
"
)
})
/**
* @tc.name: testUrl[Symbol.iterator]()003
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.author: zhangyouyou
*/
it
(
'
testUrl[Symbol.iterator]()003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
foo
"
,
"
jk
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
[
Symbol
.
iterator
]())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
5
]).
assertEqual
(
"
jk
"
)
})
/**
* @tc.name: testUrl[Symbol.iterator]()004
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.author: zhangyouyou
*/
it
(
'
testUrl[Symbol.iterator]()004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
[
Symbol
.
iterator
]())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
3
]).
assertEqual
(
"
value2
"
)
})
/**
* @tc.name: testUrl[Symbol.iterator]()005
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.author: zhangyouyou
*/
it
(
'
testUrl[Symbol.iterator]()005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
jss
"
,
"
txt
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
[
Symbol
.
iterator
]())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
4
]).
assertEqual
(
"
jss
"
)
})
/**
* @tc.name: testUrlForEach001
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
...
...
@@ -1632,6 +1724,68 @@ describe('UrlFunTest', function () {
expect
(
result
).
assertEqual
(
'
#qwer
'
)
})
/**
* @tc.name: testUrlSearchParams001
* @tc.desc: Gets the SearchParams portion of the URL
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearchParams001
'
,
0
,
function
()
{
var
that
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?foo=1&bar=2
'
);
var
params
=
that
.
searchParams
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo=1&bar=2
'
)
})
/**
* @tc.name: testUrlSearchParams002
* @tc.desc: Gets the SearchParams portion of the URL
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearchParams002
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
that
.
searchParams
params
.
append
(
"
ma 大
"
,
"
jk¥
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5
"
)
})
/**
* @tc.name: testUrlSearchParams003
* @tc.desc: Gets the SearchParams portion of the URL
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearchParams003
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?d=value1&c=value2&b=大&4=key4
'
)
let
params
=
that
.
searchParams
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
d=value1&c=value2&b=%E5%A4%A7&4=key4
"
)
})
/**
* @tc.name: testUrlSearchParams004
* @tc.desc: Gets the SearchParams portion of the URL
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearchParams004
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
that
.
searchParams
params
.
append
(
"
foo~!@#$%^&*()_+-=
"
,
"
jk
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk
"
)
})
/**
* @tc.name: testUrlSearchParams005
* @tc.desc: Gets the SearchParams portion of the URL
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearchParams005
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?你好=china#qwer=da
'
)
let
params
=
that
.
searchParams
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
%E4%BD%A0%E5%A5%BD=china
"
)
})
/**
* @tc.name: testUrlToJson001
* @tc.desc: Returns the serialized URL as a string.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录