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
8fd141b7
Commit
8fd141b7
authored
Sep 15, 2019
by
Paul Slaughter
Committed by
lauraMon
Sep 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for active service icon toggle
Signed-off-by:
lauraMon
<
lmontemayor@gitlab.com
>
parent
64cd1428
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
20 deletions
+35
-20
app/views/projects/services/_form.html.haml
app/views/projects/services/_form.html.haml
+1
-1
ee/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
...s_service_settings/components/alerts_service_form_spec.js
+34
-19
No files found.
app/views/projects/services/_form.html.haml
View file @
8fd141b7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.col-lg-3
.col-lg-3
%h4
.prepend-top-0
%h4
.prepend-top-0
=
@service
.
title
=
@service
.
title
-
[
true
,
false
].
each
do
|
value
|
-
[
true
,
false
].
each
do
|
value
|
-
hide_class
=
'd-none'
if
@service
.
activated?
!=
value
-
hide_class
=
'd-none'
if
@service
.
activated?
!=
value
%span
.js-service-active-status
{
class:
hide_class
,
data:
{
value:
value
.
to_s
}
}
%span
.js-service-active-status
{
class:
hide_class
,
data:
{
value:
value
.
to_s
}
}
=
boolean_to_icon
value
=
boolean_to_icon
value
...
...
ee/spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
View file @
8fd141b7
...
@@ -36,9 +36,16 @@ describe('AlertsServiceForm', () => {
...
@@ -36,9 +36,16 @@ describe('AlertsServiceForm', () => {
const
findUrl
=
()
=>
wrapper
.
find
(
'
#url
'
);
const
findUrl
=
()
=>
wrapper
.
find
(
'
#url
'
);
const
findAuthorizationKey
=
()
=>
wrapper
.
find
(
'
#authorization-key
'
);
const
findAuthorizationKey
=
()
=>
wrapper
.
find
(
'
#authorization-key
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
p
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
p
'
);
const
findActiveStatusIcon
=
val
=>
document
.
querySelector
(
`.js-service-active-status[data-value=
${
val
.
toString
()}
]`
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mockAxios
=
new
MockAdapter
(
axios
);
mockAxios
=
new
MockAdapter
(
axios
);
setFixtures
(
`
<div>
<span class="js-service-active-status fa fa-circle" data-value="true"></span>
<span class="js-service-active-status fa fa-power-off" data-value="false"></span>
</div>`
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -127,25 +134,33 @@ describe('AlertsServiceForm', () => {
...
@@ -127,25 +134,33 @@ describe('AlertsServiceForm', () => {
});
});
describe
(
'
successfully completes
'
,
()
=>
{
describe
(
'
successfully completes
'
,
()
=>
{
const
formPath
=
'
some/path
'
;
describe
.
each
`
initialActivated | value
it
(
'
enables toggle when initialActivated=false
'
,
()
=>
{
${
false
}
|
${
true
}
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
true
}
}).
replyOnce
(
200
,
{
active
:
true
});
${
true
}
|
${
false
}
createComponent
({
initialActivated
:
false
,
formPath
});
`
(
'
when initialActivated=$initialActivated and value=$value
'
,
return
wrapper
.
vm
.
toggleActivated
(
true
).
then
(()
=>
{
({
initialActivated
,
value
})
=>
{
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
true
);
beforeEach
(()
=>
{
});
const
formPath
=
'
some/path
'
;
});
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
value
}
})
it
(
'
disables toggle when initialActivated=true
'
,
()
=>
{
.
replyOnce
(
200
,
{
active
:
value
});
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
false
}
}).
replyOnce
(
200
,
{
active
:
false
});
createComponent
({
initialActivated
,
formPath
});
createComponent
({
initialActivated
:
true
,
formPath
});
return
wrapper
.
vm
.
toggleActivated
(
value
);
return
wrapper
.
vm
.
toggleActivated
(
false
).
then
(()
=>
{
});
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
false
);
});
it
(
`updates toggle button value to
${
value
}
`
,
()
=>
{
});
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
value
);
});
it
(
'
updates visible status icons
'
,
()
=>
{
expect
(
findActiveStatusIcon
(
!
value
)).
toHaveClass
(
'
d-none
'
);
expect
(
findActiveStatusIcon
(
value
)).
not
.
toHaveClass
(
'
d-none
'
);
});
},
);
});
});
describe
(
'
error is encountered
'
,
()
=>
{
describe
(
'
error is encountered
'
,
()
=>
{
...
...
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