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
da7d3ef2
Commit
da7d3ef2
authored
Nov 11, 2020
by
Angelo Gulina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update check on features object for cases where not defined
parent
f964c97c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app/assets/javascripts/helpers/startup_css_helper.js
app/assets/javascripts/helpers/startup_css_helper.js
+1
-1
spec/frontend/helpers/startup_css_helper_spec.js
spec/frontend/helpers/startup_css_helper_spec.js
+20
-0
No files found.
app/assets/javascripts/helpers/startup_css_helper.js
View file @
da7d3ef2
...
...
@@ -32,7 +32,7 @@ const handleStartupEvents = () => {
action();
-*/
export
const
waitForCSSLoaded
=
(
action
=
()
=>
{})
=>
{
if
(
!
gon
.
features
.
startupCss
||
allLinksLoaded
())
{
if
(
!
gon
?.
features
?
.
startupCss
||
allLinksLoaded
())
{
return
new
Promise
(
resolve
=>
{
action
();
resolve
();
...
...
spec/frontend/helpers/startup_css_helper_spec.js
View file @
da7d3ef2
...
...
@@ -19,6 +19,26 @@ describe('waitForCSSLoaded', () => {
});
});
describe
(
'
when gon features is not provided
'
,
()
=>
{
let
originalGon
;
beforeEach
(()
=>
{
originalGon
=
window
.
gon
;
window
.
gon
=
null
;
});
afterEach
(()
=>
{
window
.
gon
=
originalGon
;
});
it
(
'
should invoke the action right away
'
,
async
()
=>
{
const
events
=
waitForCSSLoaded
(
mockedCallback
);
await
events
;
expect
(
mockedCallback
).
toHaveBeenCalledTimes
(
1
);
});
});
describe
(
'
with startup css disabled
'
,
()
=>
{
gon
.
features
=
{
startupCss
:
false
,
...
...
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