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
4ad3919b
Commit
4ad3919b
authored
Jan 20, 2022
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace usage of find/findAll in ee/spec/frontend/audit_events
* migrate to proper use of findComponent/findAllComponents
parent
68755b38
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
30 deletions
+36
-30
ee/spec/frontend/audit_events/components/audit_events_app_spec.js
...frontend/audit_events/components/audit_events_app_spec.js
+8
-8
ee/spec/frontend/audit_events/components/audit_events_export_button_spec.js
...udit_events/components/audit_events_export_button_spec.js
+1
-1
ee/spec/frontend/audit_events/components/audit_events_filter_spec.js
...ntend/audit_events/components/audit_events_filter_spec.js
+1
-1
ee/spec/frontend/audit_events/components/audit_events_table_spec.js
...ontend/audit_events/components/audit_events_table_spec.js
+15
-9
ee/spec/frontend/audit_events/components/date_range_field_spec.js
...frontend/audit_events/components/date_range_field_spec.js
+2
-2
ee/spec/frontend/audit_events/components/sorting_field_spec.js
...ec/frontend/audit_events/components/sorting_field_spec.js
+3
-3
ee/spec/frontend/audit_events/components/tokens/group_token_spec.js
...ontend/audit_events/components/tokens/group_token_spec.js
+1
-1
ee/spec/frontend/audit_events/components/tokens/member_token_spec.js
...ntend/audit_events/components/tokens/member_token_spec.js
+1
-1
ee/spec/frontend/audit_events/components/tokens/project_token_spec.js
...tend/audit_events/components/tokens/project_token_spec.js
+1
-1
ee/spec/frontend/audit_events/components/tokens/shared/audit_filter_token_spec.js
...vents/components/tokens/shared/audit_filter_token_spec.js
+2
-2
ee/spec/frontend/audit_events/components/tokens/user_token_spec.js
...rontend/audit_events/components/tokens/user_token_spec.js
+1
-1
No files found.
ee/spec/frontend/audit_events/components/audit_events_app_spec.js
View file @
4ad3919b
...
...
@@ -65,32 +65,32 @@ describe('AuditEventsApp', () => {
});
it
(
'
renders audit events table
'
,
()
=>
{
expect
(
wrapper
.
find
(
AuditEventsTable
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
AuditEventsTable
).
props
()).
toEqual
({
events
,
isLastPage
:
true
,
});
});
it
(
'
renders audit events filter
'
,
()
=>
{
expect
(
wrapper
.
find
(
AuditEventsFilter
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
AuditEventsFilter
).
props
()).
toEqual
({
filterTokenOptions
,
value
:
TEST_FILTER_VALUE
,
});
});
it
(
'
renders date range field
'
,
()
=>
{
expect
(
wrapper
.
find
(
DateRangeField
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
DateRangeField
).
props
()).
toEqual
({
startDate
:
TEST_START_DATE
,
endDate
:
TEST_END_DATE
,
});
});
it
(
'
renders sorting field
'
,
()
=>
{
expect
(
wrapper
.
find
(
SortingField
).
props
()).
toEqual
({
sortBy
:
TEST_SORT_BY
});
expect
(
wrapper
.
find
Component
(
SortingField
).
props
()).
toEqual
({
sortBy
:
TEST_SORT_BY
});
});
it
(
'
renders the audit events export button
'
,
()
=>
{
expect
(
wrapper
.
find
(
AuditEventsExportButton
).
props
()).
toEqual
({
expect
(
wrapper
.
find
Component
(
AuditEventsExportButton
).
props
()).
toEqual
({
exportHref
:
'
http://example.com/audit_log_reports.csv?created_after=2020-01-01&created_before=2020-02-02
'
,
});
...
...
@@ -111,7 +111,7 @@ describe('AuditEventsApp', () => {
`
(
'
for $name, it calls $handler
'
,
({
field
,
action
,
payload
})
=>
{
expect
(
store
.
dispatch
).
not
.
toHaveBeenCalled
();
wrapper
.
find
(
field
).
vm
.
$emit
(
'
selected
'
,
payload
);
wrapper
.
find
Component
(
field
).
vm
.
$emit
(
'
selected
'
,
payload
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
action
,
payload
);
});
...
...
@@ -123,7 +123,7 @@ describe('AuditEventsApp', () => {
});
it
(
'
does not render the audit events export button
'
,
()
=>
{
expect
(
wrapper
.
find
(
AuditEventsExportButton
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
AuditEventsExportButton
).
exists
()).
toBe
(
false
);
});
});
...
...
@@ -133,7 +133,7 @@ describe('AuditEventsApp', () => {
});
it
(
'
does not render the audit events filter
'
,
()
=>
{
expect
(
wrapper
.
find
(
AuditEventsFilter
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
AuditEventsFilter
).
exists
()).
toBe
(
false
);
});
});
});
ee/spec/frontend/audit_events/components/audit_events_export_button_spec.js
View file @
4ad3919b
...
...
@@ -8,7 +8,7 @@ const EXPORT_HREF = 'http://example.com/audit_log_reports.csv?created_after=2020
describe
(
'
AuditEventsExportButton component
'
,
()
=>
{
let
wrapper
;
const
findExportButton
=
()
=>
wrapper
.
find
(
GlButton
);
const
findExportButton
=
()
=>
wrapper
.
find
Component
(
GlButton
);
const
createComponent
=
(
props
=
{})
=>
{
return
shallowMount
(
AuditEventsExportButton
,
{
...
...
ee/spec/frontend/audit_events/components/audit_events_filter_spec.js
View file @
4ad3919b
...
...
@@ -9,7 +9,7 @@ describe('AuditEventsFilter', () => {
let
wrapper
;
const
value
=
[{
type
:
'
project
'
,
value
:
{
data
:
1
,
operator
:
'
=
'
}
}];
const
findFilteredSearch
=
()
=>
wrapper
.
find
(
GlFilteredSearch
);
const
findFilteredSearch
=
()
=>
wrapper
.
find
Component
(
GlFilteredSearch
);
const
getAvailableTokens
=
()
=>
findFilteredSearch
().
props
(
'
availableTokens
'
);
const
getAvailableTokenProps
=
(
type
)
=>
getAvailableTokens
().
find
((
token
)
=>
token
.
type
===
type
);
...
...
ee/spec/frontend/audit_events/components/audit_events_table_spec.js
View file @
4ad3919b
...
...
@@ -21,7 +21,13 @@ describe('AuditEventsTable component', () => {
};
const
getCell
=
(
trIdx
,
tdIdx
)
=>
{
return
wrapper
.
find
(
GlTable
).
find
(
'
tbody
'
).
findAll
(
'
tr
'
).
at
(
trIdx
).
findAll
(
'
td
'
).
at
(
tdIdx
);
return
wrapper
.
findComponent
(
GlTable
)
.
find
(
'
tbody
'
)
.
findAll
(
'
tr
'
)
.
at
(
trIdx
)
.
findAll
(
'
td
'
)
.
at
(
tdIdx
);
};
beforeEach
(()
=>
{
...
...
@@ -49,13 +55,13 @@ describe('AuditEventsTable component', () => {
describe
(
'
Pagination behaviour
'
,
()
=>
{
it
(
'
should show
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlPagination
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
exists
()).
toBe
(
true
);
});
it
(
'
should hide if there is no data
'
,
()
=>
{
wrapper
.
setProps
({
events
:
[]
});
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
find
(
GlPagination
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
exists
()).
toBe
(
false
);
});
});
...
...
@@ -63,27 +69,27 @@ describe('AuditEventsTable component', () => {
setWindowLocation
(
'
?page=2
'
);
wrapper
=
createComponent
();
expect
(
wrapper
.
find
(
GlPagination
).
props
().
value
).
toBe
(
2
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
value
).
toBe
(
2
);
});
it
(
'
should not have a prevPage if the page is 1
'
,
()
=>
{
setWindowLocation
(
'
?page=1
'
);
wrapper
=
createComponent
();
expect
(
wrapper
.
find
(
GlPagination
).
props
().
prevPage
).
toBe
(
null
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
prevPage
).
toBe
(
null
);
});
it
(
'
should set the prevPage to 1 if the page is 2
'
,
()
=>
{
setWindowLocation
(
'
?page=2
'
);
wrapper
=
createComponent
();
expect
(
wrapper
.
find
(
GlPagination
).
props
().
prevPage
).
toBe
(
1
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
prevPage
).
toBe
(
1
);
});
it
(
'
should not have a nextPage if isLastPage is true
'
,
()
=>
{
wrapper
.
setProps
({
isLastPage
:
true
});
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
wrapper
.
find
(
GlPagination
).
props
().
nextPage
).
toBe
(
null
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
nextPage
).
toBe
(
null
);
});
});
...
...
@@ -91,11 +97,11 @@ describe('AuditEventsTable component', () => {
setWindowLocation
(
'
?page=1
'
);
wrapper
=
createComponent
();
expect
(
wrapper
.
find
(
GlPagination
).
props
().
nextPage
).
toBe
(
2
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
nextPage
).
toBe
(
2
);
});
it
(
'
should set the nextPage to 2 if the page is not set
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlPagination
).
props
().
nextPage
).
toBe
(
2
);
expect
(
wrapper
.
find
Component
(
GlPagination
).
props
().
nextPage
).
toBe
(
2
);
});
});
});
ee/spec/frontend/audit_events/components/date_range_field_spec.js
View file @
4ad3919b
...
...
@@ -16,8 +16,8 @@ describe('DateRangeField component', () => {
const
startDate
=
parsePikadayDate
(
'
2020-03-13
'
);
const
endDate
=
parsePikadayDate
(
'
2020-03-14
'
);
const
findDatePicker
=
()
=>
wrapper
.
find
(
GlDaterangePicker
);
const
findDateRangeButtons
=
()
=>
wrapper
.
find
(
DateRangeButtons
);
const
findDatePicker
=
()
=>
wrapper
.
find
Component
(
GlDaterangePicker
);
const
findDateRangeButtons
=
()
=>
wrapper
.
find
Component
(
DateRangeButtons
);
const
createComponent
=
(
props
=
{},
stubs
=
{})
=>
{
wrapper
=
shallowMount
(
DateRangeField
,
{
...
...
ee/spec/frontend/audit_events/components/sorting_field_spec.js
View file @
4ad3919b
...
...
@@ -12,7 +12,7 @@ describe('SortingField component', () => {
};
const
getCheckedOptions
=
()
=>
wrapper
.
findAll
(
GlDropdownItem
).
filter
((
item
)
=>
item
.
props
().
isChecked
);
wrapper
.
findAll
Components
(
GlDropdownItem
).
filter
((
item
)
=>
item
.
props
().
isChecked
);
beforeEach
(()
=>
{
initComponent
();
...
...
@@ -25,7 +25,7 @@ describe('SortingField component', () => {
describe
(
'
when initialized
'
,
()
=>
{
it
(
'
should have sorting options
'
,
()
=>
{
expect
(
wrapper
.
findAll
(
GlDropdownItem
)).
toHaveLength
(
2
);
expect
(
wrapper
.
findAll
Components
(
GlDropdownItem
)).
toHaveLength
(
2
);
});
it
(
'
should set the sorting option to `created_desc` by default
'
,
()
=>
{
...
...
@@ -49,7 +49,7 @@ describe('SortingField component', () => {
describe
(
'
when the user clicks on a option
'
,
()
=>
{
beforeEach
(()
=>
{
initComponent
();
wrapper
.
findAll
(
GlDropdownItem
).
at
(
1
).
vm
.
$emit
(
'
click
'
);
wrapper
.
findAll
Components
(
GlDropdownItem
).
at
(
1
).
vm
.
$emit
(
'
click
'
);
});
it
(
'
should emit the "selected" event with clicked option
'
,
()
=>
{
...
...
ee/spec/frontend/audit_events/components/tokens/group_token_spec.js
View file @
4ad3919b
...
...
@@ -19,7 +19,7 @@ describe('GroupToken', () => {
const
value
=
{
data
:
123
};
const
config
=
{
type
:
'
foo
'
};
const
findAuditFilterToken
=
()
=>
wrapper
.
find
(
AuditFilterToken
);
const
findAuditFilterToken
=
()
=>
wrapper
.
find
Component
(
AuditFilterToken
);
const
initComponent
=
()
=>
{
wrapper
=
shallowMount
(
GroupToken
,
{
...
...
ee/spec/frontend/audit_events/components/tokens/member_token_spec.js
View file @
4ad3919b
...
...
@@ -28,7 +28,7 @@ describe('MemberToken', () => {
const
value
=
{
data
:
123
};
const
config
=
{
type
:
'
foo
'
,
groupId
:
123
};
const
findAuditFilterToken
=
()
=>
wrapper
.
find
(
AuditFilterToken
);
const
findAuditFilterToken
=
()
=>
wrapper
.
find
Component
(
AuditFilterToken
);
const
initComponent
=
()
=>
{
wrapper
=
shallowMount
(
MemberToken
,
{
...
...
ee/spec/frontend/audit_events/components/tokens/project_token_spec.js
View file @
4ad3919b
...
...
@@ -19,7 +19,7 @@ describe('ProjectToken', () => {
const
value
=
{
data
:
123
};
const
config
=
{
type
:
'
foo
'
};
const
findAuditFilterToken
=
()
=>
wrapper
.
find
(
AuditFilterToken
);
const
findAuditFilterToken
=
()
=>
wrapper
.
find
Component
(
AuditFilterToken
);
const
initComponent
=
()
=>
{
wrapper
=
shallowMount
(
ProjectToken
,
{
...
...
ee/spec/frontend/audit_events/components/tokens/shared/audit_filter_token_spec.js
View file @
4ad3919b
...
...
@@ -24,7 +24,7 @@ describe('AuditFilterToken', () => {
const
findFilteredSearchSuggestions
=
()
=>
wrapper
.
findAllByTestId
(
'
audit-filter-suggestion
'
);
const
findFilteredSearchToken
=
()
=>
wrapper
.
find
(
'
#filtered-search-token
'
);
const
findItemAvatar
=
()
=>
wrapper
.
findByTestId
(
'
audit-filter-item-avatar
'
);
const
findLoadingIcon
=
(
type
)
=>
wrapper
.
find
(
type
).
find
(
GlLoadingIcon
);
const
findLoadingIcon
=
(
type
)
=>
wrapper
.
find
(
type
).
find
Component
(
GlLoadingIcon
);
const
findViewLoadingIcon
=
()
=>
findLoadingIcon
(
'
.view
'
);
const
findSuggestionsLoadingIcon
=
()
=>
findLoadingIcon
(
'
.suggestions
'
);
...
...
@@ -187,7 +187,7 @@ describe('AuditFilterToken', () => {
it
(
'
renders an avatar for each suggestion
'
,
()
=>
{
mockSuggestions
.
forEach
((
suggestion
,
index
)
=>
{
const
avatar
=
findFilteredSearchSuggestions
().
at
(
index
).
find
(
GlAvatar
);
const
avatar
=
findFilteredSearchSuggestions
().
at
(
index
).
find
Component
(
GlAvatar
);
expect
(
avatar
.
props
()).
toMatchObject
({
alt
:
`
${
suggestion
.
name
}
's avatar`
,
...
...
ee/spec/frontend/audit_events/components/tokens/user_token_spec.js
View file @
4ad3919b
...
...
@@ -22,7 +22,7 @@ describe('UserToken', () => {
const
value
=
{
data
:
123
};
const
config
=
{
type
:
'
foo
'
};
const
findAuditFilterToken
=
()
=>
wrapper
.
find
(
AuditFilterToken
);
const
findAuditFilterToken
=
()
=>
wrapper
.
find
Component
(
AuditFilterToken
);
const
initComponent
=
()
=>
{
wrapper
=
shallowMount
(
UserToken
,
{
...
...
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