Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/View/Helper/BootstrapHtmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function icon ($icon, $options = []) {
public function faIcon ($icon, $options = []) {
$options = $this->addClass($options, 'fa');
$options = $this->addClass($options, 'fa-'.$icon);
$options += [
'aria-hidden' => 'true'
];

return $this->tag('i', '', $options);
}
Expand All @@ -98,6 +101,9 @@ public function faIcon ($icon, $options = []) {
public function glIcon ($icon, $options = []) {
$options = $this->addClass($options, 'glyphicon');
$options = $this->addClass($options, 'glyphicon-'.$icon);
$options += [
'aria-hidden' => 'true'
];

return $this->tag('i', '', $options);
}
Expand Down
14 changes: 9 additions & 5 deletions tests/TestCase/View/Helper/BootstrapHtmlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,35 @@ public function testIcon () {
// Default icon (Glyphicon)
$this->assertHtml ([
['i' => [
'class' => 'glyphicon glyphicon-'.$type
'class' => 'glyphicon glyphicon-'.$type,
'aria-hidden' => 'true'
]],
'/i'
], $this->Html->icon($type));
$this->assertHtml ([
['i' => [
'class' => $options['class'].' glyphicon glyphicon-'.$type,
'id' => $options['id']
'id' => $options['id'],
'aria-hidden' => 'true'
]],
'/i'
], $this->Html->icon($type, $options));
// FontAwesome icon
$this->assertHtml ([
['i' => [
'class' => 'fa fa-'.$type
'class' => 'fa fa-'.$type,
'aria-hidden' => 'true'
]],
'/i'
], $this->Html->faIcon($type));
$this->assertHtml ([
['i' => [
'class' => $options['class'].' fa fa-'.$type,
'id' => $options['id']
'id' => $options['id'],
'aria-hidden' => 'true'
]],
'/i'
], $this->Html->faIcon($type, $options));
], $this->Html->faIcon($type, $options));
}

public function testLabel () {
Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase/View/Helper/BootstrapPaginatorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public function testPrev () {
]],
['a' => true],
['i' => [
'class' => 'glyphicon glyphicon-chevron-left'
'class' => 'glyphicon glyphicon-chevron-left',
'aria-hidden' => 'true'
]],
'/i', '/a', '/li'
], $this->Paginator->prev('i:chevron-left'));
Expand All @@ -79,7 +80,8 @@ public function testNext () {
'href' => '/index?page=2'
]],
['i' => [
'class' => 'glyphicon glyphicon-chevron-right'
'class' => 'glyphicon glyphicon-chevron-right',
'aria-hidden' => 'true'
]],
'/i', '/a', '/li'
], $this->Paginator->next('i:chevron-right'));
Expand Down
6 changes: 4 additions & 2 deletions tests/TestCase/View/Helper/BootstrapPanelHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public function testHeader () {
'class' => 'panel-title'
]],
['i' => [
'class' => 'glyphicon glyphicon-home'
'class' => 'glyphicon glyphicon-home',
'aria-hidden' => 'true'
]], '/i', ' Home',
'/h4',
'/div'
Expand Down Expand Up @@ -215,7 +216,8 @@ public function testHeader () {
'aria-controls' => '#collapse-2'
]],
['i' => [
'class' => 'glyphicon glyphicon-home'
'class' => 'glyphicon glyphicon-home',
'aria-hidden' => 'true'
]], '/i', ' Home',
'/a',
'/h4',
Expand Down
22 changes: 16 additions & 6 deletions tests/TestCase/View/Helper/BootstrapTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function testEasyIcon() {
'expected' => [
'escape' => false,
'result' => [['i' => [
'class' => 'glyphicon glyphicon-plus'
'class' => 'glyphicon glyphicon-plus',
'aria-hidden' => 'true'
]], '/i']
]
]);
Expand All @@ -98,7 +99,8 @@ public function testEasyIcon() {
'expected' => [
'escape' => false,
'result' => [['i' => [
'class' => 'glyphicon glyphicon-plus'
'class' => 'glyphicon glyphicon-plus',
'aria-hidden' => 'true'
]], '/i', ' Add']
]
]);
Expand All @@ -107,7 +109,8 @@ public function testEasyIcon() {
'expected' => [
'escape' => false,
'result' => ['Add ', ['i' => [
'class' => 'glyphicon glyphicon-plus'
'class' => 'glyphicon glyphicon-plus',
'aria-hidden' => 'true'
]], '/i']
]
]);
Expand Down Expand Up @@ -136,7 +139,8 @@ public function testHelperMethods() {
'class' => 'btn btn-default',
'type' => 'submit'
]], ['i' => [
'class' => 'glyphicon glyphicon-plus'
'class' => 'glyphicon glyphicon-plus',
'aria-hidden' => 'true'
]], '/i', '/button'
], $result) ;
$result = $this->Form->input ('fieldname', [
Expand All @@ -154,7 +158,10 @@ public function testHelperMethods() {
['span' => [
'class' => 'input-group-addon'
]],
['i' => ['class' => 'glyphicon glyphicon-home']], '/i',
['i' => [
'class' => 'glyphicon glyphicon-home',
'aria-hidden' => 'true'
]], '/i',
'/span',
['input' => [
'type' => 'text',
Expand All @@ -165,7 +172,10 @@ public function testHelperMethods() {
['span' => [
'class' => 'input-group-addon'
]],
['i' => ['class' => 'glyphicon glyphicon-plus']], '/i',
['i' => [
'class' => 'glyphicon glyphicon-plus',
'aria-hidden' => 'true'
]], '/i',
'/span',
'/div',
'/div'
Expand Down