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
bead083c
Commit
bead083c
authored
Mar 23, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated specs
parent
bfdeee1d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
40 additions
and
30 deletions
+40
-30
app/assets/javascripts/ide/components/repo_tabs.vue
app/assets/javascripts/ide/components/repo_tabs.vue
+1
-1
app/assets/javascripts/ide/lib/common/model.js
app/assets/javascripts/ide/lib/common/model.js
+1
-1
app/assets/javascripts/ide/lib/diff/controller.js
app/assets/javascripts/ide/lib/diff/controller.js
+2
-2
app/assets/javascripts/ide/lib/diff/diff_worker.js
app/assets/javascripts/ide/lib/diff/diff_worker.js
+1
-1
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+1
-1
spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
...vascripts/ide/components/commit_sidebar/list_item_spec.js
+13
-8
spec/javascripts/ide/components/repo_tab_spec.js
spec/javascripts/ide/components/repo_tab_spec.js
+1
-1
spec/javascripts/ide/components/repo_tabs_spec.js
spec/javascripts/ide/components/repo_tabs_spec.js
+2
-0
spec/javascripts/ide/lib/common/model_manager_spec.js
spec/javascripts/ide/lib/common/model_manager_spec.js
+9
-6
spec/javascripts/ide/lib/common/model_spec.js
spec/javascripts/ide/lib/common/model_spec.js
+4
-4
spec/javascripts/ide/lib/diff/controller_spec.js
spec/javascripts/ide/lib/diff/controller_spec.js
+2
-2
spec/javascripts/ide/stores/actions/file_spec.js
spec/javascripts/ide/stores/actions/file_spec.js
+3
-3
No files found.
app/assets/javascripts/ide/components/repo_tabs.vue
View file @
bead083c
...
...
@@ -44,7 +44,7 @@ export default {
this
.
updateViewer
(
viewer
);
if
(
this
.
activeFile
.
pending
)
{
this
.
removePendingTab
(
this
.
activeFile
).
then
(()
=>
{
return
this
.
removePendingTab
(
this
.
activeFile
).
then
(()
=>
{
router
.
push
(
`/project
${
this
.
activeFile
.
url
}
`
);
});
}
...
...
app/assets/javascripts/ide/lib/common/model.js
View file @
bead083c
...
...
@@ -64,7 +64,7 @@ export default class Model {
onChange
(
cb
)
{
this
.
events
.
set
(
this
.
key
,
this
.
path
,
this
.
disposable
.
add
(
this
.
model
.
onDidChangeContent
(
e
=>
cb
(
this
,
e
))),
);
}
...
...
app/assets/javascripts/ide/lib/diff/controller.js
View file @
bead083c
...
...
@@ -44,7 +44,7 @@ export default class DirtyDiffController {
computeDiff
(
model
)
{
this
.
dirtyDiffWorker
.
postMessage
({
key
:
model
.
path
,
path
:
model
.
path
,
originalContent
:
model
.
getOriginalModel
().
getValue
(),
newContent
:
model
.
getModel
().
getValue
(),
});
...
...
@@ -56,7 +56,7 @@ export default class DirtyDiffController {
decorate
({
data
})
{
const
decorations
=
data
.
changes
.
map
(
change
=>
getDecorator
(
change
));
const
model
=
this
.
modelManager
.
getModel
(
data
.
key
);
const
model
=
this
.
modelManager
.
getModel
(
data
.
path
);
this
.
decorationsController
.
addDecorations
(
model
,
'
dirtyDiff
'
,
decorations
);
}
...
...
app/assets/javascripts/ide/lib/diff/diff_worker.js
View file @
bead083c
...
...
@@ -4,7 +4,7 @@ self.addEventListener('message', e => {
const
data
=
e
.
data
;
self
.
postMessage
({
key
:
data
.
key
,
path
:
data
.
path
,
changes
:
computeDiff
(
data
.
originalContent
,
data
.
newContent
),
});
});
app/assets/javascripts/ide/stores/actions.js
View file @
bead083c
...
...
@@ -21,7 +21,7 @@ export const discardAllChanges = ({ state, commit, dispatch }) => {
};
export
const
closeAllFiles
=
({
state
,
dispatch
})
=>
{
state
.
openFiles
.
forEach
(
file
=>
dispatch
(
'
closeFile
'
,
file
.
path
));
state
.
openFiles
.
forEach
(
file
=>
dispatch
(
'
closeFile
'
,
file
));
};
export
const
setPanelCollapsedStatus
=
({
commit
},
{
side
,
collapsed
})
=>
{
...
...
spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
View file @
bead083c
import
Vue
from
'
vue
'
;
import
listItem
from
'
~/ide/components/commit_sidebar/list_item.vue
'
;
import
router
from
'
~/ide/ide_router
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
store
from
'
~/ide/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file editor commit sidebar list item
'
,
()
=>
{
...
...
@@ -13,9 +14,9 @@ describe('Multi-file editor commit sidebar list item', () => {
f
=
file
(
'
test-file
'
);
vm
=
mountComponent
(
Component
,
{
vm
=
createComponentWithStore
(
Component
,
store
,
{
file
:
f
,
});
})
.
$mount
()
;
});
afterEach
(()
=>
{
...
...
@@ -36,20 +37,24 @@ describe('Multi-file editor commit sidebar list item', () => {
expect
(
vm
.
discardFileChanges
).
toHaveBeenCalled
();
});
it
(
'
opens a closed file in the editor when clicking the file path
'
,
()
=>
{
it
(
'
opens a closed file in the editor when clicking the file path
'
,
done
=>
{
spyOn
(
vm
,
'
openFileInEditor
'
).
and
.
callThrough
();
spyOn
(
vm
,
'
updateViewer
'
);
spyOn
(
vm
,
'
updateViewer
'
)
.
and
.
callThrough
()
;
spyOn
(
router
,
'
push
'
);
vm
.
$el
.
querySelector
(
'
.multi-file-commit-list-path
'
).
click
();
expect
(
vm
.
openFileInEditor
).
toHaveBeenCalled
();
expect
(
router
.
push
).
toHaveBeenCalled
();
setTimeout
(()
=>
{
expect
(
vm
.
openFileInEditor
).
toHaveBeenCalled
();
expect
(
router
.
push
).
toHaveBeenCalled
();
done
();
});
});
it
(
'
calls updateViewer with diff when clicking file
'
,
()
=>
{
spyOn
(
vm
,
'
openFileInEditor
'
).
and
.
callThrough
();
spyOn
(
vm
,
'
updateViewer
'
);
spyOn
(
vm
,
'
updateViewer
'
)
.
and
.
callThrough
()
;
spyOn
(
router
,
'
push
'
);
vm
.
$el
.
querySelector
(
'
.multi-file-commit-list-path
'
).
click
();
...
...
spec/javascripts/ide/components/repo_tab_spec.js
View file @
bead083c
...
...
@@ -59,7 +59,7 @@ describe('RepoTab', () => {
vm
.
$el
.
querySelector
(
'
.multi-file-tab-close
'
).
click
();
expect
(
vm
.
closeFile
).
toHaveBeenCalledWith
(
vm
.
tab
.
path
);
expect
(
vm
.
closeFile
).
toHaveBeenCalledWith
(
vm
.
tab
);
});
it
(
'
changes icon on hover
'
,
done
=>
{
...
...
spec/javascripts/ide/components/repo_tabs_spec.js
View file @
bead083c
...
...
@@ -17,6 +17,7 @@ describe('RepoTabs', () => {
files
:
openedFiles
,
viewer
:
'
editor
'
,
hasChanges
:
false
,
activeFile
:
file
(
'
activeFile
'
),
});
openedFiles
[
0
].
active
=
true
;
...
...
@@ -56,6 +57,7 @@ describe('RepoTabs', () => {
files
:
[],
viewer
:
'
editor
'
,
hasChanges
:
false
,
activeFile
:
file
(
'
activeFile
'
),
},
'
#test-app
'
,
);
...
...
spec/javascripts/ide/lib/common/model_manager_spec.js
View file @
bead083c
...
...
@@ -27,9 +27,10 @@ describe('Multi-file editor library model manager', () => {
});
it
(
'
caches model by file path
'
,
()
=>
{
instance
.
addModel
(
file
(
'
path-name
'
));
const
f
=
file
(
'
path-name
'
);
instance
.
addModel
(
f
);
expect
(
instance
.
models
.
keys
().
next
().
value
).
toBe
(
'
path-name
'
);
expect
(
instance
.
models
.
keys
().
next
().
value
).
toBe
(
f
.
key
);
});
it
(
'
adds model into disposable
'
,
()
=>
{
...
...
@@ -56,7 +57,7 @@ describe('Multi-file editor library model manager', () => {
instance
.
addModel
(
f
);
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
`editor.update.model.dispose.
${
f
.
key
}
`
,
jasmine
.
anything
(),
);
});
...
...
@@ -68,9 +69,11 @@ describe('Multi-file editor library model manager', () => {
});
it
(
'
returns true when model exists
'
,
()
=>
{
instance
.
addModel
(
file
(
'
path-name
'
));
const
f
=
file
(
'
path-name
'
);
instance
.
addModel
(
f
);
expect
(
instance
.
hasCachedModel
(
'
path-name
'
)).
toBeTruthy
();
expect
(
instance
.
hasCachedModel
(
f
.
key
)).
toBeTruthy
();
});
});
...
...
@@ -103,7 +106,7 @@ describe('Multi-file editor library model manager', () => {
instance
.
removeCachedModel
(
f
);
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
`editor.update.model.dispose.
${
f
.
key
}
`
,
jasmine
.
anything
(),
);
});
...
...
spec/javascripts/ide/lib/common/model_spec.js
View file @
bead083c
...
...
@@ -28,14 +28,14 @@ describe('Multi-file editor library model', () => {
it
(
'
adds eventHub listener
'
,
()
=>
{
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
`editor.update.model.dispose.
${
model
.
file
.
key
}
`
,
jasmine
.
anything
(),
);
});
describe
(
'
path
'
,
()
=>
{
it
(
'
returns file path
'
,
()
=>
{
expect
(
model
.
path
).
toBe
(
'
path
'
);
expect
(
model
.
path
).
toBe
(
model
.
file
.
key
);
});
});
...
...
@@ -64,7 +64,7 @@ describe('Multi-file editor library model', () => {
model
.
onChange
(()
=>
{});
expect
(
model
.
events
.
size
).
toBe
(
1
);
expect
(
model
.
events
.
keys
().
next
().
value
).
toBe
(
'
path
'
);
expect
(
model
.
events
.
keys
().
next
().
value
).
toBe
(
model
.
file
.
key
);
});
it
(
'
calls callback on change
'
,
done
=>
{
...
...
@@ -105,7 +105,7 @@ describe('Multi-file editor library model', () => {
model
.
dispose
();
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
`editor.update.model.dispose.
${
model
.
file
.
key
}
`
,
jasmine
.
anything
(),
);
});
...
...
spec/javascripts/ide/lib/diff/controller_spec.js
View file @
bead083c
...
...
@@ -131,7 +131,7 @@ describe('Multi-file editor library dirty diff controller', () => {
it
(
'
adds decorations into decorations controller
'
,
()
=>
{
spyOn
(
controller
.
decorationsController
,
'
addDecorations
'
);
controller
.
decorate
({
data
:
{
changes
:
[],
path
:
'
path
'
}
});
controller
.
decorate
({
data
:
{
changes
:
[],
path
:
model
.
path
}
});
expect
(
controller
.
decorationsController
.
addDecorations
,
...
...
@@ -145,7 +145,7 @@ describe('Multi-file editor library dirty diff controller', () => {
);
controller
.
decorate
({
data
:
{
changes
:
computeDiff
(
'
123
'
,
'
1234
'
),
path
:
'
path
'
},
data
:
{
changes
:
computeDiff
(
'
123
'
,
'
1234
'
),
path
:
model
.
path
},
});
expect
(
spy
).
toHaveBeenCalledWith
(
...
...
spec/javascripts/ide/stores/actions/file_spec.js
View file @
bead083c
...
...
@@ -29,7 +29,7 @@ describe('Multi-file store file actions', () => {
it
(
'
closes open files
'
,
done
=>
{
store
.
dispatch
(
'
closeFile
'
,
localFile
.
path
)
.
dispatch
(
'
closeFile
'
,
localFile
)
.
then
(()
=>
{
expect
(
localFile
.
opened
).
toBeFalsy
();
expect
(
localFile
.
active
).
toBeFalsy
();
...
...
@@ -44,7 +44,7 @@ describe('Multi-file store file actions', () => {
store
.
state
.
changedFiles
.
push
(
localFile
);
store
.
dispatch
(
'
closeFile
'
,
localFile
.
path
)
.
dispatch
(
'
closeFile
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
store
.
state
.
openFiles
.
length
).
toBe
(
0
);
...
...
@@ -65,7 +65,7 @@ describe('Multi-file store file actions', () => {
store
.
state
.
entries
[
f
.
path
]
=
f
;
store
.
dispatch
(
'
closeFile
'
,
localFile
.
path
)
.
dispatch
(
'
closeFile
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
router
.
push
).
toHaveBeenCalledWith
(
`/project
${
f
.
url
}
`
);
...
...
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