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
Jérome Perrin
gitlab-ce
Commits
d0bcf017
Commit
d0bcf017
authored
Aug 07, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy makeCommit and test resetCommitState in repo_commit_section
parent
62e3b28c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
+32
-8
app/assets/javascripts/repo/components/repo_commit_section.vue
...ssets/javascripts/repo/components/repo_commit_section.vue
+10
-8
spec/javascripts/repo/components/repo_commit_section_spec.js
spec/javascripts/repo/components/repo_commit_section_spec.js
+22
-0
No files found.
app/assets/javascripts/repo/components/repo_commit_section.vue
View file @
d0bcf017
...
@@ -41,14 +41,16 @@ const RepoCommitSection = {
...
@@ -41,14 +41,16 @@ const RepoCommitSection = {
actions
,
actions
,
};
};
Store
.
submitCommitsLoading
=
true
;
Store
.
submitCommitsLoading
=
true
;
Service
.
commitFiles
(
payload
,
()
=>
{
Service
.
commitFiles
(
payload
,
this
.
resetCommitState
);
Store
.
submitCommitsLoading
=
false
;
},
this
.
changedFiles
=
[];
this
.
openedFiles
=
[];
resetCommitState
()
{
this
.
commitMessage
=
''
;
this
.
submitCommitsLoading
=
false
;
this
.
editMode
=
false
;
this
.
changedFiles
=
[];
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
'
fast
'
);
this
.
openedFiles
=
[];
});
this
.
commitMessage
=
''
;
this
.
editMode
=
false
;
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
'
fast
'
);
},
},
},
},
};
};
...
...
spec/javascripts/repo/components/repo_commit_section_spec.js
View file @
d0bcf017
...
@@ -133,4 +133,26 @@ describe('RepoCommitSection', () => {
...
@@ -133,4 +133,26 @@ describe('RepoCommitSection', () => {
});
});
});
});
});
});
fdescribe
(
'
methods
'
,
()
=>
{
describe
(
'
resetCommitState
'
,
()
=>
{
it
(
'
should reset store vars and scroll to top
'
,
()
=>
{
const
vm
=
{
submitCommitsLoading
:
true
,
changedFiles
:
new
Array
(
10
),
openedFiles
:
new
Array
(
10
),
commitMessage
:
'
commitMessage
'
,
editMode
:
true
,
};
repoCommitSection
.
methods
.
resetCommitState
.
call
(
vm
);
expect
(
vm
.
submitCommitsLoading
).
toEqual
(
false
);
expect
(
vm
.
changedFiles
).
toEqual
([]);
expect
(
vm
.
openedFiles
).
toEqual
([]);
expect
(
vm
.
commitMessage
).
toEqual
(
''
);
expect
(
vm
.
editMode
).
toEqual
(
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