Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
53707c83
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
53707c83
编写于
3月 27, 2018
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove pending tab when opening a file from the left sidebar
上级
a515b459
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
43 deletion
+17
-43
app/assets/javascripts/ide/lib/common/model.js
app/assets/javascripts/ide/lib/common/model.js
+2
-8
app/assets/javascripts/ide/lib/common/model_manager.js
app/assets/javascripts/ide/lib/common/model_manager.js
+1
-4
app/assets/javascripts/ide/stores/mutations/file.js
app/assets/javascripts/ide/stores/mutations/file.js
+3
-1
spec/javascripts/ide/lib/decorations/controller_spec.js
spec/javascripts/ide/lib/decorations/controller_spec.js
+11
-30
未找到文件。
app/assets/javascripts/ide/lib/common/model.js
浏览文件 @
53707c83
...
...
@@ -28,10 +28,7 @@ export default class Model {
this
.
dispose
=
this
.
dispose
.
bind
(
this
);
eventHub
.
$on
(
`editor.update.model.dispose.
${
this
.
file
.
key
}
`
,
this
.
dispose
);
eventHub
.
$on
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
,
);
eventHub
.
$on
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
);
}
get
url
()
{
...
...
@@ -79,9 +76,6 @@ export default class Model {
this
.
events
.
clear
();
eventHub
.
$off
(
`editor.update.model.dispose.
${
this
.
file
.
key
}
`
,
this
.
dispose
);
eventHub
.
$off
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
,
);
eventHub
.
$off
(
`editor.update.model.content.
${
this
.
file
.
path
}
`
,
this
.
updateContent
);
}
}
app/assets/javascripts/ide/lib/common/model_manager.js
浏览文件 @
53707c83
...
...
@@ -37,10 +37,7 @@ export default class ModelManager {
removeCachedModel
(
file
)
{
this
.
models
.
delete
(
file
.
key
);
eventHub
.
$off
(
`editor.update.model.dispose.
${
file
.
key
}
`
,
this
.
removeCachedModel
,
);
eventHub
.
$off
(
`editor.update.model.dispose.
${
file
.
key
}
`
,
this
.
removeCachedModel
);
}
dispose
()
{
...
...
app/assets/javascripts/ide/stores/mutations/file.js
浏览文件 @
53707c83
...
...
@@ -24,7 +24,9 @@ export default {
});
if
(
state
.
entries
[
path
].
opened
)
{
state
.
openFiles
.
push
(
state
.
entries
[
path
]);
Object
.
assign
(
state
,
{
openFiles
:
state
.
openFiles
.
filter
(
f
=>
f
.
path
!==
path
).
concat
(
state
.
entries
[
path
]),
});
}
else
{
const
file
=
state
.
entries
[
path
];
...
...
spec/javascripts/ide/lib/decorations/controller_spec.js
浏览文件 @
53707c83
...
...
@@ -36,9 +36,7 @@ describe('Multi-file editor library decorations controller', () => {
});
it
(
'
returns decorations by model URL
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
const
decorations
=
controller
.
getAllDecorationsForModel
(
model
);
...
...
@@ -48,39 +46,29 @@ describe('Multi-file editor library decorations controller', () => {
describe
(
'
addDecorations
'
,
()
=>
{
it
(
'
caches decorations in a new map
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
});
it
(
'
does not create new cache model
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue2
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue2
'
}]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
});
it
(
'
caches decorations by model URL
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
expect
(
controller
.
decorations
.
keys
().
next
().
value
).
toBe
(
'
path
'
);
expect
(
controller
.
decorations
.
keys
().
next
().
value
).
toBe
(
'
path
--path
'
);
});
it
(
'
calls decorate method
'
,
()
=>
{
spyOn
(
controller
,
'
decorate
'
);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
expect
(
controller
.
decorate
).
toHaveBeenCalled
();
});
...
...
@@ -92,10 +80,7 @@ describe('Multi-file editor library decorations controller', () => {
controller
.
decorate
(
model
);
expect
(
controller
.
editor
.
instance
.
deltaDecorations
).
toHaveBeenCalledWith
(
[],
[],
);
expect
(
controller
.
editor
.
instance
.
deltaDecorations
).
toHaveBeenCalledWith
([],
[]);
});
it
(
'
caches decorations
'
,
()
=>
{
...
...
@@ -111,15 +96,13 @@ describe('Multi-file editor library decorations controller', () => {
controller
.
decorate
(
model
);
expect
(
controller
.
editorDecorations
.
keys
().
next
().
value
).
toBe
(
'
path
'
);
expect
(
controller
.
editorDecorations
.
keys
().
next
().
value
).
toBe
(
'
path
--path
'
);
});
});
describe
(
'
dispose
'
,
()
=>
{
it
(
'
clears cached decorations
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
dispose
();
...
...
@@ -127,9 +110,7 @@ describe('Multi-file editor library decorations controller', () => {
});
it
(
'
clears cached editorDecorations
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录