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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
2d649256
Commit
2d649256
authored
Mar 02, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up potential for build finish event to fire for wrong menu
parent
c4801e2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+3
-4
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+1
-1
No files found.
app/assets/javascripts/awards_handler.js
View file @
2d649256
...
@@ -154,8 +154,7 @@ AwardsHandler.prototype.showEmojiMenu = function showEmojiMenu($addBtn) {
...
@@ -154,8 +154,7 @@ AwardsHandler.prototype.showEmojiMenu = function showEmojiMenu($addBtn) {
};
};
// Create the emoji menu with the first category of emojis.
// Create the emoji menu with the first category of emojis.
// Then after the emoji menu has been expanded(and CSS transition has ended),
// Then render the remaining categories of emojis one by one to avoid jank.
// render the remaining categories of emojis one by one to avoid jank.
AwardsHandler
.
prototype
.
createEmojiMenu
=
function
createEmojiMenu
(
callback
)
{
AwardsHandler
.
prototype
.
createEmojiMenu
=
function
createEmojiMenu
(
callback
)
{
if
(
this
.
isCreatingEmojiMenu
)
{
if
(
this
.
isCreatingEmojiMenu
)
{
return
;
return
;
...
@@ -199,7 +198,8 @@ AwardsHandler
...
@@ -199,7 +198,8 @@ AwardsHandler
// Avoid the jank and render the remaining categories separately
// Avoid the jank and render the remaining categories separately
// This will take more time, but makes UI more responsive
// This will take more time, but makes UI more responsive
const
emojiContentElement
=
document
.
querySelector
(
'
.emoji-menu .emoji-menu-content
'
);
const
menu
=
document
.
querySelector
(
'
.emoji-menu
'
);
const
emojiContentElement
=
menu
.
querySelector
(
'
.emoji-menu-content
'
);
const
remainingCategories
=
Object
.
keys
(
categoryMap
).
slice
(
1
);
const
remainingCategories
=
Object
.
keys
(
categoryMap
).
slice
(
1
);
const
allCategoriesAddedPromise
=
remainingCategories
.
reduce
(
const
allCategoriesAddedPromise
=
remainingCategories
.
reduce
(
(
promiseChain
,
categoryNameKey
)
=>
(
promiseChain
,
categoryNameKey
)
=>
...
@@ -222,7 +222,6 @@ AwardsHandler
...
@@ -222,7 +222,6 @@ AwardsHandler
allCategoriesAddedPromise
.
then
(()
=>
{
allCategoriesAddedPromise
.
then
(()
=>
{
// Used for tests
// Used for tests
// We check for the menu in case it was destroyed in the meantime
// We check for the menu in case it was destroyed in the meantime
const
menu
=
document
.
querySelector
(
'
.emoji-menu
'
);
if
(
menu
)
{
if
(
menu
)
{
menu
.
dispatchEvent
(
new
CustomEvent
(
'
build-emoji-menu-finish
'
));
menu
.
dispatchEvent
(
new
CustomEvent
(
'
build-emoji-menu-finish
'
));
}
}
...
...
spec/javascripts/awards_handler_spec.js
View file @
2d649256
...
@@ -216,7 +216,7 @@ const AwardsHandler = require('~/awards_handler');
...
@@ -216,7 +216,7 @@ const AwardsHandler = require('~/awards_handler');
});
});
});
});
describe
(
'
emoji menu
'
,
function
()
{
describe
(
'
emoji menu
'
,
function
()
{
const
emojiSelector
=
'
[data-name=
sunglasses
]
'
;
const
emojiSelector
=
'
[data-name=
"sunglasses"
]
'
;
const
openEmojiMenuAndAddEmoji
=
function
()
{
const
openEmojiMenuAndAddEmoji
=
function
()
{
return
openAndWaitForEmojiMenu
()
return
openAndWaitForEmojiMenu
()
.
then
(()
=>
{
.
then
(()
=>
{
...
...
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