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
147ca147
Commit
147ca147
authored
Nov 22, 2021
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cadence roll over issues checkbox
Actually update when submitting the form..
parent
7a67e84d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
18 deletions
+59
-18
ee/app/assets/javascripts/iterations/components/iteration_cadence_form.vue
...ascripts/iterations/components/iteration_cadence_form.vue
+1
-0
ee/spec/frontend/iterations/components/iteration_cadence_form_spec.js
...tend/iterations/components/iteration_cadence_form_spec.js
+55
-15
ee/spec/frontend/iterations/mock_data.js
ee/spec/frontend/iterations/mock_data.js
+3
-3
No files found.
ee/app/assets/javascripts/iterations/components/iteration_cadence_form.vue
View file @
147ca147
...
@@ -145,6 +145,7 @@ export default {
...
@@ -145,6 +145,7 @@ export default {
id
,
id
,
title
:
this
.
title
,
title
:
this
.
title
,
automatic
:
this
.
automatic
,
automatic
:
this
.
automatic
,
rollOver
:
this
.
rollOver
,
startDate
:
this
.
startDate
,
startDate
:
this
.
startDate
,
durationInWeeks
:
this
.
durationInWeeks
,
durationInWeeks
:
this
.
durationInWeeks
,
active
:
true
,
active
:
true
,
...
...
ee/spec/frontend/iterations/components/iteration_cadence_form_spec.js
View file @
147ca147
...
@@ -4,6 +4,7 @@ import Vue, { nextTick } from 'vue';
...
@@ -4,6 +4,7 @@ import Vue, { nextTick } from 'vue';
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
IterationCadenceForm
from
'
ee/iterations/components/iteration_cadence_form.vue
'
;
import
IterationCadenceForm
from
'
ee/iterations/components/iteration_cadence_form.vue
'
;
import
createCadence
from
'
ee/iterations/queries/cadence_create.mutation.graphql
'
;
import
createCadence
from
'
ee/iterations/queries/cadence_create.mutation.graphql
'
;
import
updateCadence
from
'
ee/iterations/queries/cadence_update.mutation.graphql
'
;
import
getCadence
from
'
ee/iterations/queries/iteration_cadence.query.graphql
'
;
import
getCadence
from
'
ee/iterations/queries/iteration_cadence.query.graphql
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
...
@@ -50,8 +51,16 @@ describe('Iteration cadence form', () => {
...
@@ -50,8 +51,16 @@ describe('Iteration cadence form', () => {
},
},
};
};
function
createComponent
({
query
=
createCadence
,
resolverMock
}
=
{})
{
function
createComponent
({
const
apolloProvider
=
createMockApolloProvider
([[
query
,
resolverMock
]]);
query
=
getCadence
,
resolverMock
,
mutation
=
createCadence
,
mutationMock
,
}
=
{})
{
const
apolloProvider
=
createMockApolloProvider
([
[
query
,
resolverMock
],
[
mutation
,
mutationMock
],
]);
wrapper
=
extendedWrapper
(
wrapper
=
extendedWrapper
(
mount
(
IterationCadenceForm
,
{
mount
(
IterationCadenceForm
,
{
apolloProvider
,
apolloProvider
,
...
@@ -74,6 +83,7 @@ describe('Iteration cadence form', () => {
...
@@ -74,6 +83,7 @@ describe('Iteration cadence form', () => {
const
findAutomatedSchedulingGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
1
);
const
findAutomatedSchedulingGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
1
);
const
findStartDateGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
2
);
const
findStartDateGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
2
);
const
findDurationGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
3
);
const
findDurationGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
3
);
const
findRollOverGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
4
);
const
findFutureIterationsGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
5
);
const
findFutureIterationsGroup
=
()
=>
wrapper
.
findAllComponents
(
GlFormGroup
).
at
(
5
);
const
findError
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
const
findError
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
...
@@ -82,6 +92,7 @@ describe('Iteration cadence form', () => {
...
@@ -82,6 +92,7 @@ describe('Iteration cadence form', () => {
const
findStartDate
=
()
=>
wrapper
.
find
(
'
#cadence-start-date
'
);
const
findStartDate
=
()
=>
wrapper
.
find
(
'
#cadence-start-date
'
);
const
findFutureIterations
=
()
=>
wrapper
.
find
(
'
#cadence-schedule-future-iterations
'
);
const
findFutureIterations
=
()
=>
wrapper
.
find
(
'
#cadence-schedule-future-iterations
'
);
const
findDuration
=
()
=>
wrapper
.
find
(
'
#cadence-duration
'
);
const
findDuration
=
()
=>
wrapper
.
find
(
'
#cadence-duration
'
);
const
findRollOver
=
()
=>
wrapper
.
find
(
'
#cadence-rollover-issues
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
#cadence-description
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
#cadence-description
'
);
const
setTitle
=
(
value
)
=>
findTitle
().
vm
.
$emit
(
'
input
'
,
value
);
const
setTitle
=
(
value
)
=>
findTitle
().
vm
.
$emit
(
'
input
'
,
value
);
...
@@ -89,7 +100,13 @@ describe('Iteration cadence form', () => {
...
@@ -89,7 +100,13 @@ describe('Iteration cadence form', () => {
const
setFutureIterations
=
(
value
)
=>
findFutureIterations
().
vm
.
$emit
(
'
input
'
,
value
);
const
setFutureIterations
=
(
value
)
=>
findFutureIterations
().
vm
.
$emit
(
'
input
'
,
value
);
const
setDuration
=
(
value
)
=>
findDuration
().
vm
.
$emit
(
'
input
'
,
value
);
const
setDuration
=
(
value
)
=>
findDuration
().
vm
.
$emit
(
'
input
'
,
value
);
const
setAutomaticValue
=
(
value
)
=>
{
const
setAutomaticValue
=
(
value
)
=>
{
const
checkbox
=
findAutomatedSchedulingGroup
().
find
(
GlFormCheckbox
).
vm
;
const
checkbox
=
findAutomatedSchedulingGroup
().
findComponent
(
GlFormCheckbox
).
vm
;
checkbox
.
$emit
(
'
input
'
,
value
);
checkbox
.
$emit
(
'
change
'
,
value
);
};
const
setRollOver
=
(
value
)
=>
{
const
checkbox
=
findRollOverGroup
().
findComponent
(
GlFormCheckbox
).
vm
;
checkbox
.
$emit
(
'
input
'
,
value
);
checkbox
.
$emit
(
'
input
'
,
value
);
checkbox
.
$emit
(
'
change
'
,
value
);
checkbox
.
$emit
(
'
change
'
,
value
);
};
};
...
@@ -108,11 +125,11 @@ describe('Iteration cadence form', () => {
...
@@ -108,11 +125,11 @@ describe('Iteration cadence form', () => {
const
clickCancel
=
()
=>
findCancelButton
().
vm
.
$emit
(
'
click
'
);
const
clickCancel
=
()
=>
findCancelButton
().
vm
.
$emit
(
'
click
'
);
describe
(
'
Create cadence
'
,
()
=>
{
describe
(
'
Create cadence
'
,
()
=>
{
let
resolver
Mock
;
let
mutation
Mock
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
resolver
Mock
=
jest
.
fn
().
mockResolvedValue
(
createMutationSuccess
);
mutation
Mock
=
jest
.
fn
().
mockResolvedValue
(
createMutationSuccess
);
createComponent
({
resolver
Mock
});
createComponent
({
mutation
Mock
});
});
});
it
(
'
cancel button links to list page
'
,
()
=>
{
it
(
'
cancel button links to list page
'
,
()
=>
{
...
@@ -125,12 +142,14 @@ describe('Iteration cadence form', () => {
...
@@ -125,12 +142,14 @@ describe('Iteration cadence form', () => {
const
title
=
'
Iteration 5
'
;
const
title
=
'
Iteration 5
'
;
const
startDate
=
'
2020-05-05
'
;
const
startDate
=
'
2020-05-05
'
;
const
durationInWeeks
=
2
;
const
durationInWeeks
=
2
;
const
rollOver
=
true
;
const
iterationsInAdvance
=
6
;
const
iterationsInAdvance
=
6
;
it
(
'
triggers mutation with form data
'
,
async
()
=>
{
it
(
'
triggers mutation with form data
'
,
async
()
=>
{
setTitle
(
title
);
setTitle
(
title
);
setStartDate
(
startDate
);
setStartDate
(
startDate
);
setDuration
(
durationInWeeks
);
setDuration
(
durationInWeeks
);
setRollOver
(
rollOver
);
setFutureIterations
(
iterationsInAdvance
);
setFutureIterations
(
iterationsInAdvance
);
clickSave
();
clickSave
();
...
@@ -138,13 +157,14 @@ describe('Iteration cadence form', () => {
...
@@ -138,13 +157,14 @@ describe('Iteration cadence form', () => {
await
nextTick
();
await
nextTick
();
expect
(
findError
().
exists
()).
toBe
(
false
);
expect
(
findError
().
exists
()).
toBe
(
false
);
expect
(
resolver
Mock
).
toHaveBeenCalledWith
({
expect
(
mutation
Mock
).
toHaveBeenCalledWith
({
input
:
{
input
:
{
groupPath
,
groupPath
,
title
,
title
,
automatic
:
true
,
automatic
:
true
,
startDate
,
startDate
,
durationInWeeks
,
durationInWeeks
,
rollOver
,
iterationsInAdvance
,
iterationsInAdvance
,
active
:
true
,
active
:
true
,
description
:
''
,
description
:
''
,
...
@@ -173,7 +193,7 @@ describe('Iteration cadence form', () => {
...
@@ -173,7 +193,7 @@ describe('Iteration cadence form', () => {
it
(
'
does not submit if required fields missing
'
,
()
=>
{
it
(
'
does not submit if required fields missing
'
,
()
=>
{
clickSave
();
clickSave
();
expect
(
resolver
Mock
).
not
.
toHaveBeenCalled
();
expect
(
mutation
Mock
).
not
.
toHaveBeenCalled
();
expect
(
findTitleGroup
().
text
()).
toContain
(
'
This field is required
'
);
expect
(
findTitleGroup
().
text
()).
toContain
(
'
This field is required
'
);
expect
(
findStartDateGroup
().
text
()).
toContain
(
'
This field is required
'
);
expect
(
findStartDateGroup
().
text
()).
toContain
(
'
This field is required
'
);
expect
(
findDurationGroup
().
text
()).
toContain
(
'
This field is required
'
);
expect
(
findDurationGroup
().
text
()).
toContain
(
'
This field is required
'
);
...
@@ -181,8 +201,8 @@ describe('Iteration cadence form', () => {
...
@@ -181,8 +201,8 @@ describe('Iteration cadence form', () => {
});
});
it
(
'
loading=false on error
'
,
async
()
=>
{
it
(
'
loading=false on error
'
,
async
()
=>
{
resolver
Mock
=
jest
.
fn
().
mockResolvedValue
(
createMutationFailure
);
mutation
Mock
=
jest
.
fn
().
mockResolvedValue
(
createMutationFailure
);
createComponent
({
resolver
Mock
});
createComponent
({
mutation
Mock
});
clickSave
();
clickSave
();
...
@@ -226,12 +246,13 @@ describe('Iteration cadence form', () => {
...
@@ -226,12 +246,13 @@ describe('Iteration cadence form', () => {
await
nextTick
();
await
nextTick
();
expect
(
resolver
Mock
).
toHaveBeenCalledWith
({
expect
(
mutation
Mock
).
toHaveBeenCalledWith
({
input
:
{
input
:
{
groupPath
,
groupPath
,
title
,
title
,
automatic
:
false
,
automatic
:
false
,
startDate
,
startDate
,
rollOver
:
false
,
durationInWeeks
:
0
,
durationInWeeks
:
0
,
iterationsInAdvance
:
0
,
iterationsInAdvance
:
0
,
description
:
''
,
description
:
''
,
...
@@ -249,11 +270,12 @@ describe('Iteration cadence form', () => {
...
@@ -249,11 +270,12 @@ describe('Iteration cadence form', () => {
describe
(
'
Edit cadence
'
,
()
=>
{
describe
(
'
Edit cadence
'
,
()
=>
{
const
query
=
getCadence
;
const
query
=
getCadence
;
const
resolverMock
=
jest
.
fn
().
mockResolvedValue
(
getCadenceSuccess
);
const
resolverMock
=
jest
.
fn
().
mockResolvedValue
(
getCadenceSuccess
);
const
mutationMock
=
jest
.
fn
().
mockResolvedValue
(
createMutationSuccess
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
$router
.
currentRoute
.
params
.
cadenceId
=
id
;
$router
.
currentRoute
.
params
.
cadenceId
=
id
;
createComponent
({
query
,
resolverMock
});
createComponent
({
query
,
resolverMock
,
mutation
:
updateCadence
,
mutationMock
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -280,7 +302,7 @@ describe('Iteration cadence form', () => {
...
@@ -280,7 +302,7 @@ describe('Iteration cadence form', () => {
});
});
it
(
'
fills fields with existing cadence info after loading
'
,
async
()
=>
{
it
(
'
fills fields with existing cadence info after loading
'
,
async
()
=>
{
createComponent
({
query
,
resolverMock
});
createComponent
({
query
,
resolverMock
,
mutation
:
updateCadence
});
await
waitForPromises
();
await
waitForPromises
();
...
@@ -288,8 +310,9 @@ describe('Iteration cadence form', () => {
...
@@ -288,8 +310,9 @@ describe('Iteration cadence form', () => {
expect
(
findTitle
().
element
.
value
).
toBe
(
iterationCadence
.
title
);
expect
(
findTitle
().
element
.
value
).
toBe
(
iterationCadence
.
title
);
expect
(
findStartDate
().
element
.
value
).
toBe
(
iterationCadence
.
startDate
);
expect
(
findStartDate
().
element
.
value
).
toBe
(
iterationCadence
.
startDate
);
expect
(
findFutureIterations
().
element
.
value
).
toBe
(
iterationCadence
.
iterationsInAdvance
);
expect
(
findFutureIterations
().
element
.
value
).
toBe
(
`
${
iterationCadence
.
iterationsInAdvance
}
`
);
expect
(
findDuration
().
element
.
value
).
toBe
(
iterationCadence
.
durationInWeeks
);
expect
(
findDuration
().
element
.
value
).
toBe
(
`
${
iterationCadence
.
durationInWeeks
}
`
);
expect
(
findRollOver
().
element
.
checked
).
toBe
(
iterationCadence
.
rollOver
);
expect
(
findDescription
().
element
.
value
).
toBe
(
iterationCadence
.
description
);
expect
(
findDescription
().
element
.
value
).
toBe
(
iterationCadence
.
description
);
});
});
...
@@ -300,5 +323,22 @@ describe('Iteration cadence form', () => {
...
@@ -300,5 +323,22 @@ describe('Iteration cadence form', () => {
expect
(
findSaveAndStartButton
().
exists
()).
toBe
(
false
);
expect
(
findSaveAndStartButton
().
exists
()).
toBe
(
false
);
});
});
it
(
'
updates roll over issues checkbox
'
,
async
()
=>
{
const
rollOver
=
true
;
setRollOver
(
rollOver
);
clickSave
();
await
nextTick
();
expect
(
findError
().
exists
()).
toBe
(
false
);
expect
(
mutationMock
).
toHaveBeenCalledWith
({
input
:
{
...
iterationCadence
,
rollOver
,
},
});
});
});
});
});
});
ee/spec/frontend/iterations/mock_data.js
View file @
147ca147
...
@@ -38,15 +38,15 @@ export const mockProjectIterations = {
...
@@ -38,15 +38,15 @@ export const mockProjectIterations = {
};
};
export
const
manualIterationCadence
=
{
export
const
manualIterationCadence
=
{
active
:
true
,
id
:
`gid://gitlab/Iterations::Cadence/72`
,
id
:
`gid://gitlab/Iterations::Cadence/72`
,
title
:
'
A manual iteration cadence
'
,
title
:
'
A manual iteration cadence
'
,
automatic
:
true
,
automatic
:
true
,
rollOver
:
false
,
rollOver
:
false
,
durationInWeeks
:
'
3
'
,
durationInWeeks
:
3
,
description
:
'
The words
'
,
description
:
'
The words
'
,
duration
:
'
3
'
,
startDate
:
'
2020-06-28
'
,
startDate
:
'
2020-06-28
'
,
iterationsInAdvance
:
'
2
'
,
iterationsInAdvance
:
2
,
};
};
export
const
createMutationSuccess
=
{
export
const
createMutationSuccess
=
{
...
...
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