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
2f098e8a
Commit
2f098e8a
authored
Jan 18, 2021
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace callbacks with async/await in last_commit_spec
parent
4c9338ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
49 deletions
+47
-49
spec/frontend/repository/components/last_commit_spec.js
spec/frontend/repository/components/last_commit_spec.js
+47
-49
No files found.
spec/frontend/repository/components/last_commit_spec.js
View file @
2f098e8a
...
@@ -58,77 +58,75 @@ describe('Repository last commit component', () => {
...
@@ -58,77 +58,75 @@ describe('Repository last commit component', () => {
loading | label
loading | label
${
true
}
|
${
'
shows
'
}
${
true
}
|
${
'
shows
'
}
${
false
}
|
${
'
hides
'
}
${
false
}
|
${
'
hides
'
}
`
(
'
$label when loading icon $loading is true
'
,
({
loading
})
=>
{
`
(
'
$label when loading icon $loading is true
'
,
async
({
loading
})
=>
{
factory
(
createCommitData
(),
loading
);
factory
(
createCommitData
(),
loading
);
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
loading
);
}
);
expect
(
vm
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
loading
);
});
});
it
(
'
renders commit widget
'
,
()
=>
{
it
(
'
renders commit widget
'
,
async
()
=>
{
factory
();
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
element
).
toMatchSnapshot
();
}
);
expect
(
vm
.
element
).
toMatchSnapshot
(
);
});
});
it
(
'
renders short commit ID
'
,
()
=>
{
it
(
'
renders short commit ID
'
,
async
()
=>
{
factory
();
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
[data-testid="last-commit-id-label"]
'
).
text
()).
toEqual
(
'
12345678
'
);
}
);
expect
(
vm
.
find
(
'
[data-testid="last-commit-id-label"]
'
).
text
()).
toEqual
(
'
12345678
'
);
});
});
it
(
'
hides pipeline components when pipeline does not exist
'
,
()
=>
{
it
(
'
hides pipeline components when pipeline does not exist
'
,
async
()
=>
{
factory
(
createCommitData
({
pipeline
:
null
}));
factory
(
createCommitData
({
pipeline
:
null
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
false
);
}
);
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
false
);
});
});
it
(
'
renders pipeline components
'
,
()
=>
{
it
(
'
renders pipeline components
'
,
async
()
=>
{
factory
();
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
true
);
}
);
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
hides author component when author does not exist
'
,
()
=>
{
it
(
'
hides author component when author does not exist
'
,
async
()
=>
{
factory
(
createCommitData
({
author
:
null
}));
factory
(
createCommitData
({
author
:
null
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.js-user-link
'
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
UserAvatarLink
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
'
.js-user-link
'
).
exists
()).
toBe
(
false
);
}
);
expect
(
vm
.
find
(
UserAvatarLink
).
exists
()).
toBe
(
false
);
});
});
it
(
'
does not render description expander when description is null
'
,
()
=>
{
it
(
'
does not render description expander when description is null
'
,
async
()
=>
{
factory
(
createCommitData
({
descriptionHtml
:
null
}));
factory
(
createCommitData
({
descriptionHtml
:
null
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.text-expander
'
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
'
.commit-row-description
'
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
'
.text-expander
'
).
exists
()).
toBe
(
false
);
}
);
expect
(
vm
.
find
(
'
.commit-row-description
'
).
exists
()).
toBe
(
false
);
});
});
it
(
'
expands commit description when clicking expander
'
,
()
=>
{
it
(
'
expands commit description when clicking expander
'
,
async
()
=>
{
factory
(
createCommitData
({
descriptionHtml
:
'
Test description
'
}));
factory
(
createCommitData
({
descriptionHtml
:
'
Test description
'
}));
return
vm
.
vm
await
vm
.
vm
.
$nextTick
();
.
$nextTick
()
.
then
(()
=>
{
vm
.
find
(
'
.text-expander
'
).
vm
.
$emit
(
'
click
'
);
vm
.
find
(
'
.text-expander
'
).
vm
.
$emit
(
'
click
'
);
return
vm
.
vm
.
$nextTick
();
await
vm
.
vm
.
$nextTick
();
})
.
then
(()
=>
{
expect
(
vm
.
find
(
'
.commit-row-description
'
).
isVisible
()).
toBe
(
true
);
expect
(
vm
.
find
(
'
.commit-row-description
'
).
isVisible
()).
toBe
(
true
);
expect
(
vm
.
find
(
'
.text-expander
'
).
classes
(
'
open
'
)).
toBe
(
true
);
expect
(
vm
.
find
(
'
.text-expander
'
).
classes
(
'
open
'
)).
toBe
(
true
);
});
});
});
it
(
'
strips the first newline of the description
'
,
async
()
=>
{
it
(
'
strips the first newline of the description
'
,
async
()
=>
{
...
@@ -141,19 +139,19 @@ describe('Repository last commit component', () => {
...
@@ -141,19 +139,19 @@ describe('Repository last commit component', () => {
);
);
});
});
it
(
'
renders the signature HTML as returned by the backend
'
,
()
=>
{
it
(
'
renders the signature HTML as returned by the backend
'
,
async
()
=>
{
factory
(
createCommitData
({
signatureHtml
:
'
<button>Verified</button>
'
}));
factory
(
createCommitData
({
signatureHtml
:
'
<button>Verified</button>
'
}));
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
element
).
toMatchSnapshot
();
}
);
expect
(
vm
.
element
).
toMatchSnapshot
(
);
});
});
it
(
'
sets correct CSS class if the commit message is empty
'
,
()
=>
{
it
(
'
sets correct CSS class if the commit message is empty
'
,
async
()
=>
{
factory
(
createCommitData
({
message
:
''
}));
factory
(
createCommitData
({
message
:
''
}));
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.item-title
'
).
classes
()).
toContain
(
emptyMessageClass
);
}
);
expect
(
vm
.
find
(
'
.item-title
'
).
classes
()).
toContain
(
emptyMessageClass
);
});
});
});
});
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