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
d0cb0852
Commit
d0cb0852
authored
Nov 03, 2021
by
Tristan Read
Committed by
Peter Leitzen
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for issue type selector
parent
6501c882
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
spec/frontend/issue_show/components/fields/type_spec.js
spec/frontend/issue_show/components/fields/type_spec.js
+25
-1
No files found.
spec/frontend/issue_show/components/fields/type_spec.js
View file @
d0cb0852
...
...
@@ -39,7 +39,7 @@ describe('Issue type field component', () => {
const
findTypeFromDropDownItemIconAt
=
(
at
)
=>
findTypeFromDropDownItems
().
at
(
at
).
findComponent
(
GlIcon
);
const
createComponent
=
({
data
}
=
{})
=>
{
const
createComponent
=
({
data
}
=
{}
,
provide
)
=>
{
fakeApollo
=
createMockApollo
([],
mockResolvers
);
wrapper
=
shallowMount
(
IssueTypeField
,
{
...
...
@@ -51,6 +51,10 @@ describe('Issue type field component', () => {
...
data
,
};
},
provide
:
{
canCreateIncident
:
true
,
...
provide
,
},
});
};
...
...
@@ -92,5 +96,25 @@ describe('Issue type field component', () => {
await
wrapper
.
vm
.
$nextTick
();
expect
(
findTypeFromDropDown
().
attributes
(
'
value
'
)).
toBe
(
IssuableTypes
.
incident
);
});
describe
(
'
when user is a guest
'
,
()
=>
{
it
(
'
hides the incident type from the dropdown
'
,
async
()
=>
{
createComponent
({},
{
canCreateIncident
:
false
,
issueType
:
'
issue
'
});
await
waitForPromises
();
expect
(
findTypeFromDropDownItemAt
(
0
).
isVisible
()).
toBe
(
true
);
expect
(
findTypeFromDropDownItemAt
(
1
).
isVisible
()).
toBe
(
false
);
expect
(
findTypeFromDropDown
().
attributes
(
'
value
'
)).
toBe
(
IssuableTypes
.
issue
);
});
it
(
'
and incident is selected, includes incident in the dropdown
'
,
async
()
=>
{
createComponent
({},
{
canCreateIncident
:
false
,
issueType
:
'
incident
'
});
await
waitForPromises
();
expect
(
findTypeFromDropDownItemAt
(
0
).
isVisible
()).
toBe
(
true
);
expect
(
findTypeFromDropDownItemAt
(
1
).
isVisible
()).
toBe
(
true
);
expect
(
findTypeFromDropDown
().
attributes
(
'
value
'
)).
toBe
(
IssuableTypes
.
incident
);
});
});
});
});
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