Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0966c6d2
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0966c6d2
编写于
11月 17, 2016
作者:
S
Steffen Rauh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compatibility with Internet Explorer 11 for merge requests
上级
0819d093
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
4 deletion
+63
-4
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+13
-0
app/assets/javascripts/merge_request_tabs.js.es6
app/assets/javascripts/merge_request_tabs.js.es6
+2
-3
changelogs/unreleased/fix-compatibility-with-ie11-for-merge-requests.yml
...leased/fix-compatibility-with-ie11-for-merge-requests.yml
+4
-0
spec/javascripts/lib/utils/common_utils_spec.js.es6
spec/javascripts/lib/utils/common_utils_spec.js.es6
+32
-0
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+12
-1
未找到文件。
app/assets/javascripts/lib/utils/common_utils.js
浏览文件 @
0966c6d2
...
@@ -97,6 +97,19 @@
...
@@ -97,6 +97,19 @@
return
$
(
'
body
'
).
data
(
'
page
'
).
split
(
'
:
'
)[
0
];
return
$
(
'
body
'
).
data
(
'
page
'
).
split
(
'
:
'
)[
0
];
};
};
gl
.
utils
.
parseUrl
=
function
(
url
)
{
var
parser
=
document
.
createElement
(
'
a
'
);
parser
.
href
=
url
;
return
parser
;
};
gl
.
utils
.
parseUrlPathname
=
function
(
url
)
{
var
parsedUrl
=
gl
.
utils
.
parseUrl
(
url
);
// parsedUrl.pathname will return an absolute path for Firefox and a relative path for IE11
// We have to make sure we always have an absolute path.
return
parsedUrl
.
pathname
.
charAt
(
0
)
===
'
/
'
?
parsedUrl
.
pathname
:
'
/
'
+
parsedUrl
.
pathname
;
};
gl
.
utils
.
isMetaKey
=
function
(
e
)
{
gl
.
utils
.
isMetaKey
=
function
(
e
)
{
return
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
return
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
};
};
...
...
app/assets/javascripts/merge_request_tabs.js.es6
浏览文件 @
0966c6d2
...
@@ -225,11 +225,10 @@
...
@@ -225,11 +225,10 @@
// We extract pathname for the current Changes tab anchor href
// We extract pathname for the current Changes tab anchor href
// some pages like MergeRequestsController#new has query parameters on that anchor
// some pages like MergeRequestsController#new has query parameters on that anchor
const url = document.createElement('a');
var urlPathname = gl.utils.parseUrlPathname(source);
url.href = source;
this.ajaxGet({
this.ajaxGet({
url: `${url
.p
athname}.json${location.search}`,
url: `${url
P
athname}.json${location.search}`,
success: (data) => {
success: (data) => {
$('#diffs').html(data.html);
$('#diffs').html(data.html);
...
...
changelogs/unreleased/fix-compatibility-with-ie11-for-merge-requests.yml
0 → 100644
浏览文件 @
0966c6d2
---
title
:
Fix compatibility with Internet Explorer 11 for merge requests
merge_request
:
7525
author
:
Steffen Rauh
spec/javascripts/lib/utils/common_utils_spec.js.es6
0 → 100644
浏览文件 @
0966c6d2
//= require lib/utils/common_utils
(() => {
describe('common_utils', () => {
describe('gl.utils.parseUrl', () => {
it('returns an anchor tag with url', () => {
expect(gl.utils.parseUrl('/some/absolute/url').pathname).toContain('some/absolute/url');
});
it('url is escaped', () => {
// IE11 will return a relative pathname while other browsers will return a full pathname.
// parseUrl uses an anchor element for parsing an url. With relative urls, the anchor
// element will create an absolute url relative to the current execution context.
// The JavaScript test suite is executed at '/teaspoon' which will lead to an absolute
// url starting with '/teaspoon'.
expect(gl.utils.parseUrl('" test="asf"').pathname).toEqual('/teaspoon/%22%20test=%22asf%22');
});
});
describe('gl.utils.parseUrlPathname', () => {
beforeEach(() => {
spyOn(gl.utils, 'parseUrl').and.callFake(url => ({
pathname: url,
}));
});
it('returns an absolute url when given an absolute url', () => {
expect(gl.utils.parseUrlPathname('/some/absolute/url')).toEqual('/some/absolute/url');
});
it('returns an absolute url when given a relative url', () => {
expect(gl.utils.parseUrlPathname('some/relative/url')).toEqual('/some/relative/url');
});
});
});
})();
spec/javascripts/merge_request_tabs_spec.js
浏览文件 @
0966c6d2
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
/*= require merge_request_tabs */
/*= require merge_request_tabs */
//= require breakpoints
//= require breakpoints
//= require lib/utils/common_utils
//= require jquery.scrollTo
(
function
()
{
(
function
()
{
describe
(
'
MergeRequestTabs
'
,
function
()
{
describe
(
'
MergeRequestTabs
'
,
function
()
{
...
@@ -21,13 +23,13 @@
...
@@ -21,13 +23,13 @@
setLocation
();
setLocation
();
this
.
spies
=
{
this
.
spies
=
{
ajax
:
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{}),
history
:
spyOn
(
window
.
history
,
'
replaceState
'
).
and
.
callFake
(
function
()
{})
history
:
spyOn
(
window
.
history
,
'
replaceState
'
).
and
.
callFake
(
function
()
{})
};
};
});
});
describe
(
'
#activateTab
'
,
function
()
{
describe
(
'
#activateTab
'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{});
fixture
.
load
(
'
merge_request_tabs.html
'
);
fixture
.
load
(
'
merge_request_tabs.html
'
);
this
.
subject
=
this
.
class
.
activateTab
;
this
.
subject
=
this
.
class
.
activateTab
;
});
});
...
@@ -51,6 +53,7 @@
...
@@ -51,6 +53,7 @@
describe
(
'
#setCurrentAction
'
,
function
()
{
describe
(
'
#setCurrentAction
'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{});
this
.
subject
=
this
.
class
.
setCurrentAction
;
this
.
subject
=
this
.
class
.
setCurrentAction
;
});
});
it
(
'
changes from commits
'
,
function
()
{
it
(
'
changes from commits
'
,
function
()
{
...
@@ -107,5 +110,13 @@
...
@@ -107,5 +110,13 @@
expect
(
this
.
subject
(
'
show
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
show
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
});
});
});
});
describe
(
'
#loadDiff
'
,
function
()
{
it
(
'
requires an absolute pathname
'
,
function
()
{
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
(
options
)
{
expect
(
options
.
url
).
toEqual
(
'
/foo/bar/merge_requests/1/diffs.json
'
);
});
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
});
});
});
});
}).
call
(
this
);
}).
call
(
this
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录