Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dece5329
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,发现更多精彩内容 >>
提交
dece5329
编写于
10月 01, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prefix unused with _
上级
90041e8b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
29 addition
and
29 deletion
+29
-29
extensions/emmet/src/test/abbreviationAction.test.ts
extensions/emmet/src/test/abbreviationAction.test.ts
+29
-29
未找到文件。
extensions/emmet/src/test/abbreviationAction.test.ts
浏览文件 @
dece5329
...
@@ -58,7 +58,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -58,7 +58,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
Expand snippets when no parent node (HTML)
'
,
()
=>
{
test
(
'
Expand snippets when no parent node (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
3
,
0
,
3
);
editor
.
selection
=
new
Selection
(
0
,
3
,
0
,
3
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src=
\
"
\
" alt=
\
"
\
">
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src=
\
"
\
" alt=
\
"
\
">
'
);
...
@@ -67,7 +67,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -67,7 +67,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
Expand snippets when no parent node in completion list (HTML)
'
,
()
=>
{
test
(
'
Expand snippets when no parent node in completion list (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
3
,
0
,
3
);
editor
.
selection
=
new
Selection
(
0
,
3
,
0
,
3
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -158,7 +158,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -158,7 +158,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside open tag (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside open tag (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
2
,
4
,
2
,
4
);
editor
.
selection
=
new
Selection
(
2
,
4
,
2
,
4
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
...
@@ -167,7 +167,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -167,7 +167,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside open tag in completion list (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside open tag in completion list (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
2
,
4
,
2
,
4
);
editor
.
selection
=
new
Selection
(
2
,
4
,
2
,
4
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -177,7 +177,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -177,7 +177,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside open tag when there is no closing tag (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside open tag when there is no closing tag (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
9
,
8
,
9
,
8
);
editor
.
selection
=
new
Selection
(
9
,
8
,
9
,
8
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
...
@@ -186,7 +186,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -186,7 +186,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside open tag when there is no closing tag in completion list (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside open tag when there is no closing tag in completion list (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
9
,
8
,
9
,
8
);
editor
.
selection
=
new
Selection
(
9
,
8
,
9
,
8
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -197,7 +197,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -197,7 +197,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
test
(
'
No expanding text inside open tag when there is no closing tag when there is no parent node (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside open tag when there is no closing tag when there is no parent node (HTML)
'
,
()
=>
{
const
fileContents
=
'
<img s
'
;
const
fileContents
=
'
<img s
'
;
return
withRandomFileEditor
(
fileContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
fileContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
fileContents
);
assert
.
equal
(
editor
.
document
.
getText
(),
fileContents
);
...
@@ -207,7 +207,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -207,7 +207,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
test
(
'
No expanding text in completion list inside open tag when there is no closing tag when there is no parent node (HTML)
'
,
()
=>
{
test
(
'
No expanding text in completion list inside open tag when there is no closing tag when there is no parent node (HTML)
'
,
()
=>
{
const
fileContents
=
'
<img s
'
;
const
fileContents
=
'
<img s
'
;
return
withRandomFileEditor
(
fileContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
fileContents
,
'
html
'
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -217,7 +217,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -217,7 +217,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
Expand css when inside style tag (HTML)
'
,
()
=>
{
test
(
'
Expand css when inside style tag (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
13
,
16
,
13
,
19
);
editor
.
selection
=
new
Selection
(
13
,
16
,
13
,
19
);
let
expandPromise
=
expandEmmetAbbreviation
({
language
:
'
css
'
});
let
expandPromise
=
expandEmmetAbbreviation
({
language
:
'
css
'
});
if
(
!
expandPromise
)
{
if
(
!
expandPromise
)
{
...
@@ -233,7 +233,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -233,7 +233,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
const
abbreviation
=
'
m10
'
;
const
abbreviation
=
'
m10
'
;
const
expandedText
=
'
margin: 10px;
'
;
const
expandedText
=
'
margin: 10px;
'
;
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
13
,
16
,
13
,
19
);
editor
.
selection
=
new
Selection
(
13
,
16
,
13
,
19
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -256,7 +256,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -256,7 +256,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside style tag if position is not for property name (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside style tag if position is not for property name (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
13
,
14
,
13
,
14
);
editor
.
selection
=
new
Selection
(
13
,
14
,
13
,
14
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
...
@@ -265,7 +265,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -265,7 +265,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text in completion list inside style tag if position is not for property name (HTML)
'
,
()
=>
{
test
(
'
No expanding text in completion list inside style tag if position is not for property name (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
13
,
14
,
13
,
14
);
editor
.
selection
=
new
Selection
(
13
,
14
,
13
,
14
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -276,7 +276,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -276,7 +276,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
test
(
'
Expand css when inside style attribute (HTML)
'
,
()
=>
{
test
(
'
Expand css when inside style attribute (HTML)
'
,
()
=>
{
const
styleAttributeContent
=
'
<div style="m10" class="hello"></div>
'
;
const
styleAttributeContent
=
'
<div style="m10" class="hello"></div>
'
;
return
withRandomFileEditor
(
styleAttributeContent
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
styleAttributeContent
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
15
,
0
,
15
);
editor
.
selection
=
new
Selection
(
0
,
15
,
0
,
15
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
if
(
!
expandPromise
)
{
if
(
!
expandPromise
)
{
...
@@ -292,7 +292,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -292,7 +292,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
const
abbreviation
=
'
m10
'
;
const
abbreviation
=
'
m10
'
;
const
expandedText
=
'
margin: 10px;
'
;
const
expandedText
=
'
margin: 10px;
'
;
return
withRandomFileEditor
(
'
<div style="m10" class="hello"></div>
'
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
<div style="m10" class="hello"></div>
'
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
15
,
0
,
15
);
editor
.
selection
=
new
Selection
(
0
,
15
,
0
,
15
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -315,7 +315,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -315,7 +315,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
Expand html when inside script tag with html type (HTML)
'
,
()
=>
{
test
(
'
Expand html when inside script tag with html type (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
21
,
12
,
21
,
12
);
editor
.
selection
=
new
Selection
(
21
,
12
,
21
,
12
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
if
(
!
expandPromise
)
{
if
(
!
expandPromise
)
{
...
@@ -331,7 +331,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -331,7 +331,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
const
abbreviation
=
'
span.hello
'
;
const
abbreviation
=
'
span.hello
'
;
const
expandedText
=
'
<span class="hello"></span>
'
;
const
expandedText
=
'
<span class="hello"></span>
'
;
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
21
,
12
,
21
,
12
);
editor
.
selection
=
new
Selection
(
21
,
12
,
21
,
12
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -353,7 +353,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -353,7 +353,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text inside script tag with javascript type (HTML)
'
,
()
=>
{
test
(
'
No expanding text inside script tag with javascript type (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
24
,
12
,
24
,
12
);
editor
.
selection
=
new
Selection
(
24
,
12
,
24
,
12
);
await
expandEmmetAbbreviation
(
null
);
await
expandEmmetAbbreviation
(
null
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
assert
.
equal
(
editor
.
document
.
getText
(),
htmlContents
);
...
@@ -362,7 +362,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -362,7 +362,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
});
});
test
(
'
No expanding text in completion list inside script tag with javascript type (HTML)
'
,
()
=>
{
test
(
'
No expanding text in completion list inside script tag with javascript type (HTML)
'
,
()
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
24
,
12
,
24
,
12
);
editor
.
selection
=
new
Selection
(
24
,
12
,
24
,
12
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -373,7 +373,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -373,7 +373,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
test
(
'
Expand html when inside script tag with javascript type if js is mapped to html (HTML)
'
,
async
()
=>
{
test
(
'
Expand html when inside script tag with javascript type if js is mapped to html (HTML)
'
,
async
()
=>
{
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
includeLanguages
'
,
{
"
javascript
"
:
"
html
"
},
ConfigurationTarget
.
Global
);
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
includeLanguages
'
,
{
"
javascript
"
:
"
html
"
},
ConfigurationTarget
.
Global
);
await
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
await
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
24
,
10
,
24
,
10
);
editor
.
selection
=
new
Selection
(
24
,
10
,
24
,
10
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
if
(
!
expandPromise
)
{
if
(
!
expandPromise
)
{
...
@@ -389,7 +389,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
...
@@ -389,7 +389,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
const
abbreviation
=
'
span.bye
'
;
const
abbreviation
=
'
span.bye
'
;
const
expandedText
=
'
<span class="bye"></span>
'
;
const
expandedText
=
'
<span class="bye"></span>
'
;
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
includeLanguages
'
,
{
"
javascript
"
:
"
html
"
},
ConfigurationTarget
.
Global
);
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
includeLanguages
'
,
{
"
javascript
"
:
"
html
"
},
ConfigurationTarget
.
Global
);
await
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
await
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
24
,
10
,
24
,
10
);
editor
.
selection
=
new
Selection
(
24
,
10
,
24
,
10
);
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -440,7 +440,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -440,7 +440,7 @@ suite('Tests for jsx, xml and xsl', () => {
teardown
(
closeAllEditors
);
teardown
(
closeAllEditors
);
test
(
'
Expand abbreviation with className instead of class in jsx
'
,
()
=>
{
test
(
'
Expand abbreviation with className instead of class in jsx
'
,
()
=>
{
return
withRandomFileEditor
(
'
ul.nav
'
,
'
javascriptreact
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
ul.nav
'
,
'
javascriptreact
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
<ul className="nav"></ul>
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<ul className="nav"></ul>
'
);
...
@@ -449,7 +449,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -449,7 +449,7 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test
(
'
Expand abbreviation with self closing tags for jsx
'
,
()
=>
{
test
(
'
Expand abbreviation with self closing tags for jsx
'
,
()
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
javascriptreact
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
javascriptreact
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt=""/>
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt=""/>
'
);
...
@@ -459,7 +459,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -459,7 +459,7 @@ suite('Tests for jsx, xml and xsl', () => {
test
(
'
Expand abbreviation with single quotes for jsx
'
,
async
()
=>
{
test
(
'
Expand abbreviation with single quotes for jsx
'
,
async
()
=>
{
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
syntaxProfiles
'
,
{
jsx
:
{
"
attr_quotes
"
:
"
single
"
}
},
ConfigurationTarget
.
Global
);
await
workspace
.
getConfiguration
(
'
emmet
'
).
update
(
'
syntaxProfiles
'
,
{
jsx
:
{
"
attr_quotes
"
:
"
single
"
}
},
ConfigurationTarget
.
Global
);
return
withRandomFileEditor
(
'
img
'
,
'
javascriptreact
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
javascriptreact
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src=
\'\'
alt=
\'\'
/>
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src=
\'\'
alt=
\'\'
/>
'
);
...
@@ -468,7 +468,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -468,7 +468,7 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test
(
'
Expand abbreviation with self closing tags for xml
'
,
()
=>
{
test
(
'
Expand abbreviation with self closing tags for xml
'
,
()
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
xml
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
xml
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
({
language
:
'
xml
'
});
await
expandEmmetAbbreviation
({
language
:
'
xml
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt=""/>
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt=""/>
'
);
...
@@ -477,7 +477,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -477,7 +477,7 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test
(
'
Expand abbreviation with no self closing tags for html
'
,
()
=>
{
test
(
'
Expand abbreviation with no self closing tags for html
'
,
()
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
img
'
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
editor
.
selection
=
new
Selection
(
0
,
6
,
0
,
6
);
await
expandEmmetAbbreviation
({
language
:
'
html
'
});
await
expandEmmetAbbreviation
({
language
:
'
html
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt="">
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
<img src="" alt="">
'
);
...
@@ -486,7 +486,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -486,7 +486,7 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test
(
'
Expand abbreviation with condition containing less than sign for jsx
'
,
()
=>
{
test
(
'
Expand abbreviation with condition containing less than sign for jsx
'
,
()
=>
{
return
withRandomFileEditor
(
'
if (foo < 10) { span.bar
'
,
'
javascriptreact
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
'
if (foo < 10) { span.bar
'
,
'
javascriptreact
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
new
Selection
(
0
,
27
,
0
,
27
);
editor
.
selection
=
new
Selection
(
0
,
27
,
0
,
27
);
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
await
expandEmmetAbbreviation
({
language
:
'
javascriptreact
'
});
assert
.
equal
(
editor
.
document
.
getText
(),
'
if (foo < 10) { <span className="bar"></span>
'
);
assert
.
equal
(
editor
.
document
.
getText
(),
'
if (foo < 10) { <span className="bar"></span>
'
);
...
@@ -513,7 +513,7 @@ suite('Tests for jsx, xml and xsl', () => {
...
@@ -513,7 +513,7 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
function
testExpandAbbreviation
(
syntax
:
string
,
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
function
testExpandAbbreviation
(
syntax
:
string
,
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
return
withRandomFileEditor
(
htmlContents
,
syntax
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
syntax
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
selection
;
editor
.
selection
=
selection
;
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
let
expandPromise
=
expandEmmetAbbreviation
(
null
);
if
(
!
expandPromise
)
{
if
(
!
expandPromise
)
{
...
@@ -529,7 +529,7 @@ function testExpandAbbreviation(syntax: string, selection: Selection, abbreviati
...
@@ -529,7 +529,7 @@ function testExpandAbbreviation(syntax: string, selection: Selection, abbreviati
}
}
function
testHtmlCompletionProvider
(
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
function
testHtmlCompletionProvider
(
selection
:
Selection
,
abbreviation
:
string
,
expandedText
:
string
,
shouldFail
?:
boolean
):
Thenable
<
any
>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
htmlContents
,
'
html
'
,
async
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
selection
;
editor
.
selection
=
selection
;
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
@@ -555,7 +555,7 @@ function testHtmlCompletionProvider(selection: Selection, abbreviation: string,
...
@@ -555,7 +555,7 @@ function testHtmlCompletionProvider(selection: Selection, abbreviation: string,
}
}
function
testNoCompletion
(
syntax
:
string
,
fileContents
:
string
,
selection
:
Selection
):
Thenable
<
any
>
{
function
testNoCompletion
(
syntax
:
string
,
fileContents
:
string
,
selection
:
Selection
):
Thenable
<
any
>
{
return
withRandomFileEditor
(
fileContents
,
syntax
,
(
editor
,
doc
)
=>
{
return
withRandomFileEditor
(
fileContents
,
syntax
,
(
editor
,
_
doc
)
=>
{
editor
.
selection
=
selection
;
editor
.
selection
=
selection
;
const
cancelSrc
=
new
CancellationTokenSource
();
const
cancelSrc
=
new
CancellationTokenSource
();
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
const
completionPromise
=
completionProvider
.
provideCompletionItems
(
editor
.
document
,
editor
.
selection
.
active
,
cancelSrc
.
token
,
{
triggerKind
:
CompletionTriggerKind
.
Invoke
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录