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
9d868dbb
Commit
9d868dbb
authored
Jan 20, 2022
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace usage of find/findAll in misc ee components (1/5)
* migrate to proper use of findComponent/findAllComponents
parent
68755b38
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
71 additions
and
67 deletions
+71
-67
ee/spec/frontend/billings/components/account_verification_modal_spec.js
...nd/billings/components/account_verification_modal_spec.js
+1
-1
ee/spec/frontend/billings/qrtly_reconciliation/components/qrtly_reconciliation_alert_spec.js
...onciliation/components/qrtly_reconciliation_alert_spec.js
+1
-1
ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js
...s/subscriptions/components/subscription_table_row_spec.js
+2
-2
ee/spec/frontend/billings/subscriptions/components/subscription_table_spec.js
...lings/subscriptions/components/subscription_table_spec.js
+2
-2
ee/spec/frontend/billings/verification_reminder/components/verification_reminder_spec.js
...ication_reminder/components/verification_reminder_spec.js
+6
-6
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
...ec/frontend/burndown_chart/components/burn_charts_spec.js
+12
-10
ee/spec/frontend/burndown_chart/components/burndown_chart_spec.js
...frontend/burndown_chart/components/burndown_chart_spec.js
+1
-1
ee/spec/frontend/burndown_chart/components/burnup_chart_spec.js
...c/frontend/burndown_chart/components/burnup_chart_spec.js
+1
-1
ee/spec/frontend/burndown_chart/components/timebox_summary_cards_spec.js
...d/burndown_chart/components/timebox_summary_cards_spec.js
+3
-3
ee/spec/frontend/clusters/components/environments_spec.js
ee/spec/frontend/clusters/components/environments_spec.js
+4
-4
ee/spec/frontend/codequality_report/codequality_report_graphql_spec.js
...end/codequality_report/codequality_report_graphql_spec.js
+1
-1
ee/spec/frontend/diffs/components/code_quality_gutter_icon_spec.js
...rontend/diffs/components/code_quality_gutter_icon_spec.js
+1
-1
ee/spec/frontend/diffs/components/diff_line_note_form_spec.js
...pec/frontend/diffs/components/diff_line_note_form_spec.js
+1
-1
ee/spec/frontend/environments/environment_alert_spec.js
ee/spec/frontend/environments/environment_alert_spec.js
+1
-1
ee/spec/frontend/environments/environments_app_spec.js
ee/spec/frontend/environments/environments_app_spec.js
+1
-1
ee/spec/frontend/environments/environments_table_spec.js
ee/spec/frontend/environments/environments_table_spec.js
+1
-1
ee/spec/frontend/environments_dashboard/components/dashboard_spec.js
...ntend/environments_dashboard/components/dashboard_spec.js
+15
-15
ee/spec/frontend/environments_dashboard/components/environment_header_spec.js
...ironments_dashboard/components/environment_header_spec.js
+8
-6
ee/spec/frontend/environments_dashboard/components/environment_spec.js
...end/environments_dashboard/components/environment_spec.js
+3
-3
ee/spec/frontend/environments_dashboard/components/project_header_spec.js
.../environments_dashboard/components/project_header_spec.js
+6
-6
No files found.
ee/spec/frontend/billings/components/account_verification_modal_spec.js
View file @
9d868dbb
...
@@ -17,7 +17,7 @@ describe('Account verification modal', () => {
...
@@ -17,7 +17,7 @@ describe('Account verification modal', () => {
});
});
};
};
const
findModal
=
()
=>
wrapper
.
find
({
ref
:
'
modal
'
});
const
findModal
=
()
=>
wrapper
.
find
Component
({
ref
:
'
modal
'
});
const
zuoraSubmitSpy
=
jest
.
fn
();
const
zuoraSubmitSpy
=
jest
.
fn
();
...
...
ee/spec/frontend/billings/qrtly_reconciliation/components/qrtly_reconciliation_alert_spec.js
View file @
9d868dbb
...
@@ -22,7 +22,7 @@ describe('Qrtly Reconciliation Alert', () => {
...
@@ -22,7 +22,7 @@ describe('Qrtly Reconciliation Alert', () => {
});
});
};
};
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findAlert
=
()
=>
wrapper
.
find
Component
(
GlAlert
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
...
ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js
View file @
9d868dbb
...
@@ -64,7 +64,7 @@ describe('subscription table row', () => {
...
@@ -64,7 +64,7 @@ describe('subscription table row', () => {
const
findHeaderCell
=
()
=>
wrapper
.
find
(
'
[data-testid="header-cell"]
'
);
const
findHeaderCell
=
()
=>
wrapper
.
find
(
'
[data-testid="header-cell"]
'
);
const
findContentCells
=
()
=>
wrapper
.
findAll
(
'
[data-testid="content-cell"]
'
);
const
findContentCells
=
()
=>
wrapper
.
findAll
(
'
[data-testid="content-cell"]
'
);
const
findHeaderIcon
=
()
=>
findHeaderCell
().
find
(
GlIcon
);
const
findHeaderIcon
=
()
=>
findHeaderCell
().
find
Component
(
GlIcon
);
const
findColumnLabelAndTitle
=
(
columnWrapper
)
=>
{
const
findColumnLabelAndTitle
=
(
columnWrapper
)
=>
{
const
label
=
columnWrapper
.
find
(
'
[data-testid="property-label"]
'
);
const
label
=
columnWrapper
.
find
(
'
[data-testid="property-label"]
'
);
...
@@ -121,7 +121,7 @@ describe('subscription table row', () => {
...
@@ -121,7 +121,7 @@ describe('subscription table row', () => {
it
(
'
should render an info icon in "Column B"
'
,
()
=>
{
it
(
'
should render an info icon in "Column B"
'
,
()
=>
{
const
currentCol
=
findContentCells
().
at
(
1
);
const
currentCol
=
findContentCells
().
at
(
1
);
expect
(
currentCol
.
find
(
Popover
).
exists
()).
toBe
(
true
);
expect
(
currentCol
.
find
Component
(
Popover
).
exists
()).
toBe
(
true
);
});
});
});
});
...
...
ee/spec/frontend/billings/subscriptions/components/subscription_table_spec.js
View file @
9d868dbb
...
@@ -69,7 +69,7 @@ describe('SubscriptionTable component', () => {
...
@@ -69,7 +69,7 @@ describe('SubscriptionTable component', () => {
});
});
it
(
'
shows loading icon
'
,
()
=>
{
it
(
'
shows loading icon
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlLoadingIcon
).
isVisible
()).
toBeTruthy
();
expect
(
wrapper
.
find
Component
(
GlLoadingIcon
).
isVisible
()).
toBeTruthy
();
});
});
it
(
'
dispatches the correct actions
'
,
()
=>
{
it
(
'
dispatches the correct actions
'
,
()
=>
{
...
@@ -90,7 +90,7 @@ describe('SubscriptionTable component', () => {
...
@@ -90,7 +90,7 @@ describe('SubscriptionTable component', () => {
});
});
it
(
'
should render a "Usage" and a "Billing" row
'
,
()
=>
{
it
(
'
should render a "Usage" and a "Billing" row
'
,
()
=>
{
expect
(
wrapper
.
findAll
(
SubscriptionTableRow
)).
toHaveLength
(
2
);
expect
(
wrapper
.
findAll
Components
(
SubscriptionTableRow
)).
toHaveLength
(
2
);
});
});
});
});
...
...
ee/spec/frontend/billings/verification_reminder/components/verification_reminder_spec.js
View file @
9d868dbb
...
@@ -31,12 +31,12 @@ describe('VerificationReminder', () => {
...
@@ -31,12 +31,12 @@ describe('VerificationReminder', () => {
});
});
};
};
const
findVerificationModal
=
()
=>
wrapper
.
find
({
ref
:
'
modal
'
});
const
findVerificationModal
=
()
=>
wrapper
.
find
Component
({
ref
:
'
modal
'
});
const
calloutDismisser
=
()
=>
wrapper
.
find
({
ref
:
'
calloutDismisser
'
});
const
calloutDismisser
=
()
=>
wrapper
.
find
Component
({
ref
:
'
calloutDismisser
'
});
const
findWarningAlert
=
()
=>
wrapper
.
find
({
ref
:
'
warningAlert
'
});
const
findWarningAlert
=
()
=>
wrapper
.
find
Component
({
ref
:
'
warningAlert
'
});
const
findSuccessAlert
=
()
=>
wrapper
.
find
({
ref
:
'
successAlert
'
});
const
findSuccessAlert
=
()
=>
wrapper
.
find
Component
({
ref
:
'
successAlert
'
});
const
findValidateLink
=
()
=>
wrapper
.
find
({
ref
:
'
validateLink
'
});
const
findValidateLink
=
()
=>
wrapper
.
find
Component
({
ref
:
'
validateLink
'
});
const
findDocsLink
=
()
=>
wrapper
.
find
({
ref
:
'
docsLink
'
});
const
findDocsLink
=
()
=>
wrapper
.
find
Component
({
ref
:
'
docsLink
'
});
beforeEach
(()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
window
.
gon
=
{
...
...
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
View file @
9d868dbb
...
@@ -20,15 +20,17 @@ describe('burndown_chart', () => {
...
@@ -20,15 +20,17 @@ describe('burndown_chart', () => {
let
wrapper
;
let
wrapper
;
let
mock
;
let
mock
;
const
findFilterLabel
=
()
=>
wrapper
.
find
({
ref
:
'
filterLabel
'
});
const
findFilterLabel
=
()
=>
wrapper
.
find
Component
({
ref
:
'
filterLabel
'
});
const
findIssuesButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalIssuesButton
'
});
const
findIssuesButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
totalIssuesButton
'
});
const
findWeightButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalWeightButton
'
});
const
findWeightButton
=
()
=>
wrapper
.
find
Component
({
ref
:
'
totalWeightButton
'
});
const
findActiveButtons
=
()
=>
const
findActiveButtons
=
()
=>
wrapper
.
findAll
(
GlButton
).
filter
((
button
)
=>
button
.
attributes
().
category
===
'
primary
'
);
wrapper
const
findBurndownChart
=
()
=>
wrapper
.
find
(
BurndownChart
);
.
findAllComponents
(
GlButton
)
const
findBurnupChart
=
()
=>
wrapper
.
find
(
BurnupChart
);
.
filter
((
button
)
=>
button
.
attributes
().
category
===
'
primary
'
);
const
findOldBurndownChartButton
=
()
=>
wrapper
.
find
({
ref
:
'
oldBurndown
'
});
const
findBurndownChart
=
()
=>
wrapper
.
findComponent
(
BurndownChart
);
const
findNewBurndownChartButton
=
()
=>
wrapper
.
find
({
ref
:
'
newBurndown
'
});
const
findBurnupChart
=
()
=>
wrapper
.
findComponent
(
BurnupChart
);
const
findOldBurndownChartButton
=
()
=>
wrapper
.
findComponent
({
ref
:
'
oldBurndown
'
});
const
findNewBurndownChartButton
=
()
=>
wrapper
.
findComponent
({
ref
:
'
newBurndown
'
});
const
defaultProps
=
{
const
defaultProps
=
{
fullPath
:
'
gitlab-org/subgroup
'
,
fullPath
:
'
gitlab-org/subgroup
'
,
...
@@ -146,7 +148,7 @@ describe('burndown_chart', () => {
...
@@ -146,7 +148,7 @@ describe('burndown_chart', () => {
},
},
});
});
expect
(
wrapper
.
find
(
OpenTimeboxSummary
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
OpenTimeboxSummary
).
props
()).
toEqual
({
iterationId
:
'
gid://gitlab/Iteration/11
'
,
iterationId
:
'
gid://gitlab/Iteration/11
'
,
displayValue
:
'
count
'
,
displayValue
:
'
count
'
,
namespaceType
:
'
group
'
,
namespaceType
:
'
group
'
,
...
@@ -167,7 +169,7 @@ describe('burndown_chart', () => {
...
@@ -167,7 +169,7 @@ describe('burndown_chart', () => {
},
},
});
});
expect
(
wrapper
.
find
(
TimeboxSummaryCards
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
TimeboxSummaryCards
).
exists
()).
toBe
(
true
);
});
});
it
(
'
uses burndown data computed from burnup data
'
,
()
=>
{
it
(
'
uses burndown data computed from burnup data
'
,
()
=>
{
...
...
ee/spec/frontend/burndown_chart/components/burndown_chart_spec.js
View file @
9d868dbb
...
@@ -12,7 +12,7 @@ describe('burndown_chart', () => {
...
@@ -12,7 +12,7 @@ describe('burndown_chart', () => {
openIssuesWeight
:
[],
openIssuesWeight
:
[],
};
};
const
findChart
=
()
=>
wrapper
.
find
(
GlLineChart
);
const
findChart
=
()
=>
wrapper
.
find
Component
(
GlLineChart
);
const
createComponent
=
(
props
=
{})
=>
{
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
BurndownChart
,
{
wrapper
=
shallowMount
(
BurndownChart
,
{
...
...
ee/spec/frontend/burndown_chart/components/burnup_chart_spec.js
View file @
9d868dbb
...
@@ -11,7 +11,7 @@ describe('Burnup chart', () => {
...
@@ -11,7 +11,7 @@ describe('Burnup chart', () => {
dueDate
:
'
2019-09-09T00:00:00.000Z
'
,
dueDate
:
'
2019-09-09T00:00:00.000Z
'
,
};
};
const
findChart
=
()
=>
wrapper
.
find
(
GlLineChart
);
const
findChart
=
()
=>
wrapper
.
find
Component
(
GlLineChart
);
const
createComponent
=
(
props
=
{})
=>
{
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
BurnupChart
,
{
wrapper
=
shallowMount
(
BurnupChart
,
{
...
...
ee/spec/frontend/burndown_chart/components/timebox_summary_cards_spec.js
View file @
9d868dbb
...
@@ -34,9 +34,9 @@ describe('Iterations report summary cards', () => {
...
@@ -34,9 +34,9 @@ describe('Iterations report summary cards', () => {
wrapper
=
null
;
wrapper
=
null
;
});
});
const
findCompleteCard
=
()
=>
wrapper
.
findAll
(
GlCard
).
at
(
0
).
text
();
const
findCompleteCard
=
()
=>
wrapper
.
findAll
Components
(
GlCard
).
at
(
0
).
text
();
const
findIncompleteCard
=
()
=>
wrapper
.
findAll
(
GlCard
).
at
(
1
).
text
();
const
findIncompleteCard
=
()
=>
wrapper
.
findAll
Components
(
GlCard
).
at
(
1
).
text
();
const
findUnstartedCard
=
()
=>
wrapper
.
findAll
(
GlCard
).
at
(
2
).
text
();
const
findUnstartedCard
=
()
=>
wrapper
.
findAll
Components
(
GlCard
).
at
(
2
).
text
();
describe
(
'
with valid totals
'
,
()
=>
{
describe
(
'
with valid totals
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
ee/spec/frontend/clusters/components/environments_spec.js
View file @
9d868dbb
...
@@ -26,7 +26,7 @@ describe('Environments', () => {
...
@@ -26,7 +26,7 @@ describe('Environments', () => {
});
});
it
(
'
renders an empty state if no deployments are found
'
,
()
=>
{
it
(
'
renders an empty state if no deployments are found
'
,
()
=>
{
const
emptyState
=
wrapper
.
find
(
GlEmptyState
);
const
emptyState
=
wrapper
.
find
Component
(
GlEmptyState
);
const
emptyStateText
=
emptyState
.
text
().
replace
(
/
\s
+/g
,
'
'
);
const
emptyStateText
=
emptyState
.
text
().
replace
(
/
\s
+/g
,
'
'
);
expect
(
emptyState
.
exists
()).
toBe
(
true
);
expect
(
emptyState
.
exists
()).
toBe
(
true
);
...
@@ -45,7 +45,7 @@ describe('Environments', () => {
...
@@ -45,7 +45,7 @@ describe('Environments', () => {
stubs
:
{
deploymentInstance
:
{
template
:
'
<div class="js-deployment-instance"></div>
'
}
},
stubs
:
{
deploymentInstance
:
{
template
:
'
<div class="js-deployment-instance"></div>
'
}
},
});
});
table
=
wrapper
.
find
(
GlTable
);
table
=
wrapper
.
find
Component
(
GlTable
);
});
});
it
(
'
renders a table component
'
,
()
=>
{
it
(
'
renders a table component
'
,
()
=>
{
...
@@ -77,7 +77,7 @@ describe('Environments', () => {
...
@@ -77,7 +77,7 @@ describe('Environments', () => {
const
{
status
}
=
environment
.
rolloutStatus
;
const
{
status
}
=
environment
.
rolloutStatus
;
if
(
status
===
'
loading
'
)
{
if
(
status
===
'
loading
'
)
{
const
loader
=
tableRows
.
at
(
i
).
find
(
GlLoadingIcon
);
const
loader
=
tableRows
.
at
(
i
).
find
Component
(
GlLoadingIcon
);
expect
(
loader
.
exists
()).
toBe
(
true
);
expect
(
loader
.
exists
()).
toBe
(
true
);
}
}
...
@@ -101,7 +101,7 @@ describe('Environments', () => {
...
@@ -101,7 +101,7 @@ describe('Environments', () => {
if
(
status
!==
'
loading
'
&&
instances
.
length
===
0
)
{
if
(
status
!==
'
loading
'
&&
instances
.
length
===
0
)
{
const
emptyState
=
tableRows
.
at
(
i
).
find
(
'
.deployments-empty
'
);
const
emptyState
=
tableRows
.
at
(
i
).
find
(
'
.deployments-empty
'
);
const
emptyStateIcon
=
emptyState
.
find
(
GlIcon
);
const
emptyStateIcon
=
emptyState
.
find
Component
(
GlIcon
);
expect
(
emptyState
.
exists
()).
toBe
(
true
);
expect
(
emptyState
.
exists
()).
toBe
(
true
);
expect
(
emptyStateIcon
.
exists
()).
toBe
(
true
);
expect
(
emptyStateIcon
.
exists
()).
toBe
(
true
);
...
...
ee/spec/frontend/codequality_report/codequality_report_graphql_spec.js
View file @
9d868dbb
...
@@ -33,7 +33,7 @@ describe('Codequality report app', () => {
...
@@ -33,7 +33,7 @@ describe('Codequality report app', () => {
const
findStatus
=
()
=>
wrapper
.
find
(
'
.js-code-text
'
);
const
findStatus
=
()
=>
wrapper
.
find
(
'
.js-code-text
'
);
const
findSuccessIcon
=
()
=>
wrapper
.
find
(
'
.js-ci-status-icon-success
'
);
const
findSuccessIcon
=
()
=>
wrapper
.
find
(
'
.js-ci-status-icon-success
'
);
const
findWarningIcon
=
()
=>
wrapper
.
find
(
'
.js-ci-status-icon-warning
'
);
const
findWarningIcon
=
()
=>
wrapper
.
find
(
'
.js-ci-status-icon-warning
'
);
const
findInfiniteScroll
=
()
=>
wrapper
.
find
(
GlInfiniteScroll
);
const
findInfiniteScroll
=
()
=>
wrapper
.
find
Component
(
GlInfiniteScroll
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
...
ee/spec/frontend/diffs/components/code_quality_gutter_icon_spec.js
View file @
9d868dbb
...
@@ -78,7 +78,7 @@ describe('EE CodeQualityGutterIcon', () => {
...
@@ -78,7 +78,7 @@ describe('EE CodeQualityGutterIcon', () => {
wrapper
.
findComponent
(
GlIcon
).
trigger
(
'
mouseover
'
);
wrapper
.
findComponent
(
GlIcon
).
trigger
(
'
mouseover
'
);
expect
(
wrapper
.
find
(
GlPopover
).
props
().
target
).
toBe
(
popoverTarget
);
expect
(
wrapper
.
find
Component
(
GlPopover
).
props
().
target
).
toBe
(
popoverTarget
);
});
});
it
(
'
passes the issue data into the issue components correctly
'
,
()
=>
{
it
(
'
passes the issue data into the issue components correctly
'
,
()
=>
{
...
...
ee/spec/frontend/diffs/components/diff_line_note_form_spec.js
View file @
9d868dbb
...
@@ -80,7 +80,7 @@ describe('EE DiffLineNoteForm', () => {
...
@@ -80,7 +80,7 @@ describe('EE DiffLineNoteForm', () => {
});
});
const
submitNoteAddToReview
=
()
=>
const
submitNoteAddToReview
=
()
=>
wrapper
.
find
(
NoteForm
).
vm
.
$emit
(
'
handleFormUpdateAddToReview
'
,
note
);
wrapper
.
find
Component
(
NoteForm
).
vm
.
$emit
(
'
handleFormUpdateAddToReview
'
,
note
);
const
saveDraftCommitId
=
()
=>
saveDraft
.
mock
.
calls
[
0
][
1
].
data
.
note
.
commit_id
;
const
saveDraftCommitId
=
()
=>
saveDraft
.
mock
.
calls
[
0
][
1
].
data
.
note
.
commit_id
;
describe
(
'
when user submits note to review
'
,
()
=>
{
describe
(
'
when user submits note to review
'
,
()
=>
{
...
...
ee/spec/frontend/environments/environment_alert_spec.js
View file @
9d868dbb
...
@@ -20,7 +20,7 @@ describe('Environment Alert', () => {
...
@@ -20,7 +20,7 @@ describe('Environment Alert', () => {
});
});
};
};
const
findSeverityBadge
=
()
=>
wrapper
.
find
(
SeverityBadge
);
const
findSeverityBadge
=
()
=>
wrapper
.
find
Component
(
SeverityBadge
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
factory
();
factory
();
...
...
ee/spec/frontend/environments/environments_app_spec.js
View file @
9d868dbb
...
@@ -72,7 +72,7 @@ describe('Environment', () => {
...
@@ -72,7 +72,7 @@ describe('Environment', () => {
});
});
it
(
'
should render deploy boards
'
,
()
=>
{
it
(
'
should render deploy boards
'
,
()
=>
{
expect
(
wrapper
.
find
(
DeployBoard
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
DeployBoard
).
exists
()).
toBe
(
true
);
});
});
it
(
'
should render arrow to open deploy boards
'
,
()
=>
{
it
(
'
should render arrow to open deploy boards
'
,
()
=>
{
...
...
ee/spec/frontend/environments/environments_table_spec.js
View file @
9d868dbb
...
@@ -44,6 +44,6 @@ describe('Environment table', () => {
...
@@ -44,6 +44,6 @@ describe('Environment table', () => {
shallowMount
,
shallowMount
,
);
);
expect
(
wrapper
.
find
(
EnvironmentAlert
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
EnvironmentAlert
).
exists
()).
toBe
(
true
);
});
});
});
});
ee/spec/frontend/environments_dashboard/components/dashboard_spec.js
View file @
9d868dbb
...
@@ -61,7 +61,7 @@ describe('dashboard', () => {
...
@@ -61,7 +61,7 @@ describe('dashboard', () => {
store
.
replaceState
(
state
());
store
.
replaceState
(
state
());
});
});
const
findPagination
=
()
=>
wrapper
.
find
(
GlPagination
);
const
findPagination
=
()
=>
wrapper
.
find
Component
(
GlPagination
);
it
(
'
should match the snapshot
'
,
()
=>
{
it
(
'
should match the snapshot
'
,
()
=>
{
expect
(
wrapper
.
element
).
toMatchSnapshot
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
...
@@ -72,7 +72,7 @@ describe('dashboard', () => {
...
@@ -72,7 +72,7 @@ describe('dashboard', () => {
});
});
it
(
'
should render the empty state component
'
,
()
=>
{
it
(
'
should render the empty state component
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlEmptyState
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
GlEmptyState
).
exists
()).
toBe
(
true
);
});
});
it
(
'
should not render pagination in empty state
'
,
()
=>
{
it
(
'
should not render pagination in empty state
'
,
()
=>
{
...
@@ -93,7 +93,7 @@ describe('dashboard', () => {
...
@@ -93,7 +93,7 @@ describe('dashboard', () => {
});
});
it
(
'
includes the correct documentation link in the message
'
,
()
=>
{
it
(
'
includes the correct documentation link in the message
'
,
()
=>
{
const
helpLink
=
message
.
find
(
GlLink
);
const
helpLink
=
message
.
find
Component
(
GlLink
);
expect
(
helpLink
.
text
()).
toBe
(
'
More information
'
);
expect
(
helpLink
.
text
()).
toBe
(
'
More information
'
);
expect
(
helpLink
.
attributes
(
'
href
'
)).
toBe
(
propsData
.
environmentsDashboardHelpPath
);
expect
(
helpLink
.
attributes
(
'
href
'
)).
toBe
(
propsData
.
environmentsDashboardHelpPath
);
...
@@ -105,7 +105,7 @@ describe('dashboard', () => {
...
@@ -105,7 +105,7 @@ describe('dashboard', () => {
let
button
;
let
button
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
button
=
wrapper
.
find
(
GlButton
);
button
=
wrapper
.
find
Component
(
GlButton
);
});
});
it
(
'
is labelled correctly
'
,
()
=>
{
it
(
'
is labelled correctly
'
,
()
=>
{
...
@@ -128,12 +128,12 @@ describe('dashboard', () => {
...
@@ -128,12 +128,12 @@ describe('dashboard', () => {
describe
(
'
project header
'
,
()
=>
{
describe
(
'
project header
'
,
()
=>
{
it
(
'
should have one project header per project
'
,
()
=>
{
it
(
'
should have one project header per project
'
,
()
=>
{
const
headers
=
wrapper
.
findAll
(
ProjectHeader
);
const
headers
=
wrapper
.
findAll
Components
(
ProjectHeader
);
expect
(
headers
).
toHaveLength
(
2
);
expect
(
headers
).
toHaveLength
(
2
);
});
});
it
(
'
should remove a project if it emits `remove`
'
,
()
=>
{
it
(
'
should remove a project if it emits `remove`
'
,
()
=>
{
const
header
=
wrapper
.
find
(
ProjectHeader
);
const
header
=
wrapper
.
find
Component
(
ProjectHeader
);
header
.
vm
.
$emit
(
'
remove
'
);
header
.
vm
.
$emit
(
'
remove
'
);
expect
(
actionSpies
.
removeProject
).
toHaveBeenCalled
();
expect
(
actionSpies
.
removeProject
).
toHaveBeenCalled
();
});
});
...
@@ -141,39 +141,39 @@ describe('dashboard', () => {
...
@@ -141,39 +141,39 @@ describe('dashboard', () => {
describe
(
'
environment component
'
,
()
=>
{
describe
(
'
environment component
'
,
()
=>
{
it
(
'
should have one environment component per environment
'
,
()
=>
{
it
(
'
should have one environment component per environment
'
,
()
=>
{
const
environments
=
wrapper
.
findAll
(
Environment
);
const
environments
=
wrapper
.
findAll
Components
(
Environment
);
expect
(
environments
).
toHaveLength
(
3
);
expect
(
environments
).
toHaveLength
(
3
);
});
});
});
});
describe
(
'
project selector modal
'
,
()
=>
{
describe
(
'
project selector modal
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
.
find
(
GlButton
).
trigger
(
'
click
'
);
wrapper
.
find
Component
(
GlButton
).
trigger
(
'
click
'
);
return
nextTick
();
return
nextTick
();
});
});
it
(
'
should fire the add projects action on ok
'
,
()
=>
{
it
(
'
should fire the add projects action on ok
'
,
()
=>
{
wrapper
.
find
(
GlModal
).
vm
.
$emit
(
'
ok
'
);
wrapper
.
find
Component
(
GlModal
).
vm
.
$emit
(
'
ok
'
);
expect
(
actionSpies
.
addProjectsToDashboard
).
toHaveBeenCalled
();
expect
(
actionSpies
.
addProjectsToDashboard
).
toHaveBeenCalled
();
});
});
it
(
'
should fire clear search when the modal is hidden
'
,
()
=>
{
it
(
'
should fire clear search when the modal is hidden
'
,
()
=>
{
wrapper
.
find
(
GlModal
).
vm
.
$emit
(
'
hidden
'
);
wrapper
.
find
Component
(
GlModal
).
vm
.
$emit
(
'
hidden
'
);
expect
(
actionSpies
.
clearSearchResults
).
toHaveBeenCalled
();
expect
(
actionSpies
.
clearSearchResults
).
toHaveBeenCalled
();
});
});
it
(
'
should set the search query when searching
'
,
()
=>
{
it
(
'
should set the search query when searching
'
,
()
=>
{
wrapper
.
find
(
ProjectSelector
).
vm
.
$emit
(
'
searched
'
,
'
test
'
);
wrapper
.
find
Component
(
ProjectSelector
).
vm
.
$emit
(
'
searched
'
,
'
test
'
);
expect
(
actionSpies
.
setSearchQuery
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
'
test
'
);
expect
(
actionSpies
.
setSearchQuery
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
'
test
'
);
});
});
it
(
'
should fetch query results when searching
'
,
()
=>
{
it
(
'
should fetch query results when searching
'
,
()
=>
{
wrapper
.
find
(
ProjectSelector
).
vm
.
$emit
(
'
searched
'
,
'
test
'
);
wrapper
.
find
Component
(
ProjectSelector
).
vm
.
$emit
(
'
searched
'
,
'
test
'
);
expect
(
actionSpies
.
fetchSearchResults
).
toHaveBeenCalled
();
expect
(
actionSpies
.
fetchSearchResults
).
toHaveBeenCalled
();
});
});
it
(
'
should toggle a project when clicked
'
,
()
=>
{
it
(
'
should toggle a project when clicked
'
,
()
=>
{
wrapper
.
find
(
ProjectSelector
).
vm
.
$emit
(
'
projectClicked
'
,
{
name
:
'
test
'
,
id
:
1
});
wrapper
.
find
Component
(
ProjectSelector
).
vm
.
$emit
(
'
projectClicked
'
,
{
name
:
'
test
'
,
id
:
1
});
expect
(
actionSpies
.
toggleSelectedProject
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
{
expect
(
actionSpies
.
toggleSelectedProject
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
{
name
:
'
test
'
,
name
:
'
test
'
,
id
:
1
,
id
:
1
,
...
@@ -181,7 +181,7 @@ describe('dashboard', () => {
...
@@ -181,7 +181,7 @@ describe('dashboard', () => {
});
});
it
(
'
should fetch the next page when bottom is reached
'
,
()
=>
{
it
(
'
should fetch the next page when bottom is reached
'
,
()
=>
{
wrapper
.
find
(
ProjectSelector
).
vm
.
$emit
(
'
bottomReached
'
);
wrapper
.
find
Component
(
ProjectSelector
).
vm
.
$emit
(
'
bottomReached
'
);
expect
(
actionSpies
.
fetchNextPage
).
toHaveBeenCalled
();
expect
(
actionSpies
.
fetchNextPage
).
toHaveBeenCalled
();
});
});
...
@@ -189,7 +189,7 @@ describe('dashboard', () => {
...
@@ -189,7 +189,7 @@ describe('dashboard', () => {
store
.
state
.
pageInfo
=
{
totalResults
:
100
};
store
.
state
.
pageInfo
=
{
totalResults
:
100
};
await
nextTick
();
await
nextTick
();
expect
(
wrapper
.
find
(
ProjectSelector
).
props
(
'
totalResults
'
)).
toBe
(
100
);
expect
(
wrapper
.
find
Component
(
ProjectSelector
).
props
(
'
totalResults
'
)).
toBe
(
100
);
});
});
});
});
...
...
ee/spec/frontend/environments_dashboard/components/environment_header_spec.js
View file @
9d868dbb
...
@@ -33,15 +33,17 @@ describe('Environment Header', () => {
...
@@ -33,15 +33,17 @@ describe('Environment Header', () => {
});
});
it
(
'
renders a link to the environment page
'
,
()
=>
{
it
(
'
renders a link to the environment page
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlLink
).
attributes
(
'
href
'
)).
toBe
(
propsData
.
environment
.
environment_path
);
expect
(
wrapper
.
findComponent
(
GlLink
).
attributes
(
'
href
'
)).
toBe
(
propsData
.
environment
.
environment_path
,
);
});
});
it
(
'
does not show a badge with the number of environments in the folder
'
,
()
=>
{
it
(
'
does not show a badge with the number of environments in the folder
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlBadge
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
GlBadge
).
exists
()).
toBe
(
false
);
});
});
it
(
'
renders a link to the external app
'
,
()
=>
{
it
(
'
renders a link to the external app
'
,
()
=>
{
expect
(
wrapper
.
find
(
ReviewAppLink
).
attributes
(
'
href
'
)).
toBe
(
expect
(
wrapper
.
find
Component
(
ReviewAppLink
).
attributes
(
'
href
'
)).
toBe
(
propsData
.
environment
.
external_url
,
propsData
.
environment
.
external_url
,
);
);
});
});
...
@@ -64,12 +66,12 @@ describe('Environment Header', () => {
...
@@ -64,12 +66,12 @@ describe('Environment Header', () => {
it
(
'
shows a badge with the number of other environments in the folder
'
,
()
=>
{
it
(
'
shows a badge with the number of other environments in the folder
'
,
()
=>
{
const
expected
=
propsData
.
environment
.
size
.
toString
();
const
expected
=
propsData
.
environment
.
size
.
toString
();
expect
(
wrapper
.
find
(
GlBadge
).
text
()).
toBe
(
expected
);
expect
(
wrapper
.
find
Component
(
GlBadge
).
text
()).
toBe
(
expected
);
});
});
it
(
'
shows an icon stating the environment is one of many in a folder
'
,
()
=>
{
it
(
'
shows an icon stating the environment is one of many in a folder
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlIcon
).
attributes
(
'
name
'
)).
toBe
(
'
information
'
);
expect
(
wrapper
.
find
Component
(
GlIcon
).
attributes
(
'
name
'
)).
toBe
(
'
information
'
);
expect
(
wrapper
.
find
(
GlIcon
).
attributes
(
'
title
'
)).
toMatch
(
/last updated environment/
);
expect
(
wrapper
.
find
Component
(
GlIcon
).
attributes
(
'
title
'
)).
toMatch
(
/last updated environment/
);
});
});
it
(
'
matches the snapshot
'
,
()
=>
{
it
(
'
matches the snapshot
'
,
()
=>
{
...
...
ee/spec/frontend/environments_dashboard/components/environment_spec.js
View file @
9d868dbb
...
@@ -29,14 +29,14 @@ describe('Environment', () => {
...
@@ -29,14 +29,14 @@ describe('Environment', () => {
describe
(
'
wrapped components
'
,
()
=>
{
describe
(
'
wrapped components
'
,
()
=>
{
describe
(
'
environment header
'
,
()
=>
{
describe
(
'
environment header
'
,
()
=>
{
it
(
'
binds environment
'
,
()
=>
{
it
(
'
binds environment
'
,
()
=>
{
expect
(
wrapper
.
find
(
EnvironmentHeader
).
props
(
'
environment
'
)).
toBe
(
environment
);
expect
(
wrapper
.
find
Component
(
EnvironmentHeader
).
props
(
'
environment
'
)).
toBe
(
environment
);
});
});
});
});
describe
(
'
alerts
'
,
()
=>
{
describe
(
'
alerts
'
,
()
=>
{
let
alert
;
let
alert
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
alert
=
wrapper
.
find
(
Alert
);
alert
=
wrapper
.
find
Component
(
Alert
);
});
});
it
(
'
binds alert count to count
'
,
()
=>
{
it
(
'
binds alert count to count
'
,
()
=>
{
expect
(
alert
.
props
(
'
count
'
)).
toBe
(
environment
.
alert_count
);
expect
(
alert
.
props
(
'
count
'
)).
toBe
(
environment
.
alert_count
);
...
@@ -49,7 +49,7 @@ describe('Environment', () => {
...
@@ -49,7 +49,7 @@ describe('Environment', () => {
let
commit
;
let
commit
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
commit
=
wrapper
.
find
(
Commit
);
commit
=
wrapper
.
find
Component
(
Commit
);
});
});
it
(
'
binds commitRef
'
,
()
=>
{
it
(
'
binds commitRef
'
,
()
=>
{
...
...
ee/spec/frontend/environments_dashboard/components/project_header_spec.js
View file @
9d868dbb
...
@@ -36,7 +36,7 @@ describe('Project Header', () => {
...
@@ -36,7 +36,7 @@ describe('Project Header', () => {
describe
(
'
renders project namespace, name, and avatars
'
,
()
=>
{
describe
(
'
renders project namespace, name, and avatars
'
,
()
=>
{
it
(
'
shows the project namespace avatar
'
,
()
=>
{
it
(
'
shows the project namespace avatar
'
,
()
=>
{
const
projectNamespaceAvatar
=
wrapper
.
findAll
(
ProjectAvatar
).
at
(
0
);
const
projectNamespaceAvatar
=
wrapper
.
findAll
Components
(
ProjectAvatar
).
at
(
0
);
expect
(
projectNamespaceAvatar
.
props
(
'
project
'
)).
toEqual
(
propsData
.
project
.
namespace
);
expect
(
projectNamespaceAvatar
.
props
(
'
project
'
)).
toEqual
(
propsData
.
project
.
namespace
);
});
});
...
@@ -50,7 +50,7 @@ describe('Project Header', () => {
...
@@ -50,7 +50,7 @@ describe('Project Header', () => {
});
});
it
(
'
shows the project avatar
'
,
()
=>
{
it
(
'
shows the project avatar
'
,
()
=>
{
const
projectAvatar
=
wrapper
.
findAll
(
ProjectAvatar
).
at
(
1
);
const
projectAvatar
=
wrapper
.
findAll
Components
(
ProjectAvatar
).
at
(
1
);
expect
(
projectAvatar
.
props
(
'
project
'
)).
toEqual
(
propsData
.
project
);
expect
(
projectAvatar
.
props
(
'
project
'
)).
toEqual
(
propsData
.
project
);
});
});
...
@@ -66,16 +66,16 @@ describe('Project Header', () => {
...
@@ -66,16 +66,16 @@ describe('Project Header', () => {
describe
(
'
more actions
'
,
()
=>
{
describe
(
'
more actions
'
,
()
=>
{
it
(
'
should list "remove" as an action
'
,
()
=>
{
it
(
'
should list "remove" as an action
'
,
()
=>
{
const
removeLink
=
wrapper
const
removeLink
=
wrapper
.
find
(
GlDropdown
)
.
find
Component
(
GlDropdown
)
.
findAll
(
GlDropdownItem
)
.
findAll
Components
(
GlDropdownItem
)
.
filter
((
w
)
=>
w
.
text
()
===
'
Remove
'
);
.
filter
((
w
)
=>
w
.
text
()
===
'
Remove
'
);
expect
(
removeLink
.
exists
()).
toBe
(
true
);
expect
(
removeLink
.
exists
()).
toBe
(
true
);
});
});
it
(
'
should emit a "remove" event when "remove" is clicked
'
,
()
=>
{
it
(
'
should emit a "remove" event when "remove" is clicked
'
,
()
=>
{
const
removeLink
=
wrapper
const
removeLink
=
wrapper
.
find
(
GlDropdown
)
.
find
Component
(
GlDropdown
)
.
findAll
(
GlDropdownItem
)
.
findAll
Components
(
GlDropdownItem
)
.
filter
((
w
)
=>
w
.
text
()
===
'
Remove
'
);
.
filter
((
w
)
=>
w
.
text
()
===
'
Remove
'
);
removeLink
.
at
(
0
).
vm
.
$emit
(
'
click
'
);
removeLink
.
at
(
0
).
vm
.
$emit
(
'
click
'
);
...
...
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