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
404bab49
Commit
404bab49
authored
Jul 14, 2020
by
Axel García
Committed by
Miguel Rincon
Jul 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure epic header tests DOM output
parent
91c1fa7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
13 deletions
+32
-13
ee/app/assets/javascripts/epic/components/epic_header.vue
ee/app/assets/javascripts/epic/components/epic_header.vue
+4
-4
ee/spec/frontend/epic/components/epic_header_spec.js
ee/spec/frontend/epic/components/epic_header_spec.js
+28
-9
No files found.
ee/app/assets/javascripts/epic/components/epic_header.vue
View file @
404bab49
...
@@ -45,7 +45,7 @@ export default {
...
@@ -45,7 +45,7 @@ export default {
return
this
.
isEpicOpen
?
__
(
'
Open
'
)
:
__
(
'
Closed
'
);
return
this
.
isEpicOpen
?
__
(
'
Open
'
)
:
__
(
'
Closed
'
);
},
},
actionButtonClass
()
{
actionButtonClass
()
{
return
`qa-close-reopen-epic-button
${
this
.
isEpicOpen
?
'
btn-close
'
:
'
btn-open
'
}
`
;
return
this
.
isEpicOpen
?
'
btn-close
'
:
'
btn-open
'
;
},
},
actionButtonText
()
{
actionButtonText
()
{
return
this
.
isEpicOpen
?
__
(
'
Close epic
'
)
:
__
(
'
Reopen epic
'
);
return
this
.
isEpicOpen
?
__
(
'
Close epic
'
)
:
__
(
'
Reopen epic
'
);
...
@@ -85,8 +85,8 @@ export default {
...
@@ -85,8 +85,8 @@ export default {
class="issuable-status-box status-box"
class="issuable-status-box status-box"
data-testid="status-box"
data-testid="status-box"
>
>
<gl-icon
:name=
"statusIcon"
class=
"d-block d-sm-none"
/>
<gl-icon
:name=
"statusIcon"
class=
"d-block d-sm-none"
data-testid=
"status-icon"
/>
<span
class=
"d-none d-sm-block"
>
{{
statusText
}}
</span>
<span
class=
"d-none d-sm-block"
data-testid=
"status-text"
>
{{
statusText
}}
</span>
</div>
</div>
<div
class=
"issuable-meta"
data-testid=
"author-details"
>
<div
class=
"issuable-meta"
data-testid=
"author-details"
>
<div
<div
...
@@ -134,7 +134,7 @@ export default {
...
@@ -134,7 +134,7 @@ export default {
:class=
"actionButtonClass"
:class=
"actionButtonClass"
category=
"secondary"
category=
"secondary"
variant=
"warning"
variant=
"warning"
class=
"gl-mt-3 gl-sm-mt-0! gl-w-full gl-sm-w-auto!"
class=
"
qa-close-reopen-epic-button
gl-mt-3 gl-sm-mt-0! gl-w-full gl-sm-w-auto!"
data-testid=
"toggle-status-button"
data-testid=
"toggle-status-button"
@
click=
"toggleEpicStatus(isEpicOpen)"
@
click=
"toggleEpicStatus(isEpicOpen)"
>
>
...
...
ee/spec/frontend/epic/components/epic_header_spec.js
View file @
404bab49
...
@@ -33,9 +33,12 @@ describe('EpicHeaderComponent', () => {
...
@@ -33,9 +33,12 @@ describe('EpicHeaderComponent', () => {
});
});
const
findStatusBox
=
()
=>
wrapper
.
find
(
'
[data-testid="status-box"]
'
);
const
findStatusBox
=
()
=>
wrapper
.
find
(
'
[data-testid="status-box"]
'
);
const
findStatusIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="status-icon"]
'
);
const
findStatusText
=
()
=>
wrapper
.
find
(
'
[data-testid="status-text"]
'
);
const
findConfidentialIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="confidential-icon"]
'
).
find
(
GlIcon
);
const
findConfidentialIcon
=
()
=>
wrapper
.
find
(
'
[data-testid="confidential-icon"]
'
).
find
(
GlIcon
);
const
findAuthorDetails
=
()
=>
wrapper
.
find
(
'
[data-testid="author-details"]
'
);
const
findAuthorDetails
=
()
=>
wrapper
.
find
(
'
[data-testid="author-details"]
'
);
const
findActionButtons
=
()
=>
wrapper
.
find
(
'
[data-testid="action-buttons"]
'
);
const
findActionButtons
=
()
=>
wrapper
.
find
(
'
[data-testid="action-buttons"]
'
);
const
findToggleStatusButton
=
()
=>
wrapper
.
find
(
'
[data-testid="toggle-status-button"]
'
);
const
findNewEpicButton
=
()
=>
wrapper
.
find
(
'
[data-testid="new-epic-button"]
'
);
const
findNewEpicButton
=
()
=>
wrapper
.
find
(
'
[data-testid="new-epic-button"]
'
);
const
findSidebarToggle
=
()
=>
wrapper
.
find
(
'
[data-testid="sidebar-toggle"]
'
);
const
findSidebarToggle
=
()
=>
wrapper
.
find
(
'
[data-testid="sidebar-toggle"]
'
);
...
@@ -44,13 +47,15 @@ describe('EpicHeaderComponent', () => {
...
@@ -44,13 +47,15 @@ describe('EpicHeaderComponent', () => {
it
(
'
returns string `issue-open-m` when `isEpicOpen` is true
'
,
()
=>
{
it
(
'
returns string `issue-open-m` when `isEpicOpen` is true
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
open
;
store
.
state
.
state
=
statusType
.
open
;
expect
(
wrapper
.
vm
.
statusIcon
).
toBe
(
'
issue-open-m
'
);
expect
(
findStatusIcon
().
props
(
'
name
'
)
).
toBe
(
'
issue-open-m
'
);
});
});
it
(
'
returns string `mobile-issue-close` when `isEpicOpen` is false
'
,
()
=>
{
it
(
'
returns string `mobile-issue-close` when `isEpicOpen` is false
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
close
;
store
.
state
.
state
=
statusType
.
close
;
expect
(
wrapper
.
vm
.
statusIcon
).
toBe
(
'
mobile-issue-close
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findStatusIcon
().
props
(
'
name
'
)).
toBe
(
'
mobile-issue-close
'
);
});
});
});
});
});
...
@@ -58,13 +63,15 @@ describe('EpicHeaderComponent', () => {
...
@@ -58,13 +63,15 @@ describe('EpicHeaderComponent', () => {
it
(
'
returns string `Open` when `isEpicOpen` is true
'
,
()
=>
{
it
(
'
returns string `Open` when `isEpicOpen` is true
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
open
;
store
.
state
.
state
=
statusType
.
open
;
expect
(
wrapper
.
vm
.
statusText
).
toBe
(
'
Open
'
);
expect
(
findStatusText
().
text
()
).
toBe
(
'
Open
'
);
});
});
it
(
'
returns string `Closed` when `isEpicOpen` is false
'
,
()
=>
{
it
(
'
returns string `Closed` when `isEpicOpen` is false
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
close
;
store
.
state
.
state
=
statusType
.
close
;
expect
(
wrapper
.
vm
.
statusText
).
toBe
(
'
Closed
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findStatusText
().
text
()).
toBe
(
'
Closed
'
);
});
});
});
});
});
...
@@ -72,13 +79,15 @@ describe('EpicHeaderComponent', () => {
...
@@ -72,13 +79,15 @@ describe('EpicHeaderComponent', () => {
it
(
'
returns `btn-close` when `isEpicOpen` is true
'
,
()
=>
{
it
(
'
returns `btn-close` when `isEpicOpen` is true
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
open
;
store
.
state
.
state
=
statusType
.
open
;
expect
(
wrapper
.
vm
.
actionButtonClass
).
toContain
(
'
btn-close
'
);
expect
(
findToggleStatusButton
().
classes
()
).
toContain
(
'
btn-close
'
);
});
});
it
(
'
returns `btn-open` when `isEpicOpen` is false
'
,
()
=>
{
it
(
'
returns `btn-open` when `isEpicOpen` is false
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
close
;
store
.
state
.
state
=
statusType
.
close
;
expect
(
wrapper
.
vm
.
actionButtonClass
).
toContain
(
'
btn-open
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findToggleStatusButton
().
classes
()).
toContain
(
'
btn-open
'
);
});
});
});
});
});
...
@@ -86,13 +95,15 @@ describe('EpicHeaderComponent', () => {
...
@@ -86,13 +95,15 @@ describe('EpicHeaderComponent', () => {
it
(
'
returns string `Close epic` when `isEpicOpen` is true
'
,
()
=>
{
it
(
'
returns string `Close epic` when `isEpicOpen` is true
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
open
;
store
.
state
.
state
=
statusType
.
open
;
expect
(
wrapper
.
vm
.
actionButtonText
).
toBe
(
'
Close epic
'
);
expect
(
findToggleStatusButton
().
text
()
).
toBe
(
'
Close epic
'
);
});
});
it
(
'
returns string `Reopen epic` when `isEpicOpen` is false
'
,
()
=>
{
it
(
'
returns string `Reopen epic` when `isEpicOpen` is false
'
,
()
=>
{
store
.
state
.
state
=
statusType
.
close
;
store
.
state
.
state
=
statusType
.
close
;
expect
(
wrapper
.
vm
.
actionButtonText
).
toBe
(
'
Reopen epic
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findToggleStatusButton
().
text
()).
toBe
(
'
Reopen epic
'
);
});
});
});
});
});
});
});
...
@@ -132,7 +143,7 @@ describe('EpicHeaderComponent', () => {
...
@@ -132,7 +143,7 @@ describe('EpicHeaderComponent', () => {
it
(
'
renders action buttons element
'
,
()
=>
{
it
(
'
renders action buttons element
'
,
()
=>
{
const
actionButtons
=
findActionButtons
();
const
actionButtons
=
findActionButtons
();
const
toggleStatusButton
=
actionButtons
.
find
(
'
[data-testid="toggle-status-button"]
'
);
const
toggleStatusButton
=
findToggleStatusButton
(
);
expect
(
actionButtons
.
exists
()).
toBeTruthy
();
expect
(
actionButtons
.
exists
()).
toBeTruthy
();
expect
(
toggleStatusButton
.
exists
()).
toBeTruthy
();
expect
(
toggleStatusButton
.
exists
()).
toBeTruthy
();
...
@@ -167,6 +178,14 @@ describe('EpicHeaderComponent', () => {
...
@@ -167,6 +178,14 @@ describe('EpicHeaderComponent', () => {
features
=
{
createEpicForm
:
true
};
features
=
{
createEpicForm
:
true
};
});
});
it
(
'
does not render new epic button if user cannot create it
'
,
()
=>
{
store
.
state
.
canCreate
=
false
;
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findNewEpicButton
().
exists
()).
toBe
(
false
);
});
});
it
(
'
renders new epic button if user can create it
'
,
()
=>
{
it
(
'
renders new epic button if user can create it
'
,
()
=>
{
store
.
state
.
canCreate
=
true
;
store
.
state
.
canCreate
=
true
;
...
...
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