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
7f66e8ad
Commit
7f66e8ad
authored
Apr 18, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests
parent
9ec58d8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
icons_helper.rb
app/helpers/icons_helper.rb
+1
-1
icons_helper_spec.rb
spec/helpers/icons_helper_spec.rb
+13
-0
No files found.
app/helpers/icons_helper.rb
View file @
7f66e8ad
...
@@ -7,7 +7,7 @@ module IconsHelper
...
@@ -7,7 +7,7 @@ module IconsHelper
# font-awesome-rails gem, but should we ever use a different icon pack in the
# font-awesome-rails gem, but should we ever use a different icon pack in the
# future we won't have to change hundreds of method calls.
# future we won't have to change hundreds of method calls.
def
icon
(
names
,
options
=
{})
def
icon
(
names
,
options
=
{})
if
!
options
[
'aria-hidden'
]
and
!
options
[
'aria-label'
]
if
(
options
.
keys
&
%w[aria-hidden aria-label]
).
empty?
# Add `aria-hidden` if there are no aria's set
# Add `aria-hidden` if there are no aria's set
options
[
'aria-hidden'
]
=
true
options
[
'aria-hidden'
]
=
true
end
end
...
...
spec/helpers/icons_helper_spec.rb
View file @
7f66e8ad
require
'spec_helper'
require
'spec_helper'
describe
IconsHelper
do
describe
IconsHelper
do
describe
'icon'
do
it
'returns aria-hidden by default'
do
star
=
icon
(
'star'
)
expect
(
star
[
'aria-hidden'
]).
to
eq
'aria-hidden'
end
it
'does not return aria-hidden if aria-label is set'
do
up
=
icon
(
'up'
,
'aria-label'
=>
'up'
)
expect
(
up
[
'aria-hidden'
]).
to
eq
nil
expect
(
up
[
'aria-label'
]).
to
eq
'aria-label'
end
end
describe
'file_type_icon_class'
do
describe
'file_type_icon_class'
do
it
'returns folder class'
do
it
'returns folder class'
do
expect
(
file_type_icon_class
(
'folder'
,
0
,
'folder_name'
)).
to
eq
'folder'
expect
(
file_type_icon_class
(
'folder'
,
0
,
'folder_name'
)).
to
eq
'folder'
...
...
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