Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8052aa1d
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,发现更多精彩内容 >>
提交
8052aa1d
编写于
3月 11, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Supress strict null errors in textFile Tests
上级
45d6f422
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
27 deletion
+27
-27
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
...kbench/services/textfile/test/textFileEditorModel.test.ts
+13
-13
src/vs/workbench/services/textfile/test/textFileService.test.ts
.../workbench/services/textfile/test/textFileService.test.ts
+14
-14
未找到文件。
src/vs/workbench/services/textfile/test/textFileEditorModel.test.ts
浏览文件 @
8052aa1d
...
...
@@ -48,7 +48,7 @@ suite('Files - TextFileEditorModel', () => {
const
model
:
TextFileEditorModel
=
instantiationService
.
createInstance
(
TextFileEditorModel
,
toResource
.
call
(
this
,
'
/path/index_async.txt
'
),
'
utf8
'
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
bar
'
);
model
.
textEditorModel
!
.
setValue
(
'
bar
'
);
assert
.
ok
(
getLastModifiedTime
(
model
)
<=
Date
.
now
());
return
model
.
save
().
then
(()
=>
{
...
...
@@ -90,7 +90,7 @@ suite('Files - TextFileEditorModel', () => {
const
model
:
TextFileEditorModel
=
instantiationService
.
createInstance
(
TextFileEditorModel
,
toResource
.
call
(
this
,
'
/path/index_async.txt
'
),
'
utf8
'
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
dispose
();
model
.
textEditorModel
!
.
dispose
();
assert
.
ok
(
model
.
isDisposed
());
});
...
...
@@ -117,7 +117,7 @@ suite('Files - TextFileEditorModel', () => {
const
model
=
instantiationService
.
createInstance
(
TextFileEditorModel
,
toResource
.
call
(
this
,
'
/path/index_async.txt
'
),
'
utf8
'
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
model
.
isDirty
());
assert
.
ok
(
model
.
hasState
(
ModelState
.
DIRTY
));
...
...
@@ -141,13 +141,13 @@ suite('Files - TextFileEditorModel', () => {
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
model
.
isDirty
());
return
model
.
revert
().
then
(()
=>
{
assert
.
ok
(
!
model
.
isDirty
());
assert
.
equal
(
model
.
textEditorModel
.
getValue
(),
'
Hello Html
'
);
assert
.
equal
(
model
.
textEditorModel
!
.
getValue
(),
'
Hello Html
'
);
assert
.
equal
(
eventCounter
,
1
);
model
.
dispose
();
...
...
@@ -167,13 +167,13 @@ suite('Files - TextFileEditorModel', () => {
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
model
.
isDirty
());
return
model
.
revert
(
true
/* soft revert */
).
then
(()
=>
{
assert
.
ok
(
!
model
.
isDirty
());
assert
.
equal
(
model
.
textEditorModel
.
getValue
(),
'
foo
'
);
assert
.
equal
(
model
.
textEditorModel
!
.
getValue
(),
'
foo
'
);
assert
.
equal
(
eventCounter
,
1
);
model
.
dispose
();
...
...
@@ -186,7 +186,7 @@ suite('Files - TextFileEditorModel', () => {
return
model
.
load
().
then
(()
=>
{
accessor
.
fileService
.
setContent
(
'
Hello Change
'
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
undo
();
model
.
textEditorModel
!
.
undo
();
assert
.
ok
(
model
.
isDirty
());
});
...
...
@@ -227,7 +227,7 @@ suite('Files - TextFileEditorModel', () => {
return
input1
.
resolve
().
then
((
model1
:
TextFileEditorModel
)
=>
{
return
input2
.
resolve
().
then
((
model2
:
TextFileEditorModel
)
=>
{
model1
.
textEditorModel
.
setValue
(
'
foo
'
);
model1
.
textEditorModel
!
.
setValue
(
'
foo
'
);
const
m1Mtime
=
model1
.
getStat
().
mtime
;
const
m2Mtime
=
model2
.
getStat
().
mtime
;
...
...
@@ -238,7 +238,7 @@ suite('Files - TextFileEditorModel', () => {
assert
.
ok
(
accessor
.
textFileService
.
isDirty
(
toResource
.
call
(
this
,
'
/path/index_async2.txt
'
)));
assert
.
ok
(
!
accessor
.
textFileService
.
isDirty
(
toResource
.
call
(
this
,
'
/path/index_async.txt
'
)));
model2
.
textEditorModel
.
setValue
(
'
foo
'
);
model2
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
accessor
.
textFileService
.
isDirty
(
toResource
.
call
(
this
,
'
/path/index_async.txt
'
)));
return
timeout
(
10
).
then
(()
=>
{
...
...
@@ -281,7 +281,7 @@ suite('Files - TextFileEditorModel', () => {
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
return
model
.
save
().
then
(()
=>
{
model
.
dispose
();
...
...
@@ -302,7 +302,7 @@ suite('Files - TextFileEditorModel', () => {
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
const
now
=
Date
.
now
();
return
model
.
save
().
then
(()
=>
{
...
...
@@ -322,7 +322,7 @@ suite('Files - TextFileEditorModel', () => {
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
return
model
.
save
().
then
(()
=>
{
model
.
dispose
();
});
...
...
src/vs/workbench/services/textfile/test/textFileService.test.ts
浏览文件 @
8052aa1d
...
...
@@ -91,7 +91,7 @@ suite('Files - TextFileService', () => {
service
.
setConfirmResult
(
ConfirmResult
.
CANCEL
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
...
...
@@ -111,7 +111,7 @@ suite('Files - TextFileService', () => {
service
.
onFilesConfigurationChange
({
files
:
{
hotExit
:
'
off
'
}
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
...
...
@@ -142,7 +142,7 @@ suite('Files - TextFileService', () => {
service
.
onFilesConfigurationChange
({
files
:
{
hotExit
:
'
off
'
}
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
...
...
@@ -163,7 +163,7 @@ suite('Files - TextFileService', () => {
const
service
=
accessor
.
textFileService
;
return
model
.
load
().
then
(()
=>
{
assert
.
ok
(
!
service
.
isDirty
(
model
.
getResource
()));
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
...
...
@@ -173,7 +173,7 @@ suite('Files - TextFileService', () => {
return
untitled
.
resolve
().
then
((
model
:
UntitledEditorModel
)
=>
{
assert
.
ok
(
!
service
.
isDirty
(
untitled
.
getResource
()));
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
model
.
textEditorModel
.
setValue
(
'
changed
'
);
model
.
textEditorModel
!
.
setValue
(
'
changed
'
);
assert
.
ok
(
service
.
isDirty
(
untitled
.
getResource
()));
assert
.
equal
(
service
.
getDirty
().
length
,
2
);
...
...
@@ -189,7 +189,7 @@ suite('Files - TextFileService', () => {
const
service
=
accessor
.
textFileService
;
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
...
...
@@ -214,7 +214,7 @@ suite('Files - TextFileService', () => {
sinon
.
stub
(
accessor
.
modelService
,
'
updateModel
'
,
()
=>
{
});
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
return
accessor
.
textFileService
.
saveAll
(
true
).
then
(
res
=>
{
assert
.
ok
(
loadOrCreateStub
.
calledOnce
);
...
...
@@ -235,7 +235,7 @@ suite('Files - TextFileService', () => {
const
service
=
accessor
.
textFileService
;
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
...
...
@@ -256,12 +256,12 @@ suite('Files - TextFileService', () => {
service
.
setPromptPath
(
model
.
getResource
());
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
return
service
.
saveAs
(
model
.
getResource
()).
then
(
res
=>
{
assert
.
equal
(
res
.
toString
(),
model
.
getResource
().
toString
());
assert
.
equal
(
res
!
.
toString
(),
model
.
getResource
().
toString
());
assert
.
ok
(
!
service
.
isDirty
(
model
.
getResource
()));
});
});
...
...
@@ -275,7 +275,7 @@ suite('Files - TextFileService', () => {
service
.
setPromptPath
(
model
.
getResource
());
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
!
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
...
...
@@ -293,7 +293,7 @@ suite('Files - TextFileService', () => {
const
service
=
accessor
.
textFileService
;
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
!
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
model
.
getResource
()));
...
...
@@ -312,7 +312,7 @@ suite('Files - TextFileService', () => {
const
service
=
accessor
.
textFileService
;
return
sourceModel
.
load
().
then
(()
=>
{
sourceModel
.
textEditorModel
.
setValue
(
'
foo
'
);
sourceModel
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
ok
(
service
.
isDirty
(
sourceModel
.
getResource
()));
...
...
@@ -447,7 +447,7 @@ suite('Files - TextFileService', () => {
service
.
setConfirmResult
(
ConfirmResult
.
CANCEL
);
return
model
.
load
().
then
(()
=>
{
model
.
textEditorModel
.
setValue
(
'
foo
'
);
model
.
textEditorModel
!
.
setValue
(
'
foo
'
);
assert
.
equal
(
service
.
getDirty
().
length
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录