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
128ba518
Commit
128ba518
authored
Apr 06, 2021
by
Paul Gascou-Vaillancourt
Committed by
Miguel Rincon
Apr 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show the first hint popover after selecting a template type
parent
52c4b9a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
1 deletion
+79
-1
app/assets/javascripts/blob/file_template_selector.js
app/assets/javascripts/blob/file_template_selector.js
+13
-0
app/assets/javascripts/blob/suggest_gitlab_ci_yml/components/popover.vue
...scripts/blob/suggest_gitlab_ci_yml/components/popover.vue
+0
-1
changelogs/unreleased/fix-suggest-gitlab-ci-popover.yml
changelogs/unreleased/fix-suggest-gitlab-ci-popover.yml
+5
-0
spec/frontend/blob/file_template_selector_spec.js
spec/frontend/blob/file_template_selector_spec.js
+61
-0
No files found.
app/assets/javascripts/blob/file_template_selector.js
View file @
128ba518
...
...
@@ -38,6 +38,19 @@ export default class FileTemplateSelector {
}
this
.
$wrapper
.
removeClass
(
'
hidden
'
);
/**
* We set the focus on the dropdown that was just shown. This is done so that, after selecting
* a template type, the template selector immediately receives the focus.
* This improves the UX of the tour as the suggest_gitlab_ci_yml popover requires its target to
* be have the focus to appear. This way, users don't have to interact with the template
* selector to actually see the first hint: it is shown as soon as the selector becomes visible.
* We also need a timeout here, otherwise the template type selector gets stuck and can not be
* closed anymore.
*/
setTimeout
(()
=>
{
this
.
$dropdown
.
focus
();
},
0
);
}
hide
()
{
...
...
app/assets/javascripts/blob/suggest_gitlab_ci_yml/components/popover.vue
View file @
128ba518
...
...
@@ -108,7 +108,6 @@ export default {
show
:target=
"target"
placement=
"right"
trigger=
"manual"
container=
"viewport"
:css-classes=
"['suggest-gitlab-ci-yml', 'ml-4']"
>
...
...
changelogs/unreleased/fix-suggest-gitlab-ci-popover.yml
0 → 100644
View file @
128ba518
---
title
:
Ensures that the "Suggest GitLab CI" popover is shown after selecting a template type
merge_request
:
58120
author
:
type
:
fixed
spec/frontend/blob/file_template_selector_spec.js
0 → 100644
View file @
128ba518
import
$
from
'
jquery
'
;
import
FileTemplateSelector
from
'
~/blob/file_template_selector
'
;
describe
(
'
FileTemplateSelector
'
,
()
=>
{
let
subject
;
let
dropdown
;
let
wrapper
;
const
createSubject
=
()
=>
{
subject
=
new
FileTemplateSelector
({});
subject
.
config
=
{
dropdown
,
wrapper
,
};
subject
.
initDropdown
=
jest
.
fn
();
};
afterEach
(()
=>
{
subject
=
null
;
});
describe
(
'
show method
'
,
()
=>
{
beforeEach
(()
=>
{
dropdown
=
document
.
createElement
(
'
div
'
);
wrapper
=
document
.
createElement
(
'
div
'
);
wrapper
.
classList
.
add
(
'
hidden
'
);
createSubject
();
});
it
(
'
calls init on first call
'
,
()
=>
{
jest
.
spyOn
(
subject
,
'
init
'
);
subject
.
show
();
expect
(
subject
.
init
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
does not call init on subsequent calls
'
,
()
=>
{
jest
.
spyOn
(
subject
,
'
init
'
);
subject
.
show
();
subject
.
show
();
expect
(
subject
.
init
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
removes hidden class from $wrapper
'
,
()
=>
{
expect
(
$
(
wrapper
).
hasClass
(
'
hidden
'
)).
toBe
(
true
);
subject
.
show
();
expect
(
$
(
wrapper
).
hasClass
(
'
hidden
'
)).
toBe
(
false
);
});
it
(
'
sets the focus on the dropdown
'
,
async
()
=>
{
subject
.
show
();
jest
.
spyOn
(
subject
.
$dropdown
,
'
focus
'
);
jest
.
runAllTimers
();
expect
(
subject
.
$dropdown
.
focus
).
toHaveBeenCalled
();
});
});
});
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