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
39abea2b
Commit
39abea2b
authored
Apr 16, 2020
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for feature flag changes
Remove usage of GlDeprecatedButton Some other minor cleanup
parent
a7886b74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
22 deletions
+79
-22
ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue
...ets/javascripts/burndown_chart/components/burn_charts.vue
+19
-11
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
...ec/frontend/burndown_chart/components/burn_charts_spec.js
+60
-11
No files found.
ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue
View file @
39abea2b
<
script
>
<
script
>
import
{
Gl
Deprecated
Button
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
BurndownChart
from
'
./burndown_chart.vue
'
;
import
BurndownChart
from
'
./burndown_chart.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
Gl
Deprecated
Button
,
GlButton
,
GlButtonGroup
,
GlButtonGroup
,
BurndownChart
,
BurndownChart
,
},
},
...
@@ -39,6 +39,12 @@ export default {
...
@@ -39,6 +39,12 @@ export default {
title
()
{
title
()
{
return
this
.
burnupChartsEnabled
?
__
(
'
Charts
'
)
:
__
(
'
Burndown chart
'
);
return
this
.
burnupChartsEnabled
?
__
(
'
Charts
'
)
:
__
(
'
Burndown chart
'
);
},
},
issueButtonCategory
()
{
return
this
.
issuesSelected
?
'
primary
'
:
'
secondary
'
;
},
weightButtonCategory
()
{
return
this
.
issuesSelected
?
'
secondary
'
:
'
primary
'
;
},
},
},
methods
:
{
methods
:
{
showIssueCount
()
{
showIssueCount
()
{
...
@@ -54,25 +60,27 @@ export default {
...
@@ -54,25 +60,27 @@ export default {
<
template
>
<
template
>
<div
data-qa-selector=
"burndown_chart"
>
<div
data-qa-selector=
"burndown_chart"
>
<div
class=
"burndown-header d-flex align-items-center"
>
<div
class=
"burndown-header d-flex align-items-center"
>
<h3>
{{
title
}}
</h3>
<h3
ref=
"chartsTitle"
>
{{
title
}}
</h3>
<gl-button-group
class=
"ml-3 js-burndown-data-selector"
>
<gl-button-group
class=
"ml-3 js-burndown-data-selector"
>
<gl-
deprecated-
button
<gl-button
ref=
"totalIssuesButton"
ref=
"totalIssuesButton"
:variant=
"issuesSelected ? 'primary' : 'inverted-primary'"
:category=
"issueButtonCategory"
size=
"sm"
variant=
"info"
size=
"small"
@
click=
"showIssueCount"
@
click=
"showIssueCount"
>
>
{{
__
(
'
Issues
'
)
}}
{{
__
(
'
Issues
'
)
}}
</gl-
deprecated-
button>
</gl-button>
<gl-
deprecated-
button
<gl-button
ref=
"totalWeightButton"
ref=
"totalWeightButton"
:variant=
"issuesSelected ? 'inverted-primary' : 'primary'"
:category=
"weightButtonCategory"
size=
"sm"
variant=
"info"
size=
"small"
data-qa-selector=
"weight_button"
data-qa-selector=
"weight_button"
@
click=
"showIssueWeight"
@
click=
"showIssueWeight"
>
>
{{
__
(
'
Issue weight
'
)
}}
{{
__
(
'
Issue weight
'
)
}}
</gl-
deprecated-
button>
</gl-button>
</gl-button-group>
</gl-button-group>
</div>
</div>
<div
v-if=
"burnupChartsEnabled"
class=
"row"
>
<div
v-if=
"burnupChartsEnabled"
class=
"row"
>
...
...
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
View file @
39abea2b
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
BurnCharts
from
'
ee/burndown_chart/components/burn_charts.vue
'
;
import
BurnCharts
from
'
ee/burndown_chart/components/burn_charts.vue
'
;
import
BurndownChart
from
'
ee/burndown_chart/components/burndown_chart.vue
'
;
describe
(
'
burndown_chart
'
,
()
=>
{
describe
(
'
burndown_chart
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
issuesButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalIssuesButton
'
});
const
findChartsTitle
=
()
=>
wrapper
.
find
({
ref
:
'
chartsTitle
'
});
const
weightButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalWeightButton
'
});
const
findIssuesButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalIssuesButton
'
});
const
findWeightButton
=
()
=>
wrapper
.
find
({
ref
:
'
totalWeightButton
'
});
const
findActiveButtons
=
()
=>
wrapper
.
findAll
(
GlButton
).
filter
(
button
=>
button
.
attributes
().
category
===
'
primary
'
);
const
findBurndownChart
=
()
=>
wrapper
.
find
(
BurndownChart
);
const
defaultProps
=
{
const
defaultProps
=
{
startDate
:
'
2019-08-07T00:00:00.000Z
'
,
startDate
:
'
2019-08-07T00:00:00.000Z
'
,
...
@@ -29,7 +35,7 @@ describe('burndown_chart', () => {
...
@@ -29,7 +35,7 @@ describe('burndown_chart', () => {
origProp
=
window
.
gon
;
origProp
=
window
.
gon
;
window
.
gon
=
{
window
.
gon
=
{
features
:
{
features
:
{
monacoSnippe
ts
:
false
,
burnupChar
ts
:
false
,
},
},
};
};
});
});
...
@@ -38,28 +44,71 @@ describe('burndown_chart', () => {
...
@@ -38,28 +44,71 @@ describe('burndown_chart', () => {
window
.
gon
=
origProp
;
window
.
gon
=
origProp
;
});
});
it
(
'
inclues Issues and Issue weight buttons
'
,
()
=>
{
it
(
'
inclu
d
es Issues and Issue weight buttons
'
,
()
=>
{
createComponent
();
createComponent
();
expect
(
i
ssuesButton
().
text
()).
toBe
(
'
Issues
'
);
expect
(
findI
ssuesButton
().
text
()).
toBe
(
'
Issues
'
);
expect
(
w
eightButton
().
text
()).
toBe
(
'
Issue weight
'
);
expect
(
findW
eightButton
().
text
()).
toBe
(
'
Issue weight
'
);
});
});
it
(
'
defaults to total issues
'
,
()
=>
{
it
(
'
defaults to total issues
'
,
()
=>
{
createComponent
();
createComponent
();
expect
(
issuesButton
().
attributes
(
'
variant
'
)).
toBe
(
'
primary
'
);
expect
(
findActiveButtons
().
length
).
toBe
(
1
);
expect
(
weightButton
().
attributes
(
'
variant
'
)).
toBe
(
'
inverted-primary
'
);
expect
(
findActiveButtons
()
.
at
(
0
)
.
text
(),
).
toBe
(
'
Issues
'
);
expect
(
findBurndownChart
().
props
().
issuesSelected
).
toBe
(
true
);
});
});
it
(
'
toggles Issue weight
'
,
()
=>
{
it
(
'
toggles Issue weight
'
,
()
=>
{
createComponent
();
createComponent
();
w
eightButton
().
vm
.
$emit
(
'
click
'
);
findW
eightButton
().
vm
.
$emit
(
'
click
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
issuesButton
().
attributes
(
'
variant
'
)).
toBe
(
'
inverted-primary
'
);
expect
(
findActiveButtons
().
length
).
toBe
(
1
);
expect
(
weightButton
().
attributes
(
'
variant
'
)).
toBe
(
'
primary
'
);
expect
(
findActiveButtons
()
.
at
(
0
)
.
text
(),
).
toBe
(
'
Issue weight
'
);
});
});
describe
(
'
feature disabled
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
.
features
.
burnupCharts
=
false
;
createComponent
();
});
it
(
'
does not reduce width of burndown chart
'
,
()
=>
{
expect
(
findBurndownChart
().
classes
()).
toEqual
([]);
});
it
(
'
sets section title and chart title correctly
'
,
()
=>
{
expect
(
findChartsTitle
().
text
()).
toBe
(
'
Burndown chart
'
);
expect
(
findBurndownChart
().
props
().
showTitle
).
toBe
(
false
);
});
});
describe
(
'
feature enabled
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
.
features
.
burnupCharts
=
true
;
createComponent
();
});
it
(
'
reduces width of burndown chart
'
,
()
=>
{
expect
(
findBurndownChart
().
classes
()).
toContain
(
'
col-md-6
'
);
});
it
(
'
sets section title and chart title correctly
'
,
()
=>
{
expect
(
findChartsTitle
().
text
()).
toBe
(
'
Charts
'
);
expect
(
findBurndownChart
().
props
().
showTitle
).
toBe
(
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