Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
32366d18
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,体验更适合开发者的 AI 搜索 >>
提交
32366d18
编写于
6月 15, 2015
作者:
R
Robert Speicher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename BlobView to LineHighlighter
上级
1f88d9b5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
13 deletion
+13
-13
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+1
-1
app/assets/javascripts/line_highlighter.js.coffee
app/assets/javascripts/line_highlighter.js.coffee
+3
-3
spec/javascripts/fixtures/line_highlighter.html.haml
spec/javascripts/fixtures/line_highlighter.html.haml
+0
-0
spec/javascripts/line_highlighter_spec.js.coffee
spec/javascripts/line_highlighter_spec.js.coffee
+9
-9
未找到文件。
app/assets/javascripts/dispatcher.js.coffee
浏览文件 @
32366d18
...
...
@@ -87,7 +87,7 @@ class Dispatcher
new
TreeView
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:blob:show'
new
BlobView
()
new
LineHighlighter
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:labels:new'
,
'projects:labels:edit'
new
Labels
()
...
...
app/assets/javascripts/
blob/blob
.js.coffee
→
app/assets/javascripts/
line_highlighter
.js.coffee
浏览文件 @
32366d18
#
BlobView
#
LineHighlighter
#
# Handles single- and multi-line selection and highlight for blob views.
#
...
...
@@ -26,11 +26,11 @@
# </pre>
# </div>
# </div>
class
@
BlobView
class
@
LineHighlighter
# Internal copy of location.hash so we're not dependent on `location` in tests
@
_hash
=
''
# Initialize a
BlobView
object
# Initialize a
LineHighlighter
object
#
# hash - String URL hash for dependency injection in tests
constructor
:
(
hash
=
location
.
hash
)
->
...
...
spec/javascripts/fixtures/
blob
.html.haml
→
spec/javascripts/fixtures/
line_highlighter
.html.haml
浏览文件 @
32366d18
文件已移动
spec/javascripts/
blob/blob
_spec.js.coffee
→
spec/javascripts/
line_highlighter
_spec.js.coffee
浏览文件 @
32366d18
#= require
blob/blob
#= require
line_highlighter
describe
'
BlobView
'
,
->
fixture
.
preload
(
'
blob
.html'
)
describe
'
LineHighlighter
'
,
->
fixture
.
preload
(
'
line_highlighter
.html'
)
clickLine
=
(
number
,
eventData
=
{})
->
if
$
.
isEmptyObject
(
eventData
)
...
...
@@ -11,25 +11,25 @@ describe 'BlobView', ->
$
(
"#L
#{
number
}
"
).
trigger
(
e
).
click
()
beforeEach
->
fixture
.
load
(
'
blob
.html'
)
@
class
=
new
BlobView
()
fixture
.
load
(
'
line_highlighter
.html'
)
@
class
=
new
LineHighlighter
()
@
spies
=
{
__setLocationHash__
:
spyOn
(
@
class
,
'__setLocationHash__'
).
and
.
callFake
->
}
describe
'behavior'
,
->
it
'highlights one line given in the URL hash'
,
->
new
BlobView
(
'#L13'
)
new
LineHighlighter
(
'#L13'
)
expect
(
$
(
'#LC13'
)).
toHaveClass
(
'hll'
)
it
'highlights a range of lines given in the URL hash'
,
->
new
BlobView
(
'#L5-25'
)
new
LineHighlighter
(
'#L5-25'
)
expect
(
$
(
'.hll'
).
length
).
toBe
(
21
)
expect
(
$
(
"#LC
#{
line
}
"
)).
toHaveClass
(
'hll'
)
for
line
in
[
5
..
25
]
it
'scrolls to the first highlighted line on initial load'
,
->
spy
=
spyOn
(
$
,
'scrollTo'
)
new
BlobView
(
'#L5-25'
)
new
LineHighlighter
(
'#L5-25'
)
expect
(
spy
).
toHaveBeenCalledWith
(
'#L5'
,
jasmine
.
anything
())
it
'discards click events'
,
->
...
...
@@ -38,7 +38,7 @@ describe 'BlobView', ->
expect
(
spy
).
toHaveBeenPrevented
()
it
'handles garbage input from the hash'
,
->
func
=
->
new
BlobView
(
'#tree-content-holder'
)
func
=
->
new
LineHighlighter
(
'#tree-content-holder'
)
expect
(
func
).
not
.
toThrow
()
describe
'#clickHandler'
,
->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录