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
Boxiang Sun
gitlab-ce
Commits
76b078ce
Commit
76b078ce
authored
Feb 07, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve gl.utils.handleLocationHash tests
parent
bc13687c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
changelogs/unreleased/improve-handleLocationHash-tests.yml
changelogs/unreleased/improve-handleLocationHash-tests.yml
+4
-0
spec/javascripts/lib/utils/common_utils_spec.js.es6
spec/javascripts/lib/utils/common_utils_spec.js.es6
+25
-4
No files found.
changelogs/unreleased/improve-handleLocationHash-tests.yml
0 → 100644
View file @
76b078ce
---
title
:
Improve gl.utils.handleLocationHash tests
merge_request
:
author
:
spec/javascripts/lib/utils/common_utils_spec.js.es6
View file @
76b078ce
...
...
@@ -43,14 +43,35 @@ require('~/lib/utils/common_utils');
describe('gl.utils.handleLocationHash', () => {
beforeEach(() => {
window.history.pushState({}, null, '#definição'
);
spyOn(window.document, 'getElementById').and.callThrough(
);
});
function expectGetElementIdToHaveBeenCalledWith(elementId) {
expect(window.document.getElementById).toHaveBeenCalledWith(elementId);
}
it('decodes hash parameter', () => {
spyOn(window.document, 'getElementById').and.callThrough();
window.history.pushState({}, null, '#random-hash');
gl.utils.handleLocationHash();
expectGetElementIdToHaveBeenCalledWith('random-hash');
expectGetElementIdToHaveBeenCalledWith('user-content-random-hash');
});
it('decodes cyrillic hash parameter', () => {
window.history.pushState({}, null, '#definição');
gl.utils.handleLocationHash();
expect(window.document.getElementById).toHaveBeenCalledWith('definição');
expect(window.document.getElementById).toHaveBeenCalledWith('user-content-definição');
expectGetElementIdToHaveBeenCalledWith('definição');
expectGetElementIdToHaveBeenCalledWith('user-content-definição');
});
it('decodes encoded cyrillic hash parameter', () => {
window.history.pushState({}, null, '#defini%C3%A7%C3%A3o');
gl.utils.handleLocationHash();
expectGetElementIdToHaveBeenCalledWith('definição');
expectGetElementIdToHaveBeenCalledWith('user-content-definição');
});
});
...
...
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