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
665d5bea
Commit
665d5bea
authored
Jan 20, 2022
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace usage of find/findAll in related_items_tree
* migrate to proper use of findComponent/findAllComponents
parent
68755b38
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
42 deletions
+48
-42
ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js
...nd/related_items_tree/components/create_epic_form_spec.js
+4
-4
ee/spec/frontend/related_items_tree/components/create_issue_form_spec.js
...d/related_items_tree/components/create_issue_form_spec.js
+6
-2
ee/spec/frontend/related_items_tree/components/epic_health_status_spec.js
.../related_items_tree/components/epic_health_status_spec.js
+1
-1
ee/spec/frontend/related_items_tree/components/related_items_tree_app_spec.js
...ated_items_tree/components/related_items_tree_app_spec.js
+4
-4
ee/spec/frontend/related_items_tree/components/related_items_tree_header_spec.js
...d_items_tree/components/related_items_tree_header_spec.js
+9
-9
ee/spec/frontend/related_items_tree/components/state_tooltip_spec.js
...ntend/related_items_tree/components/state_tooltip_spec.js
+6
-4
ee/spec/frontend/related_items_tree/components/tree_item_body_spec.js
...tend/related_items_tree/components/tree_item_body_spec.js
+9
-9
ee/spec/frontend/related_items_tree/components/tree_item_remove_modal_spec.js
...ated_items_tree/components/tree_item_remove_modal_spec.js
+1
-1
ee/spec/frontend/related_items_tree/components/tree_item_spec.js
.../frontend/related_items_tree/components/tree_item_spec.js
+6
-6
ee/spec/frontend/related_items_tree/components/tree_root_spec.js
.../frontend/related_items_tree/components/tree_root_spec.js
+2
-2
No files found.
ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js
View file @
665d5bea
...
...
@@ -114,7 +114,7 @@ describe('RelatedItemsTree', () => {
describe
(
'
onFormSubmit
'
,
()
=>
{
it
(
'
emits `createEpicFormSubmit` event on component with input value as param
'
,
()
=>
{
const
value
=
'
foo
'
;
wrapper
.
find
(
GlFormInput
).
vm
.
$emit
(
'
input
'
,
value
);
wrapper
.
find
Component
(
GlFormInput
).
vm
.
$emit
(
'
input
'
,
value
);
wrapper
.
vm
.
onFormSubmit
();
expect
(
wrapper
.
emitted
().
createEpicFormSubmit
).
toBeTruthy
();
...
...
@@ -153,20 +153,20 @@ describe('RelatedItemsTree', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
renders input element within form
'
,
()
=>
{
const
inputEl
=
wrapper
.
find
(
GlFormInput
);
const
inputEl
=
wrapper
.
find
Component
(
GlFormInput
);
expect
(
inputEl
.
attributes
(
'
placeholder
'
)).
toBe
(
'
New epic title
'
);
});
it
(
'
renders form action buttons
'
,
()
=>
{
const
actionButtons
=
wrapper
.
findAll
(
GlButton
);
const
actionButtons
=
wrapper
.
findAll
Components
(
GlButton
);
expect
(
actionButtons
.
at
(
0
).
text
()).
toBe
(
'
Create epic
'
);
expect
(
actionButtons
.
at
(
1
).
text
()).
toBe
(
'
Cancel
'
);
});
it
(
'
renders parent group item as the first dropdown item
'
,
()
=>
{
const
items
=
wrapper
.
findAll
(
GlDropdownItem
);
const
items
=
wrapper
.
findAll
Components
(
GlDropdownItem
);
expect
(
items
.
at
(
0
).
text
()).
toContain
(
mockParentItem
.
groupName
);
});
...
...
ee/spec/frontend/related_items_tree/components/create_issue_form_spec.js
View file @
665d5bea
...
...
@@ -205,7 +205,9 @@ describe('CreateIssueForm', () => {
const
content
=
projectsDropdownButton
.
find
(
'
[data-testid="recent-items-content"]
'
);
expect
(
content
.
exists
()).
toBe
(
true
);
expect
(
content
.
findAll
(
GlDropdownItem
)).
toHaveLength
(
mockFrequentlyUsedProjects
.
length
);
expect
(
content
.
findAllComponents
(
GlDropdownItem
)).
toHaveLength
(
mockFrequentlyUsedProjects
.
length
,
);
removeLocalstorageFrequentItems
();
});
...
...
@@ -220,7 +222,9 @@ describe('CreateIssueForm', () => {
const
projectsDropdownButton
=
wrapper
.
findComponent
(
GlDropdown
);
expect
(
projectsDropdownButton
.
find
(
'
[data-testid="recent-items-content"]
'
).
findAll
(
GlDropdownItem
),
projectsDropdownButton
.
find
(
'
[data-testid="recent-items-content"]
'
)
.
findAllComponents
(
GlDropdownItem
),
).
toHaveLength
(
mockMixedFrequentlyUsedProjects
.
length
-
1
);
removeLocalstorageFrequentItems
();
...
...
ee/spec/frontend/related_items_tree/components/epic_health_status_spec.js
View file @
665d5bea
...
...
@@ -49,7 +49,7 @@ describe('EpicHealthStatus', () => {
});
it
(
'
renders tooltip
'
,
()
=>
{
const
tooltip
=
wrapper
.
find
(
GlTooltip
);
const
tooltip
=
wrapper
.
find
Component
(
GlTooltip
);
expect
(
tooltip
.
exists
()).
toBe
(
true
);
});
...
...
ee/spec/frontend/related_items_tree/components/related_items_tree_app_spec.js
View file @
665d5bea
...
...
@@ -41,8 +41,8 @@ describe('RelatedItemsTreeApp', () => {
let
axiosMock
;
let
wrapper
;
const
findCreateIssueForm
=
()
=>
wrapper
.
find
(
CreateIssueForm
);
const
findAddItemForm
=
()
=>
wrapper
.
find
(
AddIssuableForm
);
const
findCreateIssueForm
=
()
=>
wrapper
.
find
Component
(
CreateIssueForm
);
const
findAddItemForm
=
()
=>
wrapper
.
find
Component
(
AddIssuableForm
);
beforeEach
(()
=>
{
axiosMock
=
new
AxiosMockAdapter
(
axios
);
...
...
@@ -209,7 +209,7 @@ describe('RelatedItemsTreeApp', () => {
});
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
find
(
GlLoadingIcon
).
isVisible
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
GlLoadingIcon
).
isVisible
()).
toBe
(
true
);
});
});
...
...
@@ -228,7 +228,7 @@ describe('RelatedItemsTreeApp', () => {
it
(
'
renders tree header component
'
,
()
=>
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
find
(
RelatedItemsTreeHeader
).
isVisible
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
RelatedItemsTreeHeader
).
isVisible
()).
toBe
(
true
);
}));
it
(
'
renders item add/create form container element
'
,
()
=>
{
...
...
ee/spec/frontend/related_items_tree/components/related_items_tree_header_spec.js
View file @
665d5bea
...
...
@@ -47,7 +47,7 @@ describe('RelatedItemsTree', () => {
describe
(
'
RelatedItemsTreeHeader
'
,
()
=>
{
let
wrapper
;
const
findEpicsIssuesSplitButton
=
()
=>
wrapper
.
find
(
EpicActionsSplitButton
);
const
findEpicsIssuesSplitButton
=
()
=>
wrapper
.
find
Component
(
EpicActionsSplitButton
);
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
@@ -59,12 +59,12 @@ describe('RelatedItemsTree', () => {
});
it
(
'
returns string containing epic count based on available direct children within state
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlTooltip
).
text
()).
toContain
(
`Epics •
expect
(
wrapper
.
find
Component
(
GlTooltip
).
text
()).
toContain
(
`Epics •
1 open, 1 closed`
);
});
it
(
'
returns string containing issue count based on available direct children within state
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlTooltip
).
text
()).
toContain
(
`Issues •
expect
(
wrapper
.
find
Component
(
GlTooltip
).
text
()).
toContain
(
`Issues •
2 open, 1 closed`
);
});
});
...
...
@@ -85,7 +85,7 @@ describe('RelatedItemsTree', () => {
});
it
(
'
toggle labels component is visible
'
,
()
=>
{
expect
(
wrapper
.
find
(
ToggleLabels
).
isVisible
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
ToggleLabels
).
isVisible
()).
toBe
(
true
);
});
});
...
...
@@ -211,7 +211,7 @@ describe('RelatedItemsTree', () => {
it
(
'
renders epics count and gl-icon
'
,
()
=>
{
const
epicsEl
=
wrapper
.
findAll
(
'
.issue-count-badge > span
'
).
at
(
0
);
const
epicIcon
=
epicsEl
.
find
(
GlIcon
);
const
epicIcon
=
epicsEl
.
find
Component
(
GlIcon
);
expect
(
epicsEl
.
text
().
trim
()).
toContain
(
'
2
'
);
expect
(
epicIcon
.
isVisible
()).
toBe
(
true
);
...
...
@@ -233,7 +233,7 @@ describe('RelatedItemsTree', () => {
});
it
(
'
does not render health status
'
,
()
=>
{
expect
(
wrapper
.
find
(
EpicHealthStatus
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
EpicHealthStatus
).
exists
()).
toBe
(
false
);
});
});
...
...
@@ -248,13 +248,13 @@ describe('RelatedItemsTree', () => {
});
it
(
'
does not render health status
'
,
()
=>
{
expect
(
wrapper
.
find
(
EpicHealthStatus
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
EpicHealthStatus
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders issues count and gl-icon
'
,
()
=>
{
const
issuesEl
=
wrapper
.
findAll
(
'
.issue-count-badge > span
'
).
at
(
1
);
const
issueIcon
=
issuesEl
.
find
(
GlIcon
);
const
issueIcon
=
issuesEl
.
find
Component
(
GlIcon
);
expect
(
issuesEl
.
text
().
trim
()).
toContain
(
'
3
'
);
expect
(
issueIcon
.
isVisible
()).
toBe
(
true
);
...
...
@@ -263,7 +263,7 @@ describe('RelatedItemsTree', () => {
it
(
'
renders totalWeight count and gl-icon
'
,
()
=>
{
const
weightEl
=
wrapper
.
findAll
(
'
.issue-count-badge > span
'
).
at
(
2
);
const
weightIcon
=
weightEl
.
find
(
GlIcon
);
const
weightIcon
=
weightEl
.
find
Component
(
GlIcon
);
expect
(
weightEl
.
text
().
trim
()).
toContain
(
'
15
'
);
expect
(
weightIcon
.
isVisible
()).
toBe
(
true
);
...
...
ee/spec/frontend/related_items_tree/components/state_tooltip_spec.js
View file @
665d5bea
...
...
@@ -154,15 +154,15 @@ describe('RelatedItemsTree', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
renders gl-tooltip as container element
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlTooltip
).
isVisible
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
GlTooltip
).
isVisible
()).
toBe
(
true
);
});
it
(
'
renders path in bold
'
,
()
=>
{
expect
(
wrapper
.
find
({
ref
:
'
statePath
'
}).
text
().
trim
()).
toBe
(
'
/foo/bar#1
'
);
expect
(
wrapper
.
find
Component
({
ref
:
'
statePath
'
}).
text
().
trim
()).
toBe
(
'
/foo/bar#1
'
);
});
it
(
'
renders stateText in bold
'
,
()
=>
{
expect
(
wrapper
.
find
({
ref
:
'
stateText
'
}).
text
().
trim
()).
toBe
(
'
Closed
'
);
expect
(
wrapper
.
find
Component
({
ref
:
'
stateText
'
}).
text
().
trim
()).
toBe
(
'
Closed
'
);
});
it
(
'
renders stateTimeInWords
'
,
()
=>
{
...
...
@@ -170,7 +170,9 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders stateTimestamp in muted
'
,
()
=>
{
expect
(
wrapper
.
find
({
ref
:
'
stateTimestamp
'
}).
text
().
trim
()).
toContain
(
mockClosedAtYear
);
expect
(
wrapper
.
findComponent
({
ref
:
'
stateTimestamp
'
}).
text
().
trim
()).
toContain
(
mockClosedAtYear
,
);
});
});
});
...
...
ee/spec/frontend/related_items_tree/components/tree_item_body_spec.js
View file @
665d5bea
...
...
@@ -82,11 +82,11 @@ describe('RelatedItemsTree', () => {
describe
(
'
TreeItemBody
'
,
()
=>
{
let
wrapper
;
const
findChildLabels
=
()
=>
wrapper
.
findAll
(
GlLabel
);
const
findCountBadge
=
()
=>
wrapper
.
find
({
ref
:
'
countBadge
'
});
const
findChildLabels
=
()
=>
wrapper
.
findAll
Components
(
GlLabel
);
const
findCountBadge
=
()
=>
wrapper
.
find
Component
({
ref
:
'
countBadge
'
});
const
findEpicHealthStatus
=
()
=>
wrapper
.
find
(
'
[data-testid="epic-health-status"]
'
);
const
findIssueHealthStatus
=
()
=>
wrapper
.
find
(
'
[data-testid="issue-health-status"]
'
);
const
findIssueIcon
=
()
=>
wrapper
.
find
({
ref
:
'
stateIconMd
'
});
const
findIssueIcon
=
()
=>
wrapper
.
find
Component
({
ref
:
'
stateIconMd
'
});
const
findLink
=
()
=>
wrapper
.
findComponent
(
GlLink
);
const
enableHealthStatus
=
()
=>
{
wrapper
.
vm
.
$store
.
commit
(
'
SET_INITIAL_CONFIG
'
,
{
...
...
@@ -278,7 +278,7 @@ describe('RelatedItemsTree', () => {
describe
(
'
itemHierarchy
'
,
()
=>
{
it
(
'
returns string containing item id and item path
'
,
()
=>
{
const
stateTooltip
=
wrapper
.
findAll
(
StateTooltip
).
at
(
0
);
const
stateTooltip
=
wrapper
.
findAll
Components
(
StateTooltip
).
at
(
0
);
expect
(
stateTooltip
.
props
(
'
path
'
)).
toBe
(
'
gitlab-org/gitlab-shell#8
'
);
});
});
...
...
@@ -381,19 +381,19 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders item state icon for large screens
'
,
()
=>
{
const
statusIcon
=
wrapper
.
findAll
(
GlIcon
).
at
(
0
);
const
statusIcon
=
wrapper
.
findAll
Components
(
GlIcon
).
at
(
0
);
expect
(
statusIcon
.
props
(
'
name
'
)).
toBe
(
'
issues
'
);
});
it
(
'
renders item state tooltip for large screens
'
,
()
=>
{
const
stateTooltip
=
wrapper
.
findAll
(
StateTooltip
).
at
(
0
);
const
stateTooltip
=
wrapper
.
findAll
Components
(
StateTooltip
).
at
(
0
);
expect
(
stateTooltip
.
props
(
'
state
'
)).
toBe
(
mockItem
.
state
);
});
it
(
'
renders item path in tooltip for large screens
'
,
()
=>
{
const
stateTooltip
=
wrapper
.
findAll
(
StateTooltip
).
at
(
0
);
const
stateTooltip
=
wrapper
.
findAll
Components
(
StateTooltip
).
at
(
0
);
const
{
itemPath
,
itemId
}
=
wrapper
.
vm
;
const
path
=
itemPath
+
mockItem
.
pathIdSeparator
+
itemId
;
...
...
@@ -403,7 +403,7 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders confidential icon when `item.confidential` is true
'
,
()
=>
{
const
confidentialIcon
=
wrapper
.
findAll
(
GlIcon
).
at
(
1
);
const
confidentialIcon
=
wrapper
.
findAll
Components
(
GlIcon
).
at
(
1
);
expect
(
confidentialIcon
.
isVisible
()).
toBe
(
true
);
expect
(
confidentialIcon
.
props
(
'
name
'
)).
toBe
(
'
eye-slash
'
);
...
...
@@ -415,7 +415,7 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders item state tooltip for medium and small screens
'
,
()
=>
{
const
stateTooltip
=
wrapper
.
findAll
(
StateTooltip
).
at
(
0
);
const
stateTooltip
=
wrapper
.
findAll
Components
(
StateTooltip
).
at
(
0
);
expect
(
stateTooltip
.
props
(
'
state
'
)).
toBe
(
mockItem
.
state
);
});
...
...
ee/spec/frontend/related_items_tree/components/tree_item_remove_modal_spec.js
View file @
665d5bea
...
...
@@ -120,7 +120,7 @@ describe('RelatedItemsTree', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
renders modal component
'
,
()
=>
{
const
modal
=
wrapper
.
find
(
GlModal
);
const
modal
=
wrapper
.
find
Component
(
GlModal
);
expect
(
modal
.
isVisible
()).
toBe
(
true
);
expect
(
modal
.
attributes
(
'
modalid
'
)).
toBe
(
'
item-remove-confirmation
'
);
...
...
ee/spec/frontend/related_items_tree/components/tree_item_spec.js
View file @
665d5bea
...
...
@@ -132,21 +132,21 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders expand/collapse button
'
,
()
=>
{
const
chevronButton
=
wrapper
.
find
(
GlButton
);
const
chevronButton
=
wrapper
.
find
Component
(
GlButton
);
expect
(
chevronButton
.
isVisible
()).
toBe
(
true
);
expect
(
chevronButton
.
attributes
(
'
title
'
)).
toBe
(
'
Collapse
'
);
});
it
(
'
has the proper class on the expand/collapse button to avoid dragging
'
,
()
=>
{
const
chevronButton
=
wrapper
.
find
(
GlButton
);
const
chevronButton
=
wrapper
.
find
Component
(
GlButton
);
expect
(
chevronButton
.
attributes
(
'
class
'
)).
toContain
(
treeItemChevronBtnClassName
);
});
it
(
'
renders expand/collapse icon
'
,
()
=>
{
const
expandedIcon
=
wrapperExpanded
.
find
(
GlIcon
);
const
collapsedIcon
=
wrapperCollapsed
.
find
(
GlIcon
);
const
expandedIcon
=
wrapperExpanded
.
find
Component
(
GlIcon
);
const
collapsedIcon
=
wrapperCollapsed
.
find
Component
(
GlIcon
);
expect
(
expandedIcon
.
isVisible
()).
toBe
(
true
);
expect
(
expandedIcon
.
props
(
'
name
'
)).
toBe
(
'
chevron-down
'
);
...
...
@@ -161,14 +161,14 @@ describe('RelatedItemsTree', () => {
});
return
wrapper
.
vm
.
$nextTick
(()
=>
{
const
loadingIcon
=
wrapper
.
find
(
GlLoadingIcon
);
const
loadingIcon
=
wrapper
.
find
Component
(
GlLoadingIcon
);
expect
(
loadingIcon
.
isVisible
()).
toBe
(
true
);
});
});
it
(
'
renders tree item body component
'
,
()
=>
{
const
itemBody
=
wrapper
.
find
(
TreeItemBody
);
const
itemBody
=
wrapper
.
find
Component
(
TreeItemBody
);
expect
(
itemBody
.
isVisible
()).
toBe
(
true
);
});
...
...
ee/spec/frontend/related_items_tree/components/tree_root_spec.js
View file @
665d5bea
...
...
@@ -452,13 +452,13 @@ describe('RelatedItemsTree', () => {
});
it
(
'
renders `Show more` link
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlButton
).
text
()).
toBe
(
'
Show more
'
);
expect
(
wrapper
.
find
Component
(
GlButton
).
text
()).
toBe
(
'
Show more
'
);
});
it
(
'
calls `handleShowMoreClick` when `Show more` link is clicked
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
handleShowMoreClick
'
).
mockImplementation
(()
=>
{});
wrapper
.
find
(
GlButton
).
vm
.
$emit
(
'
click
'
);
wrapper
.
find
Component
(
GlButton
).
vm
.
$emit
(
'
click
'
);
expect
(
wrapper
.
vm
.
handleShowMoreClick
).
toHaveBeenCalled
();
});
...
...
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