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
Show 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
'
,
()
=>
{
describe
.
each
`
initialActivated | value
${
false
}
|
${
true
}
${
true
}
|
${
false
}
`
(
'
when initialActivated=$initialActivated and value=$value
'
,
({
initialActivated
,
value
})
=>
{
beforeEach
(()
=>
{
const
formPath
=
'
some/path
'
;
const
formPath
=
'
some/path
'
;
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
value
}
})
.
replyOnce
(
200
,
{
active
:
value
});
createComponent
({
initialActivated
,
formPath
});
it
(
'
enables toggle when initialActivated=false
'
,
()
=>
{
return
wrapper
.
vm
.
toggleActivated
(
value
);
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
true
}
}).
replyOnce
(
200
,
{
active
:
true
});
createComponent
({
initialActivated
:
false
,
formPath
});
return
wrapper
.
vm
.
toggleActivated
(
true
).
then
(()
=>
{
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
true
);
});
});
});
it
(
'
disables toggle when initialActivated=true
'
,
()
=>
{
mockAxios
.
onPut
(
formPath
,
{
service
:
{
active
:
false
}
}).
replyOnce
(
200
,
{
active
:
false
});
createComponent
({
initialActivated
:
true
,
formPath
});
return
wrapper
.
vm
.
toggleActivated
(
false
).
then
(
()
=>
{
it
(
`updates toggle button value to
${
value
}
`
,
()
=>
{
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
fals
e
);
expect
(
wrapper
.
find
(
ToggleButton
).
props
(
'
value
'
)).
toBe
(
valu
e
);
});
});
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