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
3816b49d
Commit
3816b49d
authored
Jun 17, 2020
by
Natalia Tepluhina
Committed by
Nicolò Maria Mezzopera
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Input field for new design discussion should remain focused
parent
5cbcc865
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
3 deletions
+43
-3
app/assets/javascripts/design_management/components/design_notes/design_reply_form.vue
..._management/components/design_notes/design_reply_form.vue
+4
-1
app/assets/javascripts/design_management/pages/design/index.vue
...sets/javascripts/design_management/pages/design/index.vue
+4
-0
changelogs/unreleased/217170-when-clicking-multiple-times-to-leave-a-single-comment-the-input-f.yml
...-multiple-times-to-leave-a-single-comment-the-input-f.yml
+6
-0
spec/frontend/design_management/pages/design/index_spec.js
spec/frontend/design_management/pages/design/index_spec.js
+29
-2
No files found.
app/assets/javascripts/design_management/components/design_notes/design_reply_form.vue
View file @
3816b49d
...
@@ -62,7 +62,7 @@ export default {
...
@@ -62,7 +62,7 @@ export default {
},
},
},
},
mounted
()
{
mounted
()
{
this
.
$refs
.
textarea
.
focus
();
this
.
focusInput
();
},
},
methods
:
{
methods
:
{
submitForm
()
{
submitForm
()
{
...
@@ -75,6 +75,9 @@ export default {
...
@@ -75,6 +75,9 @@ export default {
this
.
$emit
(
'
cancelForm
'
);
this
.
$emit
(
'
cancelForm
'
);
}
}
},
},
focusInput
()
{
this
.
$refs
.
textarea
.
focus
();
},
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/design_management/pages/design/index.vue
View file @
3816b49d
...
@@ -254,6 +254,9 @@ export default {
...
@@ -254,6 +254,9 @@ export default {
},
},
openCommentForm
(
annotationCoordinates
)
{
openCommentForm
(
annotationCoordinates
)
{
this
.
annotationCoordinates
=
annotationCoordinates
;
this
.
annotationCoordinates
=
annotationCoordinates
;
if
(
this
.
$refs
.
newDiscussionForm
)
{
this
.
$refs
.
newDiscussionForm
.
focusInput
();
}
},
},
closeCommentForm
()
{
closeCommentForm
()
{
this
.
comment
=
''
;
this
.
comment
=
''
;
...
@@ -361,6 +364,7 @@ export default {
...
@@ -361,6 +364,7 @@ export default {
@error="onCreateImageDiffNoteError"
@error="onCreateImageDiffNoteError"
>
>
<design-reply-form
<design-reply-form
ref=
"newDiscussionForm"
v-model=
"comment"
v-model=
"comment"
:is-saving=
"loading"
:is-saving=
"loading"
:markdown-preview-path=
"markdownPreviewPath"
:markdown-preview-path=
"markdownPreviewPath"
...
...
changelogs/unreleased/217170-when-clicking-multiple-times-to-leave-a-single-comment-the-input-f.yml
0 → 100644
View file @
3816b49d
---
title
:
When clicking multiple times to leave a single comment, the input field should
remain focused
merge_request
:
33742
author
:
type
:
fixed
spec/frontend/design_management/pages/design/index_spec.js
View file @
3816b49d
...
@@ -5,7 +5,7 @@ import { ApolloMutation } from 'vue-apollo';
...
@@ -5,7 +5,7 @@ import { ApolloMutation } from 'vue-apollo';
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
DesignIndex
from
'
~/design_management/pages/design/index.vue
'
;
import
DesignIndex
from
'
~/design_management/pages/design/index.vue
'
;
import
DesignSidebar
from
'
~/design_management/components/design_sidebar.vue
'
;
import
DesignSidebar
from
'
~/design_management/components/design_sidebar.vue
'
;
import
Design
ReplyForm
from
'
~/design_management/components/design_notes/design_reply_form
.vue
'
;
import
Design
Presentation
from
'
~/design_management/components/design_presentation
.vue
'
;
import
createImageDiffNoteMutation
from
'
~/design_management/graphql/mutations/createImageDiffNote.mutation.graphql
'
;
import
createImageDiffNoteMutation
from
'
~/design_management/graphql/mutations/createImageDiffNote.mutation.graphql
'
;
import
design
from
'
../../mock_data/design
'
;
import
design
from
'
../../mock_data/design
'
;
import
mockResponseWithDesigns
from
'
../../mock_data/designs
'
;
import
mockResponseWithDesigns
from
'
../../mock_data/designs
'
;
...
@@ -26,6 +26,15 @@ jest.mock('mousetrap', () => ({
...
@@ -26,6 +26,15 @@ jest.mock('mousetrap', () => ({
unbind
:
jest
.
fn
(),
unbind
:
jest
.
fn
(),
}));
}));
const
focusInput
=
jest
.
fn
();
const
DesignReplyForm
=
{
template
:
'
<div><textarea ref="textarea"></textarea></div>
'
,
methods
:
{
focusInput
,
},
};
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueRouter
);
localVue
.
use
(
VueRouter
);
...
@@ -64,6 +73,7 @@ describe('Design management design index page', () => {
...
@@ -64,6 +73,7 @@ describe('Design management design index page', () => {
const
findDiscussionForm
=
()
=>
wrapper
.
find
(
DesignReplyForm
);
const
findDiscussionForm
=
()
=>
wrapper
.
find
(
DesignReplyForm
);
const
findSidebar
=
()
=>
wrapper
.
find
(
DesignSidebar
);
const
findSidebar
=
()
=>
wrapper
.
find
(
DesignSidebar
);
const
findDesignPresentation
=
()
=>
wrapper
.
find
(
DesignPresentation
);
function
createComponent
(
loading
=
false
,
data
=
{})
{
function
createComponent
(
loading
=
false
,
data
=
{})
{
const
$apollo
=
{
const
$apollo
=
{
...
@@ -83,6 +93,7 @@ describe('Design management design index page', () => {
...
@@ -83,6 +93,7 @@ describe('Design management design index page', () => {
stubs
:
{
stubs
:
{
ApolloMutation
,
ApolloMutation
,
DesignSidebar
,
DesignSidebar
,
DesignReplyForm
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -153,13 +164,29 @@ describe('Design management design index page', () => {
...
@@ -153,13 +164,29 @@ describe('Design management design index page', () => {
},
},
});
});
wrapper
.
vm
.
openCommentForm
(
{
x
:
0
,
y
:
0
});
findDesignPresentation
().
vm
.
$emit
(
'
openCommentForm
'
,
{
x
:
0
,
y
:
0
});
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findDiscussionForm
().
exists
()).
toBe
(
true
);
expect
(
findDiscussionForm
().
exists
()).
toBe
(
true
);
});
});
});
});
it
(
'
keeps new discussion form focused
'
,
()
=>
{
createComponent
(
false
,
{
design
:
{
...
design
,
discussions
:
{
nodes
:
[],
},
},
annotationCoordinates
,
});
findDesignPresentation
().
vm
.
$emit
(
'
openCommentForm
'
,
{
x
:
10
,
y
:
10
});
expect
(
focusInput
).
toHaveBeenCalled
();
});
it
(
'
sends a mutation on submitting form and closes form
'
,
()
=>
{
it
(
'
sends a mutation on submitting form and closes form
'
,
()
=>
{
createComponent
(
false
,
{
createComponent
(
false
,
{
design
:
{
design
:
{
...
...
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