Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4dcce12b
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4dcce12b
编写于
3月 03, 2016
作者:
G
Guillaume Jenkins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding unit tests for Ionic HTML Intellisense
上级
ef63356c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
9 deletion
+71
-9
src/vs/languages/html/common/htmlTags.ts
src/vs/languages/html/common/htmlTags.ts
+10
-9
src/vs/languages/html/test/common/html-worker.test.ts
src/vs/languages/html/test/common/html-worker.test.ts
+61
-0
未找到文件。
src/vs/languages/html/common/htmlTags.ts
浏览文件 @
4dcce12b
...
...
@@ -16,16 +16,16 @@ export interface IHTMLTagProvider {
collectValues
(
tag
:
string
,
attribute
:
string
,
collector
:
(
value
:
string
)
=>
void
):
void
;
}
export
class
HTMLTagSpecification
{
constructor
(
public
label
:
string
,
public
attributes
:
string
[]
=
[])
{
}
export
interface
ITagSet
{
[
tag
:
string
]:
HTMLTagSpecification
;
}
interface
ITagSet
{
[
tag
:
string
]:
HTMLTagSpecification
export
class
HTMLTagSpecification
{
constructor
(
public
label
:
string
,
public
attributes
:
string
[]
=
[])
{
}
}
interface
IValueSets
{
[
tag
:
string
]:
string
[]
[
tag
:
string
]:
string
[]
;
}
// HTML tag information sourced from http://www.w3.org/TR/2015/WD-html51-20151008/
...
...
@@ -320,7 +320,7 @@ export const HTML_TAGS: ITagSet = {
export
const
IONIC_TAGS
:
ITagSet
=
{
'
ion-checkbox
'
:
new
HTMLTagSpecification
(
''
,
[
'
name
'
,
'
ng-
change
'
,
'
ng-
false-value
'
,
'
ng-model
'
,
'
ng-true-value
'
]),
[
'
name
'
,
'
ng-false-value
'
,
'
ng-model
'
,
'
ng-true-value
'
]),
'
ion-content
'
:
new
HTMLTagSpecification
(
''
,
[
'
delegate-handle
'
,
'
direction:scrolldir
'
,
'
has-bouncing:b
'
,
'
locking:b
'
,
'
on-scroll
'
,
'
on-scroll-complete
'
,
'
overflow-scroll:b
'
,
'
padding:b
'
,
'
scroll:b
'
,
'
scrollbar-x:b
'
,
'
scrollbar-y:b
'
,
'
start-x
'
,
'
start-y
'
]),
'
ion-delete-button
'
:
new
HTMLTagSpecification
(
''
,
...
...
@@ -356,7 +356,7 @@ export const IONIC_TAGS: ITagSet = {
'
ion-popover-view
'
:
new
HTMLTagSpecification
(
''
,
[]),
'
ion-radio
'
:
new
HTMLTagSpecification
(
''
,
[
'
disabled:b
'
,
'
icon
'
,
'
name
'
,
'
ng-
change
'
,
'
ng-
disabled:b
'
,
'
ng-model
'
,
'
ng-value
'
,
'
value
'
]),
[
'
disabled:b
'
,
'
icon
'
,
'
name
'
,
'
ng-disabled:b
'
,
'
ng-model
'
,
'
ng-value
'
,
'
value
'
]),
'
ion-refresher
'
:
new
HTMLTagSpecification
(
''
,
[
'
disable-pulling-rotation:b
'
,
'
on-pulling
'
,
'
on-refresh
'
,
'
pulling-icon
'
,
'
pulling-text
'
,
'
refreshing-icon
'
,
'
spinner
'
]),
'
ion-reorder-button
'
:
new
HTMLTagSpecification
(
''
,
...
...
@@ -382,7 +382,7 @@ export const IONIC_TAGS: ITagSet = {
'
ion-title
'
:
new
HTMLTagSpecification
(
''
,
[]),
'
ion-toggle
'
:
new
HTMLTagSpecification
(
''
,
[
'
name
'
,
'
ng-
change
'
,
'
ng-
false-value
'
,
'
ng-model
'
,
'
ng-true-value
'
,
'
toggle-class
'
]),
[
'
name
'
,
'
ng-false-value
'
,
'
ng-model
'
,
'
ng-true-value
'
,
'
toggle-class
'
]),
'
ion-view
'
:
new
HTMLTagSpecification
(
''
,
[
'
cache-view:b
'
,
'
can-swipe-back:b
'
,
'
hide-back-button:b
'
,
'
hide-nav-bar:b
'
,
'
view-title
'
])
};
...
...
@@ -521,7 +521,8 @@ export function getIonicTagProvider(): IHTMLTagProvider {
var
attributes
=
customTags
[
tag
];
if
(
attributes
)
{
attributes
.
forEach
((
a
)
=>
{
collector
(
a
,
null
);
var
segments
=
a
.
split
(
'
:
'
);
collector
(
segments
[
0
],
segments
[
1
]);
});
}
}
...
...
src/vs/languages/html/test/common/html-worker.test.ts
浏览文件 @
4dcce12b
...
...
@@ -322,6 +322,67 @@ suite('HTML - worker', () => {
});
});
test
(
'
Intellisense Ionic
'
,
function
(
testDone
):
any
{
WinJS
.
Promise
.
join
([
// Try some Ionic tags
testSuggestionsFor
(
'
<|
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
ion-checkbox
'
);
assertSuggestion
(
completion
,
'
ion-content
'
);
assertSuggestion
(
completion
,
'
ion-nav-title
'
);
}),
testSuggestionsFor
(
'
<ion-re|
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
'
ion-re
'
);
assertSuggestion
(
completion
,
'
ion-refresher
'
);
assertSuggestion
(
completion
,
'
ion-reorder-button
'
);
}),
// Try some global attributes (1 with value suggestions, 1 without value suggestions, 1 void)
testSuggestionsFor
(
'
<ion-checkbox |
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
force-refresh-images
'
);
assertSuggestion
(
completion
,
'
collection-repeat
'
);
assertSuggestion
(
completion
,
'
menu-close
'
);
}),
// Try some tag-specific attributes (1 with value suggestions, 1 void)
testSuggestionsFor
(
'
<ion-footer-bar |
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
align-title
'
);
assertSuggestion
(
completion
,
'
keyboard-attach
'
);
}),
// Try the extended attributes of an existing HTML 5 tag
testSuggestionsFor
(
'
<a |
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
nav-direction
'
);
assertSuggestion
(
completion
,
'
nav-transition
'
);
assertSuggestion
(
completion
,
'
href
'
);
assertSuggestion
(
completion
,
'
hreflang
'
);
}),
// Try value suggestion for a tag-specific attribute
testSuggestionsFor
(
'
<ion-side-menu side="|
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
left
'
);
assertSuggestion
(
completion
,
'
primary
'
);
assertSuggestion
(
completion
,
'
right
'
);
assertSuggestion
(
completion
,
'
secondary
'
);
}),
// Try a value suggestion for a global attribute
testSuggestionsFor
(
'
<img force-refresh-images="|
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
false
'
);
assertSuggestion
(
completion
,
'
true
'
);
}),
// Try a value suggestion for an extended attribute of an existing HTML 5 tag
testSuggestionsFor
(
'
<a nav-transition="|
'
).
then
((
completion
)
=>
{
assert
.
equal
(
completion
.
currentWord
,
''
);
assertSuggestion
(
completion
,
'
android
'
);
assertSuggestion
(
completion
,
'
ios
'
);
assertSuggestion
(
completion
,
'
none
'
);
})
]).
done
(()
=>
testDone
(),
(
errors
:
any
[])
=>
{
testDone
(
errors
.
reduce
((
e1
,
e2
)
=>
e1
||
e2
));
});
});
function
testLinkCreation
(
modelUrl
:
string
,
rootUrl
:
string
,
tokenContent
:
string
,
expected
:
string
):
void
{
var
_modelUrl
=
URI
.
parse
(
modelUrl
);
var
_rootUrl
=
rootUrl
===
null
?
null
:
URI
.
parse
(
rootUrl
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录