Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
53707c83
Commit
53707c83
authored
Mar 27, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove pending tab when opening a file from the left sidebar
parent
a515b459
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
43 deletions
+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
No files found.
app/assets/javascripts/ide/lib/common/model.js
View file @
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
View file @
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
View file @
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
View file @
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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment