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
Léo-Paul Géneau
gitlab-ce
Commits
5202c3f0
Commit
5202c3f0
authored
Dec 05, 2017
by
Alexis Reigel
Committed by
Alexis Reigel
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix resetFavicon so that it actually resets
parent
67fe0a17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+2
-1
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+1
-1
spec/javascripts/lib/utils/common_utils_spec.js
spec/javascripts/lib/utils/common_utils_spec.js
+8
-3
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
5202c3f0
...
...
@@ -393,8 +393,9 @@ export const setFavicon = (faviconPath) => {
export
const
resetFavicon
=
()
=>
{
const
faviconEl
=
document
.
getElementById
(
'
favicon
'
);
const
originalFavicon
=
faviconEl
?
faviconEl
.
getAttribute
(
'
href
'
)
:
null
;
if
(
faviconEl
)
{
const
originalFavicon
=
faviconEl
.
getAttribute
(
'
data-default-href
'
);
faviconEl
.
setAttribute
(
'
href
'
,
originalFavicon
);
}
};
...
...
app/views/layouts/_head.html.haml
View file @
5202c3f0
...
...
@@ -25,7 +25,7 @@
%title
=
page_title
(
site_name
)
%meta
{
name:
"description"
,
content:
page_description
}
=
favicon_link_tag
favicon
,
id:
'favicon'
=
favicon_link_tag
favicon
,
id:
'favicon'
,
:'data-default-href'
:
favicon
=
stylesheet_link_tag
"application"
,
media:
"all"
=
stylesheet_link_tag
"print"
,
media:
"print"
...
...
spec/javascripts/lib/utils/common_utils_spec.js
View file @
5202c3f0
...
...
@@ -395,6 +395,7 @@ describe('common_utils', () => {
const
favicon
=
document
.
createElement
(
'
link
'
);
favicon
.
setAttribute
(
'
id
'
,
'
favicon
'
);
favicon
.
setAttribute
(
'
href
'
,
'
default/favicon
'
);
favicon
.
setAttribute
(
'
data-default-href
'
,
'
default/favicon
'
);
document
.
body
.
appendChild
(
favicon
);
});
...
...
@@ -413,7 +414,7 @@ describe('common_utils', () => {
beforeEach
(()
=>
{
const
favicon
=
document
.
createElement
(
'
link
'
);
favicon
.
setAttribute
(
'
id
'
,
'
favicon
'
);
favicon
.
setAttribute
(
'
href
'
,
'
default/favicon
'
);
favicon
.
setAttribute
(
'
data-original-
href
'
,
'
default/favicon
'
);
document
.
body
.
appendChild
(
favicon
);
});
...
...
@@ -421,7 +422,9 @@ describe('common_utils', () => {
document
.
body
.
removeChild
(
document
.
getElementById
(
'
favicon
'
));
});
it
(
'
should reset page favicon to tanuki
'
,
()
=>
{
it
(
'
should reset page favicon to the default icon
'
,
()
=>
{
const
favicon
=
document
.
getElementById
(
'
favicon
'
);
favicon
.
setAttribute
(
'
href
'
,
'
new/favicon
'
);
commonUtils
.
resetFavicon
();
expect
(
document
.
getElementById
(
'
favicon
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
default/favicon
'
);
});
...
...
@@ -434,6 +437,8 @@ describe('common_utils', () => {
beforeEach
(()
=>
{
const
favicon
=
document
.
createElement
(
'
link
'
);
favicon
.
setAttribute
(
'
id
'
,
'
favicon
'
);
favicon
.
setAttribute
(
'
href
'
,
'
null
'
);
favicon
.
setAttribute
(
'
data-original-href
'
,
faviconDataUrl
);
document
.
body
.
appendChild
(
favicon
);
mock
=
new
MockAdapter
(
axios
);
});
...
...
@@ -449,7 +454,7 @@ describe('common_utils', () => {
commonUtils
.
setCiStatusFavicon
(
BUILD_URL
)
.
then
(()
=>
{
const
favicon
=
document
.
getElementById
(
'
favicon
'
);
expect
(
favicon
.
getAttribute
(
'
href
'
)).
toEqual
(
'
null
'
);
expect
(
favicon
.
getAttribute
(
'
href
'
)).
toEqual
(
faviconDataUrl
);
done
();
})
// Error is already caught in catch() block of setCiStatusFavicon,
...
...
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