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
9611a894
Commit
9611a894
authored
May 19, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds specs for sorting
parent
40cbb4c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
spec/frontend/alert_management/components/alert_management_list_spec.js
...alert_management/components/alert_management_list_spec.js
+32
-0
No files found.
spec/frontend/alert_management/components/alert_management_list_spec.js
View file @
9611a894
...
...
@@ -38,6 +38,7 @@ describe('AlertManagementList', () => {
const
findDateFields
=
()
=>
wrapper
.
findAll
(
TimeAgo
);
const
findFirstStatusOption
=
()
=>
findStatusDropdown
().
find
(
GlDropdownItem
);
const
findSeverityFields
=
()
=>
wrapper
.
findAll
(
'
[data-testid="severityField"]
'
);
const
findSeverityColumnHeader
=
()
=>
wrapper
.
findAll
(
'
th
'
).
at
(
0
);
const
alertsCount
=
{
acknowledged
:
6
,
...
...
@@ -80,7 +81,10 @@ describe('AlertManagementList', () => {
});
}
const
mockStartedAtCol
=
{};
beforeEach
(()
=>
{
jest
.
spyOn
(
document
,
'
getElementsByClassName
'
).
mockReturnValue
([
mockStartedAtCol
]);
mountComponent
();
});
...
...
@@ -284,6 +288,34 @@ describe('AlertManagementList', () => {
});
});
describe
(
'
sorting the alert list by column
'
,
()
=>
{
beforeEach
(()
=>
{
mountComponent
({
props
:
{
alertManagementEnabled
:
true
,
userCanEnableAlertManagement
:
true
},
data
:
{
alerts
:
mockAlerts
,
errored
:
false
,
sort
:
'
START_TIME_ASC
'
},
loading
:
false
,
});
});
it
(
'
updates sort with new direction and column key
'
,
()
=>
{
findSeverityColumnHeader
().
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
$data
.
sort
).
toEqual
(
'
SEVERITY_ASC
'
);
findSeverityColumnHeader
().
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
$data
.
sort
).
toEqual
(
'
SEVERITY_DESC
'
);
});
it
(
'
updates the `ariaSort` attribute so the sort icon appears in the proper column
'
,
()
=>
{
expect
(
mockStartedAtCol
.
ariaSort
).
toEqual
(
'
ascending
'
);
findSeverityColumnHeader
().
trigger
(
'
click
'
);
expect
(
mockStartedAtCol
.
ariaSort
).
toEqual
(
'
none
'
);
});
});
describe
(
'
updating the alert status
'
,
()
=>
{
const
iid
=
'
1527542
'
;
const
mockUpdatedMutationResult
=
{
...
...
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