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
17c3dcf6
Commit
17c3dcf6
authored
Mar 15, 2021
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a mutation to set the MR Metadata into state
parent
8de1bc8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
0 deletions
+17
-0
app/assets/javascripts/mr_notes/stores/modules/index.js
app/assets/javascripts/mr_notes/stores/modules/index.js
+1
-0
app/assets/javascripts/mr_notes/stores/mutation_types.js
app/assets/javascripts/mr_notes/stores/mutation_types.js
+1
-0
app/assets/javascripts/mr_notes/stores/mutations.js
app/assets/javascripts/mr_notes/stores/mutations.js
+3
-0
spec/frontend/mr_notes/stores/mutations_spec.js
spec/frontend/mr_notes/stores/mutations_spec.js
+12
-0
No files found.
app/assets/javascripts/mr_notes/stores/modules/index.js
View file @
17c3dcf6
...
...
@@ -6,6 +6,7 @@ export default () => ({
state
:
{
endpoints
:
{},
activeTab
:
null
,
mrMetadata
:
{},
},
actions
,
getters
,
...
...
app/assets/javascripts/mr_notes/stores/mutation_types.js
View file @
17c3dcf6
export
default
{
SET_ACTIVE_TAB
:
'
SET_ACTIVE_TAB
'
,
SET_ENDPOINTS
:
'
SET_ENDPOINTS
'
,
SET_MR_METADATA
:
'
SET_MR_METADATA
'
,
};
app/assets/javascripts/mr_notes/stores/mutations.js
View file @
17c3dcf6
...
...
@@ -7,4 +7,7 @@ export default {
[
types
.
SET_ENDPOINTS
](
state
,
endpoints
)
{
Object
.
assign
(
state
,
{
endpoints
});
},
[
types
.
SET_MR_METADATA
](
state
,
metadata
)
{
Object
.
assign
(
state
,
{
mrMetadata
:
metadata
});
},
};
spec/frontend/mr_notes/stores/mutations_spec.js
View file @
17c3dcf6
...
...
@@ -12,4 +12,16 @@ describe('MR Notes Mutations', () => {
expect
(
state
.
endpoints
).
toEqual
(
endpoints
);
});
});
describe
(
mutationTypes
.
SET_MR_METADATA
,
()
=>
{
it
(
'
store the provided MR Metadata in the state
'
,
()
=>
{
const
state
=
{};
const
metadata
=
{
propA
:
'
A
'
,
propB
:
'
B
'
};
mutations
[
mutationTypes
.
SET_MR_METADATA
](
state
,
metadata
);
expect
(
state
.
mrMetadata
.
propA
).
toBe
(
'
A
'
);
expect
(
state
.
mrMetadata
.
propB
).
toBe
(
'
B
'
);
});
});
});
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