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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
687e7dea
Commit
687e7dea
authored
Nov 09, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put Icons Path in Helper
parent
81eaf171
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
spec/helpers/icons_helper_spec.rb
spec/helpers/icons_helper_spec.rb
+9
-6
No files found.
spec/helpers/icons_helper_spec.rb
View file @
687e7dea
...
@@ -19,7 +19,7 @@ describe IconsHelper do
...
@@ -19,7 +19,7 @@ describe IconsHelper do
describe
'sprite_icon_path'
do
describe
'sprite_icon_path'
do
it
'returns relative path'
do
it
'returns relative path'
do
expect
(
sprite_icon_path
())
expect
(
sprite_icon_path
())
.
to
eq
i
mage_path
(
"icons.svg"
)
.
to
eq
i
cons_path
(
)
end
end
context
'when an asset_host is set in the config it will return an absolute local URL'
do
context
'when an asset_host is set in the config it will return an absolute local URL'
do
...
@@ -30,9 +30,8 @@ describe IconsHelper do
...
@@ -30,9 +30,8 @@ describe IconsHelper do
end
end
it
'returns an absolute URL on that asset host'
do
it
'returns an absolute URL on that asset host'
do
gitlab_url
=
Gitlab
.
config
.
gitlab
.
url
expect
(
sprite_icon_path
())
expect
(
sprite_icon_path
())
.
to
eq
i
mage_path
(
"icons.svg"
,
host:
Gitlab
.
config
.
gitlab
.
url
)
.
to
eq
i
cons_path
(
)
end
end
end
end
end
end
...
@@ -42,17 +41,17 @@ describe IconsHelper do
...
@@ -42,17 +41,17 @@ describe IconsHelper do
it
'returns svg icon html'
do
it
'returns svg icon html'
do
expect
(
sprite_icon
(
icon_name
).
to_s
)
expect
(
sprite_icon
(
icon_name
).
to_s
)
.
to
eq
"<svg><use xlink:href=
\"
#{
i
mage_path
(
"icons.svg"
)
}
#
#{
icon_name
}
\"
></use></svg>"
.
to
eq
"<svg><use xlink:href=
\"
#{
i
cons_path
(
)
}
#
#{
icon_name
}
\"
></use></svg>"
end
end
it
'returns svg icon html + size classes'
do
it
'returns svg icon html + size classes'
do
expect
(
sprite_icon
(
icon_name
,
size:
72
).
to_s
)
expect
(
sprite_icon
(
icon_name
,
size:
72
).
to_s
)
.
to
eq
"<svg class=
\"
s72
\"
><use xlink:href=
\"
#{
i
mage_path
(
"icons.svg"
)
}
#
#{
icon_name
}
\"
></use></svg>"
.
to
eq
"<svg class=
\"
s72
\"
><use xlink:href=
\"
#{
i
cons_path
(
)
}
#
#{
icon_name
}
\"
></use></svg>"
end
end
it
'returns svg icon html + size classes + additional class'
do
it
'returns svg icon html + size classes + additional class'
do
expect
(
sprite_icon
(
icon_name
,
size:
72
,
css_class:
'icon-danger'
).
to_s
)
expect
(
sprite_icon
(
icon_name
,
size:
72
,
css_class:
'icon-danger'
).
to_s
)
.
to
eq
"<svg class=
\"
s72 icon-danger
\"
><use xlink:href=
\"
#{
i
mage_path
(
"icons.svg"
)
}#{
icon_name
}
\"
></use></svg>"
.
to
eq
"<svg class=
\"
s72 icon-danger
\"
><use xlink:href=
\"
#{
i
cons_path
(
)
}#{
icon_name
}
\"
></use></svg>"
end
end
end
end
...
@@ -161,4 +160,8 @@ describe IconsHelper do
...
@@ -161,4 +160,8 @@ describe IconsHelper do
expect
(
file_type_icon_class
(
'file'
,
0
,
'CHANGELOG'
)).
to
eq
'file-text-o'
expect
(
file_type_icon_class
(
'file'
,
0
,
'CHANGELOG'
)).
to
eq
'file-text-o'
end
end
end
end
def
icons_path
ActionController
::
Base
.
helpers
.
image_path
(
"icons.svg"
,
host:
Gitlab
.
config
.
gitlab
.
url
)
end
end
end
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