BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9aafb2a6
Commit
9aafb2a6
authored
Feb 07, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve-handleLocationHash-tests' into 'master'
Improve gl.utils.handleLocationHash tests See merge request !9040
parents
3848856a
76b078ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
improve-handleLocationHash-tests.yml
changelogs/unreleased/improve-handleLocationHash-tests.yml
+4
-0
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 @
9aafb2a6
---
title
:
Improve gl.utils.handleLocationHash tests
merge_request
:
author
:
spec/javascripts/lib/utils/common_utils_spec.js.es6
View file @
9aafb2a6
...
...
@@ -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