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
Léo-Paul Géneau
gitlab-ce
Commits
b24316b2
Commit
b24316b2
authored
Nov 20, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a test for open merge request files
parent
ac8895b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+1
-1
spec/javascripts/ide/stores/actions/merge_request_spec.js
spec/javascripts/ide/stores/actions/merge_request_spec.js
+27
-3
No files found.
app/assets/javascripts/ide/stores/actions/file.js
View file @
b24316b2
...
@@ -74,7 +74,7 @@ export const getFileData = (
...
@@ -74,7 +74,7 @@ export const getFileData = (
const
normalizedHeaders
=
normalizeHeaders
(
headers
);
const
normalizedHeaders
=
normalizeHeaders
(
headers
);
setPageTitle
(
decodeURI
(
normalizedHeaders
[
'
PAGE-TITLE
'
]));
setPageTitle
(
decodeURI
(
normalizedHeaders
[
'
PAGE-TITLE
'
]));
commit
(
types
.
SET_FILE_DATA
,
{
data
,
file
});
if
(
data
)
commit
(
types
.
SET_FILE_DATA
,
{
data
,
file
});
if
(
openFile
)
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
if
(
openFile
)
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
if
(
makeFileActive
)
dispatch
(
'
setFileActive
'
,
path
);
if
(
makeFileActive
)
dispatch
(
'
setFileActive
'
,
path
);
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
});
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
});
...
...
spec/javascripts/ide/stores/actions/merge_request_spec.js
View file @
b24316b2
...
@@ -262,16 +262,28 @@ describe('IDE store merge request actions', () => {
...
@@ -262,16 +262,28 @@ describe('IDE store merge request actions', () => {
bar
:
{},
bar
:
{},
};
};
spyOn
(
store
,
'
dispatch
'
).
and
.
callFake
(
type
=>
{
const
originalDispatch
=
store
.
dispatch
;
spyOn
(
store
,
'
dispatch
'
).
and
.
callFake
((
type
,
payload
)
=>
{
switch
(
type
)
{
switch
(
type
)
{
case
'
getMergeRequestData
'
:
case
'
getMergeRequestData
'
:
return
Promise
.
resolve
(
testMergeRequest
);
return
Promise
.
resolve
(
testMergeRequest
);
case
'
getMergeRequestChanges
'
:
case
'
getMergeRequestChanges
'
:
return
Promise
.
resolve
(
testMergeRequestChanges
);
return
Promise
.
resolve
(
testMergeRequestChanges
);
default
:
case
'
getFiles
'
:
case
'
getMergeRequestVersions
'
:
case
'
getBranchData
'
:
case
'
setFileMrChange
'
:
return
Promise
.
resolve
();
return
Promise
.
resolve
();
default
:
return
originalDispatch
(
type
,
payload
);
}
}
});
});
spyOn
(
service
,
'
getFileData
'
).
and
.
callFake
(()
=>
Promise
.
resolve
({
headers
:
{},
}),
);
});
});
it
(
'
dispatch actions for merge request data
'
,
done
=>
{
it
(
'
dispatch actions for merge request data
'
,
done
=>
{
...
@@ -303,7 +315,17 @@ describe('IDE store merge request actions', () => {
...
@@ -303,7 +315,17 @@ describe('IDE store merge request actions', () => {
});
});
it
(
'
updates activity bar view and gets file data, if changes are found
'
,
done
=>
{
it
(
'
updates activity bar view and gets file data, if changes are found
'
,
done
=>
{
testMergeRequestChanges
.
changes
=
[{
new_path
:
'
foo
'
},
{
new_path
:
'
bar
'
}];
store
.
state
.
entries
.
foo
=
{
url
:
'
test
'
,
};
store
.
state
.
entries
.
bar
=
{
url
:
'
test
'
,
};
testMergeRequestChanges
.
changes
=
[
{
new_path
:
'
foo
'
,
path
:
'
foo
'
},
{
new_path
:
'
bar
'
,
path
:
'
bar
'
},
];
openMergeRequest
(
store
,
mr
)
openMergeRequest
(
store
,
mr
)
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -324,6 +346,8 @@ describe('IDE store merge request actions', () => {
...
@@ -324,6 +346,8 @@ describe('IDE store merge request actions', () => {
openFile
:
true
,
openFile
:
true
,
});
});
});
});
expect
(
store
.
state
.
openFiles
.
length
).
toBe
(
testMergeRequestChanges
.
changes
.
length
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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