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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f1ddfac4
Commit
f1ddfac4
authored
Mar 28, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added specs
parent
9cd0bb74
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
33 deletions
+87
-33
spec/javascripts/ide/components/repo_editor_spec.js
spec/javascripts/ide/components/repo_editor_spec.js
+35
-33
spec/javascripts/ide/lib/editor_spec.js
spec/javascripts/ide/lib/editor_spec.js
+52
-0
No files found.
spec/javascripts/ide/components/repo_editor_spec.js
View file @
f1ddfac4
...
...
@@ -149,47 +149,49 @@ describe('RepoEditor', () => {
});
});
describe
(
'
setup editor for merge request viewing
'
,
()
=>
{
beforeEach
(
done
=>
{
// Resetting as the main test setup has already done it
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
Editor
.
editorInstance
.
modelManager
.
dispose
();
const
f
=
{
...
file
(),
active
:
true
,
tempFile
:
true
,
html
:
'
testing
'
,
mrChange
:
{
diff
:
'
ABC
'
},
baseRaw
:
'
testing
'
,
content
:
'
test
'
,
};
const
RepoEditor
=
Vue
.
extend
(
repoEditor
);
vm
=
createComponentWithStore
(
RepoEditor
,
store
,
{
file
:
f
,
describe
(
'
editor updateDimensions
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
vm
.
editor
,
'
updateDimensions
'
).
and
.
callThrough
();
spyOn
(
vm
.
editor
,
'
updateDiffView
'
);
});
vm
.
$store
.
state
.
openFiles
.
push
(
f
);
vm
.
$store
.
state
.
entries
[
f
.
path
]
=
f
;
it
(
'
calls updateDimensions when rightPanelCollapsed is changed
'
,
done
=>
{
vm
.
$store
.
state
.
rightPanelCollapsed
=
true
;
vm
.
$store
.
state
.
viewer
=
'
mrdiff
'
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
toHaveBeenCalled
();
expect
(
vm
.
editor
.
updateDiffView
).
toHaveBeenCalled
();
vm
.
monaco
=
true
;
done
();
});
});
vm
.
$mount
();
it
(
'
calls updateDimensions when panelResizing is false
'
,
done
=>
{
vm
.
$store
.
state
.
panelResizing
=
true
;
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
setTimeout
(
done
,
0
);
});
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
$store
.
state
.
panelResizing
=
false
;
})
.
then
(
vm
.
$nextTick
)
.
then
(()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
toHaveBeenCalled
();
expect
(
vm
.
editor
.
updateDiffView
).
toHaveBeenCalled
();
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
attaches merge request model to editor when merge request diff
'
,
()
=>
{
spyOn
(
vm
.
editor
,
'
attachMergeRequestModel
'
).
and
.
callThrough
()
;
it
(
'
does not call updateDimensions when panelResizing is true
'
,
done
=>
{
vm
.
$store
.
state
.
panelResizing
=
true
;
vm
.
setupEditor
();
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
not
.
toHaveBeenCalled
();
expect
(
vm
.
editor
.
updateDiffView
).
not
.
toHaveBeenCalled
();
expect
(
vm
.
editor
.
attachMergeRequestModel
).
toHaveBeenCalledWith
(
vm
.
model
);
done
();
});
});
});
});
spec/javascripts/ide/lib/editor_spec.js
View file @
f1ddfac4
...
...
@@ -215,4 +215,56 @@ describe('Multi-file editor library', () => {
expect
(
instance
.
decorationsController
.
dispose
).
not
.
toHaveBeenCalled
();
});
});
describe
(
'
updateDiffView
'
,
()
=>
{
describe
(
'
edit mode
'
,
()
=>
{
it
(
'
does not update options
'
,
()
=>
{
instance
.
createInstance
(
holder
);
spyOn
(
instance
.
instance
,
'
updateOptions
'
);
instance
.
updateDiffView
();
expect
(
instance
.
instance
.
updateOptions
).
not
.
toHaveBeenCalled
();
});
});
describe
(
'
diff mode
'
,
()
=>
{
beforeEach
(()
=>
{
instance
.
createDiffInstance
(
holder
);
spyOn
(
instance
.
instance
,
'
updateOptions
'
).
and
.
callThrough
();
});
it
(
'
sets renderSideBySide to false if el is less than 700 pixels
'
,
()
=>
{
spyOnProperty
(
instance
.
instance
.
getDomNode
(),
'
offsetWidth
'
).
and
.
returnValue
(
600
);
expect
(
instance
.
instance
.
updateOptions
).
not
.
toHaveBeenCalledWith
({
renderSideBySide
:
false
,
});
});
it
(
'
sets renderSideBySide to false if el is more than 700 pixels
'
,
()
=>
{
spyOnProperty
(
instance
.
instance
.
getDomNode
(),
'
offsetWidth
'
).
and
.
returnValue
(
800
);
expect
(
instance
.
instance
.
updateOptions
).
not
.
toHaveBeenCalledWith
({
renderSideBySide
:
true
,
});
});
});
});
describe
(
'
isDiffEditorType
'
,
()
=>
{
it
(
'
returns true when diff editor
'
,
()
=>
{
instance
.
createDiffInstance
(
holder
);
expect
(
instance
.
isDiffEditorType
).
toBe
(
true
);
});
it
(
'
returns false when not diff editor
'
,
()
=>
{
instance
.
createInstance
(
holder
);
expect
(
instance
.
isDiffEditorType
).
toBe
(
false
);
});
});
});
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