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', () => {
loading | label
${
true
}
|
${
'
shows
'
}
${
false
}
|
${
'
hides
'
}
`
(
'
$label when loading icon $loading is true
'
,
({
loading
})
=>
{
`
(
'
$label when loading icon $loading is true
'
,
async
({
loading
})
=>
{
factory
(
createCommitData
(),
loading
);
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
loading
);
}
);
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
loading
);
});
it
(
'
renders commit widget
'
,
()
=>
{
it
(
'
renders commit widget
'
,
async
()
=>
{
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
element
).
toMatchSnapshot
();
}
);
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
element
).
toMatchSnapshot
(
);
});
it
(
'
renders short commit ID
'
,
()
=>
{
it
(
'
renders short commit ID
'
,
async
()
=>
{
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
'
[data-testid="last-commit-id-label"]
'
).
text
()).
toEqual
(
'
12345678
'
);
}
);
await
vm
.
vm
.
$nextTick
();
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
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
false
);
}
);
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
false
);
});
it
(
'
renders pipeline components
'
,
()
=>
{
it
(
'
renders pipeline components
'
,
async
()
=>
{
factory
();
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
'
.js-commit-pipeline
'
).
exists
()).
toBe
(
true
);
}
);
await
vm
.
vm
.
$nextTick
();
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
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
'
.js-user-link
'
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
UserAvatarLink
).
exists
()).
toBe
(
false
);
}
);
await
vm
.
vm
.
$nextTick
();
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
}));
return
vm
.
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
find
(
'
.text-expander
'
).
exists
()).
toBe
(
false
);
expect
(
vm
.
find
(
'
.commit-row-description
'
).
exists
()).
toBe
(
false
);
}
);
await
vm
.
vm
.
$nextTick
();
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
'
}));
return
vm
.
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
find
(
'
.text-expander
'
).
vm
.
$emit
(
'
click
'
);
return
vm
.
vm
.
$nextTick
();
})
.
then
(()
=>
{
expect
(
vm
.
find
(
'
.commit-row-description
'
).
isVisible
()).
toBe
(
true
);
expect
(
vm
.
find
(
'
.text-expander
'
).
classes
(
'
open
'
)).
toBe
(
true
);
});
await
vm
.
vm
.
$nextTick
();
vm
.
find
(
'
.text-expander
'
).
vm
.
$emit
(
'
click
'
);
await
vm
.
vm
.
$nextTick
();
expect
(
vm
.
find
(
'
.commit-row-description
'
).
isVisible
()).
toBe
(
true
);
expect
(
vm
.
find
(
'
.text-expander
'
).
classes
(
'
open
'
)).
toBe
(
true
);
});
it
(
'
strips the first newline of the description
'
,
async
()
=>
{
...
...
@@ -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>
'
}));
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
element
).
toMatchSnapshot
();
}
);
await
vm
.
vm
.
$nextTick
();
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
:
''
}));
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
find
(
'
.item-title
'
).
classes
()).
toContain
(
emptyMessageClass
);
}
);
await
vm
.
vm
.
$nextTick
();
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