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
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 () => ({
endpoint
:
''
,
basePath
:
''
,
commit
:
null
,
startVersion
:
null
,
diffFiles
:
[],
mergeRequestDiffs
:
[],
mergeRequestDiff
:
null
,
diffLineCommentForms
:
{},
diffViewType
:
viewTypeFromQueryString
||
viewTypeFromCookie
||
defaultViewType
,
});
app/assets/javascripts/diffs/store/modules/index.js
View file @
ae5600b8
...
...
@@ -3,10 +3,10 @@ import * as getters from '../getters';
import
mutations
from
'
../mutations
'
;
import
createState
from
'
./diff_state
'
;
export
default
{
export
default
()
=>
(
{
namespaced
:
true
,
state
:
createState
(),
getters
,
actions
,
mutations
,
};
}
)
;
app/assets/javascripts/mr_notes/stores/index.js
View file @
ae5600b8
...
...
@@ -9,7 +9,7 @@ Vue.use(Vuex);
export
default
new
Vuex
.
Store
({
modules
:
{
page
:
mrPageModule
,
notes
:
notesModule
,
diffs
:
diffsModule
,
notes
:
notesModule
()
,
diffs
:
diffsModule
()
,
},
});
app/assets/javascripts/notes/stores/index.js
View file @
ae5600b8
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
*
as
actions
from
'
./actions
'
;
import
*
as
getters
from
'
./getters
'
;
import
mutations
from
'
./mutations
'
;
import
module
from
'
./modules
'
;
import
notesModule
from
'
./modules
'
;
Vue
.
use
(
Vuex
);
export
default
()
=>
new
Vuex
.
Store
({
state
:
module
.
state
,
actions
,
getters
,
mutations
,
});
new
Vuex
.
Store
(
notesModule
());
app/assets/javascripts/notes/stores/modules/index.js
View file @
ae5600b8
...
...
@@ -2,7 +2,7 @@ import * as actions from '../actions';
import
*
as
getters
from
'
../getters
'
;
import
mutations
from
'
../mutations
'
;
export
default
{
export
default
()
=>
(
{
state
:
{
discussions
:
[],
targetNoteHash
:
null
,
...
...
@@ -24,4 +24,4 @@ export default {
actions
,
getters
,
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', () => {
const
Component
=
Vue
.
extend
(
changedFiles
);
const
store
=
new
Vuex
.
Store
({
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', () => {
const
store
=
new
Vuex
.
Store
({
modules
:
{
diffs
:
diffsModule
,
notes
:
notesModule
,
diffs
:
diffsModule
()
,
notes
:
notesModule
()
,
},
});
...
...
@@ -450,13 +450,14 @@ describe('diff_file_header', () => {
propsCopy
.
diffFile
.
deletedFile
=
true
;
const
discussionGetter
=
()
=>
[
diffDiscussionMock
];
notesModule
.
getters
.
discussions
=
discussionGetter
;
const
notesModuleMock
=
notesModule
();
notesModuleMock
.
getters
.
discussions
=
discussionGetter
;
vm
=
mountComponentWithStore
(
Component
,
{
props
:
propsCopy
,
store
:
new
Vuex
.
Store
({
modules
:
{
diffs
:
diffsModule
,
notes
:
notesModule
,
diffs
:
diffsModule
()
,
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