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
ae5600b8
Commit
ae5600b8
authored
Sep 14, 2018
by
Paul Slaughter
Committed by
Phil Hughes
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create specs for diffs/components/app and update modules to export factory functions
parent
32b96bfd
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
23 deletions
+103
-23
app/assets/javascripts/diffs/store/modules/diff_state.js
app/assets/javascripts/diffs/store/modules/diff_state.js
+2
-0
app/assets/javascripts/diffs/store/modules/index.js
app/assets/javascripts/diffs/store/modules/index.js
+2
-2
app/assets/javascripts/mr_notes/stores/index.js
app/assets/javascripts/mr_notes/stores/index.js
+2
-2
app/assets/javascripts/notes/stores/index.js
app/assets/javascripts/notes/stores/index.js
+2
-10
app/assets/javascripts/notes/stores/modules/index.js
app/assets/javascripts/notes/stores/modules/index.js
+2
-2
spec/javascripts/diffs/components/app_spec.js
spec/javascripts/diffs/components/app_spec.js
+71
-1
spec/javascripts/diffs/components/changed_files_spec.js
spec/javascripts/diffs/components/changed_files_spec.js
+1
-1
spec/javascripts/diffs/components/diff_file_header_spec.js
spec/javascripts/diffs/components/diff_file_header_spec.js
+6
-5
spec/javascripts/diffs/create_diffs_store.js
spec/javascripts/diffs/create_diffs_store.js
+15
-0
No files found.
app/assets/javascripts/diffs/store/modules/diff_state.js
View file @
ae5600b8
...
@@ -11,8 +11,10 @@ export default () => ({
...
@@ -11,8 +11,10 @@ export default () => ({
endpoint
:
''
,
endpoint
:
''
,
basePath
:
''
,
basePath
:
''
,
commit
:
null
,
commit
:
null
,
startVersion
:
null
,
diffFiles
:
[],
diffFiles
:
[],
mergeRequestDiffs
:
[],
mergeRequestDiffs
:
[],
mergeRequestDiff
:
null
,
diffLineCommentForms
:
{},
diffLineCommentForms
:
{},
diffViewType
:
viewTypeFromQueryString
||
viewTypeFromCookie
||
defaultViewType
,
diffViewType
:
viewTypeFromQueryString
||
viewTypeFromCookie
||
defaultViewType
,
});
});
app/assets/javascripts/diffs/store/modules/index.js
View file @
ae5600b8
...
@@ -3,10 +3,10 @@ import * as getters from '../getters';
...
@@ -3,10 +3,10 @@ import * as getters from '../getters';
import
mutations
from
'
../mutations
'
;
import
mutations
from
'
../mutations
'
;
import
createState
from
'
./diff_state
'
;
import
createState
from
'
./diff_state
'
;
export
default
{
export
default
()
=>
(
{
namespaced
:
true
,
namespaced
:
true
,
state
:
createState
(),
state
:
createState
(),
getters
,
getters
,
actions
,
actions
,
mutations
,
mutations
,
};
}
)
;
app/assets/javascripts/mr_notes/stores/index.js
View file @
ae5600b8
...
@@ -9,7 +9,7 @@ Vue.use(Vuex);
...
@@ -9,7 +9,7 @@ Vue.use(Vuex);
export
default
new
Vuex
.
Store
({
export
default
new
Vuex
.
Store
({
modules
:
{
modules
:
{
page
:
mrPageModule
,
page
:
mrPageModule
,
notes
:
notesModule
,
notes
:
notesModule
()
,
diffs
:
diffsModule
,
diffs
:
diffsModule
()
,
},
},
});
});
app/assets/javascripts/notes/stores/index.js
View file @
ae5600b8
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
*
as
actions
from
'
./actions
'
;
import
notesModule
from
'
./modules
'
;
import
*
as
getters
from
'
./getters
'
;
import
mutations
from
'
./mutations
'
;
import
module
from
'
./modules
'
;
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
export
default
()
=>
export
default
()
=>
new
Vuex
.
Store
({
new
Vuex
.
Store
(
notesModule
());
state
:
module
.
state
,
actions
,
getters
,
mutations
,
});
app/assets/javascripts/notes/stores/modules/index.js
View file @
ae5600b8
...
@@ -2,7 +2,7 @@ import * as actions from '../actions';
...
@@ -2,7 +2,7 @@ import * as actions from '../actions';
import
*
as
getters
from
'
../getters
'
;
import
*
as
getters
from
'
../getters
'
;
import
mutations
from
'
../mutations
'
;
import
mutations
from
'
../mutations
'
;
export
default
{
export
default
()
=>
(
{
state
:
{
state
:
{
discussions
:
[],
discussions
:
[],
targetNoteHash
:
null
,
targetNoteHash
:
null
,
...
@@ -24,4 +24,4 @@ export default {
...
@@ -24,4 +24,4 @@ export default {
actions
,
actions
,
getters
,
getters
,
mutations
,
mutations
,
};
}
)
;
spec/javascripts/diffs/components/app_spec.js
View file @
ae5600b8
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
import
Vue
from
'
vue
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
App
from
'
~/diffs/components/app.vue
'
;
import
createDiffsStore
from
'
../create_diffs_store
'
;
describe
(
'
diffs/components/app
'
,
()
=>
{
const
oldMrTabs
=
window
.
mrTabs
;
const
Component
=
Vue
.
extend
(
App
);
let
vm
;
beforeEach
(()
=>
{
// setup globals (needed for component to mount :/)
window
.
mrTabs
=
jasmine
.
createSpyObj
(
'
mrTabs
'
,
[
'
resetViewContainer
'
]);
// setup component
const
store
=
createDiffsStore
();
store
.
state
.
diffs
.
isLoading
=
false
;
vm
=
mountComponentWithStore
(
Component
,
{
store
,
props
:
{
endpoint
:
`
${
TEST_HOST
}
/diff/endpoint`
,
projectPath
:
'
namespace/project
'
,
currentUser
:
{},
},
});
});
afterEach
(()
=>
{
// reset globals
window
.
mrTabs
=
oldMrTabs
;
// reset component
vm
.
$destroy
();
});
it
(
'
shows comments message, with commit
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
commit
=
{};
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
).
toContainText
(
'
Only comments from the following commit are shown below
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
shows comments message, with old mergeRequestDiff
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
mergeRequestDiff
=
{
latest
:
false
};
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
).
toContainText
(
"
Not all comments are displayed because you're viewing an old version of the diff.
"
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
shows comments message, with startVersion
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
startVersion
=
'
test
'
;
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
).
toContainText
(
"
Not all comments are displayed because you're comparing two versions of the diff.
"
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
spec/javascripts/diffs/components/changed_files_spec.js
View file @
ae5600b8
...
@@ -8,7 +8,7 @@ describe('ChangedFiles', () => {
...
@@ -8,7 +8,7 @@ describe('ChangedFiles', () => {
const
Component
=
Vue
.
extend
(
changedFiles
);
const
Component
=
Vue
.
extend
(
changedFiles
);
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
modules
:
{
modules
:
{
diffs
:
diffsModule
,
diffs
:
diffsModule
()
,
},
},
});
});
...
...
spec/javascripts/diffs/components/diff_file_header_spec.js
View file @
ae5600b8
...
@@ -16,8 +16,8 @@ describe('diff_file_header', () => {
...
@@ -16,8 +16,8 @@ describe('diff_file_header', () => {
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
modules
:
{
modules
:
{
diffs
:
diffsModule
,
diffs
:
diffsModule
()
,
notes
:
notesModule
,
notes
:
notesModule
()
,
},
},
});
});
...
@@ -450,13 +450,14 @@ describe('diff_file_header', () => {
...
@@ -450,13 +450,14 @@ describe('diff_file_header', () => {
propsCopy
.
diffFile
.
deletedFile
=
true
;
propsCopy
.
diffFile
.
deletedFile
=
true
;
const
discussionGetter
=
()
=>
[
diffDiscussionMock
];
const
discussionGetter
=
()
=>
[
diffDiscussionMock
];
notesModule
.
getters
.
discussions
=
discussionGetter
;
const
notesModuleMock
=
notesModule
();
notesModuleMock
.
getters
.
discussions
=
discussionGetter
;
vm
=
mountComponentWithStore
(
Component
,
{
vm
=
mountComponentWithStore
(
Component
,
{
props
:
propsCopy
,
props
:
propsCopy
,
store
:
new
Vuex
.
Store
({
store
:
new
Vuex
.
Store
({
modules
:
{
modules
:
{
diffs
:
diffsModule
,
diffs
:
diffsModule
()
,
notes
:
notesModule
,
notes
:
notesModule
Mock
,
},
},
}),
}),
});
});
...
...
spec/javascripts/diffs/create_diffs_store.js
0 → 100644
View file @
ae5600b8
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
notesModule
from
'
~/notes/stores/modules
'
;
Vue
.
use
(
Vuex
);
export
default
function
createDiffsStore
()
{
return
new
Vuex
.
Store
({
modules
:
{
diffs
:
diffsModule
(),
notes
:
notesModule
(),
},
});
}
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