Browse Source

Fixes #137: Remove `role="navbar"` from `yii\bootstrap\NavBar` according to new aria specification

tags/2.0.7
tino415 9 years ago committed by Alexander Makarov
parent
commit
cfe46a2cf1
  1. 1
      CHANGELOG.md
  2. 3
      NavBar.php
  3. 34
      tests/NavBarTest.php

1
CHANGELOG.md

@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #126: `yii\bootstrap\ToggleButtonGroup` was unable to work without model (makroxyz)
- Bug #130: Fixed `yii\bootstrap\Collapse` to use pure numerical value on `content` property (meysampg)
- Bug #137: Remove `role="navbar"` from `yii\bootstrap\NavBar` according to new aria specification (tino415)
2.0.6 March 17, 2016
--------------------

3
NavBar.php

@ -100,9 +100,6 @@ class NavBar extends Widget
} else {
Html::addCssClass($this->options, ['widget' => 'navbar']);
}
if (empty($this->options['role'])) {
$this->options['role'] = 'navigation';
}
$options = $this->options;
$tag = ArrayHelper::remove($options, 'tag', 'nav');
echo Html::beginTag($tag, $options);

34
tests/NavBarTest.php

@ -0,0 +1,34 @@
<?php
namespace yiiunit\extensions\bootstrap;
use yii\bootstrap\NavBar;
/**
* Tests for NavBar widget
*
* @group bootstrap
*/
class NavBarTest extends TestCase
{
public function testRender()
{
NavBar::$counter = 0;
$out = NavBar::widget([
'brandLabel' => 'My Company',
'brandUrl' => '/',
'options' => [
'class' => 'navbar-inverse navbar-static-top navbar-frontend',
],
]);
$expected = <<<EXPECTED
<nav id="w0" class="navbar-inverse navbar-static-top navbar-frontend navbar"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w0-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button><a class="navbar-brand" href="/">My Company</a></div><div id="w0-collapse" class="collapse navbar-collapse"></div></div></nav>
EXPECTED;
$this->assertEqualsWithoutLE($expected, $out);
}
}
Loading…
Cancel
Save