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
Tatuya Kamada
gitlab-ce
Commits
5bb258cd
Commit
5bb258cd
authored
Jan 13, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phantomJS doesn't allow us to spyOn history.replaceState
parent
639bca43
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
14 deletions
+40
-14
spec/javascripts/bootstrap_linked_tabs_spec.js.es6
spec/javascripts/bootstrap_linked_tabs_spec.js.es6
+14
-6
spec/javascripts/gl_dropdown_spec.js.es6
spec/javascripts/gl_dropdown_spec.js.es6
+1
-0
spec/javascripts/lib/utils/common_utils_spec.js.es6
spec/javascripts/lib/utils/common_utils_spec.js.es6
+1
-1
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+15
-7
spec/javascripts/pipelines_spec.js.es6
spec/javascripts/pipelines_spec.js.es6
+5
-0
spec/javascripts/project_title_spec.js
spec/javascripts/project_title_spec.js
+2
-0
spec/javascripts/right_sidebar_spec.js
spec/javascripts/right_sidebar_spec.js
+2
-0
No files found.
spec/javascripts/bootstrap_linked_tabs_spec.js.es6
View file @
5bb258cd
require('~/lib/utils/bootstrap_linked_tabs');
require('~/lib/utils/bootstrap_linked_tabs');
(() => {
(() => {
// TODO: remove this hack!
// PhantomJS causes spyOn to panic because replaceState isn't "writable"
const phantomjs = !Object.getOwnPropertyDescriptor(window.history, 'replaceState').writable;
describe('Linked Tabs', () => {
describe('Linked Tabs', () => {
preloadFixtures('static/linked_tabs.html.raw');
preloadFixtures('static/linked_tabs.html.raw');
...
@@ -10,7 +14,9 @@ require('~/lib/utils/bootstrap_linked_tabs');
...
@@ -10,7 +14,9 @@ require('~/lib/utils/bootstrap_linked_tabs');
describe('when is initialized', () => {
describe('when is initialized', () => {
beforeEach(() => {
beforeEach(() => {
spyOn(window.history, 'replaceState').and.callFake(function () {});
if (!phantomjs) {
spyOn(window.history, 'replaceState').and.callFake(function () {});
}
});
});
it('should activate the tab correspondent to the given action', () => {
it('should activate the tab correspondent to the given action', () => {
...
@@ -36,7 +42,7 @@ require('~/lib/utils/bootstrap_linked_tabs');
...
@@ -36,7 +42,7 @@ require('~/lib/utils/bootstrap_linked_tabs');
describe('on click', () => {
describe('on click', () => {
it('should change the url according to the clicked tab', () => {
it('should change the url according to the clicked tab', () => {
const historySpy = spyOn(history, 'replaceState').and.callFake(() => {});
const historySpy =
!phantomjs &&
spyOn(history, 'replaceState').and.callFake(() => {});
const linkedTabs = new window.gl.LinkedTabs({ // eslint-disable-line
const linkedTabs = new window.gl.LinkedTabs({ // eslint-disable-line
action: 'show',
action: 'show',
...
@@ -49,10 +55,12 @@ require('~/lib/utils/bootstrap_linked_tabs');
...
@@ -49,10 +55,12 @@ require('~/lib/utils/bootstrap_linked_tabs');
secondTab.click();
secondTab.click();
expect(historySpy).toHaveBeenCalledWith({
if (historySpy) {
turbolinks: true,
expect(historySpy).toHaveBeenCalledWith({
url: newState,
turbolinks: true,
}, document.title, newState);
url: newState,
}, document.title, newState);
}
});
});
});
});
});
});
...
...
spec/javascripts/gl_dropdown_spec.js.es6
View file @
5bb258cd
...
@@ -42,6 +42,7 @@ require('~/lib/utils/type_utility');
...
@@ -42,6 +42,7 @@ require('~/lib/utils/type_utility');
describe('Dropdown', function describeDropdown() {
describe('Dropdown', function describeDropdown() {
preloadFixtures('static/gl_dropdown.html.raw');
preloadFixtures('static/gl_dropdown.html.raw');
loadJSONFixtures('projects.json');
function initDropDown(hasRemote, isFilterable) {
function initDropDown(hasRemote, isFilterable) {
this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({
this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({
...
...
spec/javascripts/lib/utils/common_utils_spec.js.es6
View file @
5bb258cd
...
@@ -12,7 +12,7 @@ require('~/lib/utils/common_utils');
...
@@ -12,7 +12,7 @@ require('~/lib/utils/common_utils');
// element will create an absolute url relative to the current execution context.
// element will create an absolute url relative to the current execution context.
// The JavaScript test suite is executed at '/' which will lead to an absolute url
// The JavaScript test suite is executed at '/' which will lead to an absolute url
// starting with '/'.
// starting with '/'.
expect(gl.utils.parseUrl('" test="asf"').pathname).to
Equal
('/%22%20test=%22asf%22');
expect(gl.utils.parseUrl('" test="asf"').pathname).to
Contain
('/%22%20test=%22asf%22');
});
});
});
});
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
5bb258cd
...
@@ -6,6 +6,10 @@ require('~/lib/utils/common_utils');
...
@@ -6,6 +6,10 @@ require('~/lib/utils/common_utils');
require
(
'
vendor/jquery.scrollTo
'
);
require
(
'
vendor/jquery.scrollTo
'
);
(
function
()
{
(
function
()
{
// TODO: remove this hack!
// PhantomJS causes spyOn to panic because replaceState isn't "writable"
const
phantomjs
=
!
Object
.
getOwnPropertyDescriptor
(
window
.
history
,
'
replaceState
'
).
writable
;
describe
(
'
MergeRequestTabs
'
,
function
()
{
describe
(
'
MergeRequestTabs
'
,
function
()
{
var
stubLocation
=
{};
var
stubLocation
=
{};
var
setLocation
=
function
(
stubs
)
{
var
setLocation
=
function
(
stubs
)
{
...
@@ -22,9 +26,11 @@ require('vendor/jquery.scrollTo');
...
@@ -22,9 +26,11 @@ require('vendor/jquery.scrollTo');
this
.
class
=
new
gl
.
MergeRequestTabs
({
stubLocation
:
stubLocation
});
this
.
class
=
new
gl
.
MergeRequestTabs
({
stubLocation
:
stubLocation
});
setLocation
();
setLocation
();
this
.
spies
=
{
if
(
!
phantomjs
)
{
history
:
spyOn
(
window
.
history
,
'
replaceState
'
).
and
.
callFake
(
function
()
{})
this
.
spies
=
{
};
history
:
spyOn
(
window
.
history
,
'
replaceState
'
).
and
.
callFake
(
function
()
{})
};
}
});
});
describe
(
'
#activateTab
'
,
function
()
{
describe
(
'
#activateTab
'
,
function
()
{
...
@@ -98,10 +104,12 @@ require('vendor/jquery.scrollTo');
...
@@ -98,10 +104,12 @@ require('vendor/jquery.scrollTo');
pathname
:
'
/foo/bar/merge_requests/1
'
pathname
:
'
/foo/bar/merge_requests/1
'
});
});
newState
=
this
.
subject
(
'
commits
'
);
newState
=
this
.
subject
(
'
commits
'
);
expect
(
this
.
spies
.
history
).
toHaveBeenCalledWith
({
if
(
!
phantomjs
)
{
turbolinks
:
true
,
expect
(
this
.
spies
.
history
).
toHaveBeenCalledWith
({
url
:
newState
turbolinks
:
true
,
},
document
.
title
,
newState
);
url
:
newState
},
document
.
title
,
newState
);
}
});
});
it
(
'
treats "show" like "notes"
'
,
function
()
{
it
(
'
treats "show" like "notes"
'
,
function
()
{
setLocation
({
setLocation
({
...
...
spec/javascripts/pipelines_spec.js.es6
View file @
5bb258cd
require('~/pipelines');
require('~/pipelines');
// Fix for phantomJS
if (!Element.prototype.matches && Element.prototype.webkitMatchesSelector) {
Element.prototype.matches = Element.prototype.webkitMatchesSelector;
}
(() => {
(() => {
describe('Pipelines', () => {
describe('Pipelines', () => {
preloadFixtures('static/pipeline_graph.html.raw');
preloadFixtures('static/pipeline_graph.html.raw');
...
...
spec/javascripts/project_title_spec.js
View file @
5bb258cd
...
@@ -15,6 +15,8 @@ require('~/project');
...
@@ -15,6 +15,8 @@ require('~/project');
describe
(
'
Project Title
'
,
function
()
{
describe
(
'
Project Title
'
,
function
()
{
preloadFixtures
(
'
static/project_title.html.raw
'
);
preloadFixtures
(
'
static/project_title.html.raw
'
);
loadJSONFixtures
(
'
projects.json
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'
static/project_title.html.raw
'
);
loadFixtures
(
'
static/project_title.html.raw
'
);
return
this
.
project
=
new
Project
();
return
this
.
project
=
new
Project
();
...
...
spec/javascripts/right_sidebar_spec.js
View file @
5bb258cd
...
@@ -34,6 +34,8 @@ require('~/extensions/jquery.js');
...
@@ -34,6 +34,8 @@ require('~/extensions/jquery.js');
describe
(
'
RightSidebar
'
,
function
()
{
describe
(
'
RightSidebar
'
,
function
()
{
var
fixtureName
=
'
issues/open-issue.html.raw
'
;
var
fixtureName
=
'
issues/open-issue.html.raw
'
;
preloadFixtures
(
fixtureName
);
preloadFixtures
(
fixtureName
);
loadJSONFixtures
(
'
todos.json
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
fixtureName
);
loadFixtures
(
fixtureName
);
this
.
sidebar
=
new
Sidebar
;
this
.
sidebar
=
new
Sidebar
;
...
...
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