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
bcf81d82
Commit
bcf81d82
authored
Feb 03, 2017
by
Andrey Krivko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken anchor links when special characters are used
parent
412ab17d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
app/assets/javascripts/lib/utils/common_utils.js.es6
app/assets/javascripts/lib/utils/common_utils.js.es6
+3
-0
changelogs/unreleased/fix-anchor-scrolling.yml
changelogs/unreleased/fix-anchor-scrolling.yml
+4
-0
spec/javascripts/lib/utils/common_utils_spec.js.es6
spec/javascripts/lib/utils/common_utils_spec.js.es6
+13
-0
No files found.
app/assets/javascripts/lib/utils/common_utils.js.es6
View file @
bcf81d82
...
@@ -69,6 +69,9 @@
...
@@ -69,6 +69,9 @@
var hash = w.gl.utils.getLocationHash();
var hash = w.gl.utils.getLocationHash();
if (!hash) return;
if (!hash) return;
// This is required to handle non-unicode characters in hash
hash = decodeURIComponent(hash);
var navbar = document.querySelector('.navbar-gitlab');
var navbar = document.querySelector('.navbar-gitlab');
var subnav = document.querySelector('.layout-nav');
var subnav = document.querySelector('.layout-nav');
var fixedTabs = document.querySelector('.js-tabs-affix');
var fixedTabs = document.querySelector('.js-tabs-affix');
...
...
changelogs/unreleased/fix-anchor-scrolling.yml
0 → 100644
View file @
bcf81d82
---
title
:
Fix broken anchor links when special characters are used
merge_request
:
8961
author
:
Andrey Krivko
spec/javascripts/lib/utils/common_utils_spec.js.es6
View file @
bcf81d82
...
@@ -41,6 +41,19 @@ require('~/lib/utils/common_utils');
...
@@ -41,6 +41,19 @@ require('~/lib/utils/common_utils');
});
});
});
});
describe('gl.utils.handleLocationHash', () => {
beforeEach(() => {
window.history.pushState({}, null, '#definição');
});
it('decodes hash parameter', () => {
spyOn(window.document, 'getElementById').and.callThrough();
gl.utils.handleLocationHash();
expect(window.document.getElementById).toHaveBeenCalledWith('definição');
expect(window.document.getElementById).toHaveBeenCalledWith('user-content-definição');
});
});
describe('gl.utils.getParameterByName', () => {
describe('gl.utils.getParameterByName', () => {
beforeEach(() => {
beforeEach(() => {
window.history.pushState({}, null, '?scope=all&p=2');
window.history.pushState({}, null, '?scope=all&p=2');
...
...
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