Browse Source

Fixes #143: Fixed `yii\bootstrap\Nav` to use tags according to bootstrap docs

tags/2.0.7
PowerGamer1 8 years ago committed by Alexander Makarov
parent
commit
124848377d
  1. 1
      CHANGELOG.md
  2. 4
      Nav.php
  3. 6
      tests/NavTest.php

1
CHANGELOG.md

@ -9,6 +9,7 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #130: Fixed `yii\bootstrap\Collapse` to use pure numerical value on `content` property (meysampg) - 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) - Bug #137: Remove `role="navbar"` from `yii\bootstrap\NavBar` according to new aria specification (tino415)
- Enh #113: Allow URLs instead of content for Tab Widget Dropdown items (Okeanos) - Enh #113: Allow URLs instead of content for Tab Widget Dropdown items (Okeanos)
- Bug #143: Fixed `yii\bootstrap\Nav` to use tags according to bootstrap docs (PowerGamer1)
2.0.6 March 17, 2016 2.0.6 March 17, 2016
-------------------- --------------------

4
Nav.php

@ -102,7 +102,7 @@ class Nav extends Widget
/** /**
* @var string this property allows you to customize the HTML which is used to generate the drop down caret symbol, * @var string this property allows you to customize the HTML which is used to generate the drop down caret symbol,
* which is displayed next to the button text to indicate the drop down functionality. * which is displayed next to the button text to indicate the drop down functionality.
* Defaults to `null` which means `<b class="caret"></b>` will be used. To disable the caret, set this property to be an empty string. * Defaults to `null` which means `<span class="caret"></span>` will be used. To disable the caret, set this property to be an empty string.
*/ */
public $dropDownCaret; public $dropDownCaret;
/** /**
@ -125,7 +125,7 @@ class Nav extends Widget
$this->params = Yii::$app->request->getQueryParams(); $this->params = Yii::$app->request->getQueryParams();
} }
if ($this->dropDownCaret === null) { if ($this->dropDownCaret === null) {
$this->dropDownCaret = Html::tag('b', '', ['class' => 'caret']); $this->dropDownCaret = '<span class="caret"></span>';
} }
Html::addCssClass($this->options, ['widget' => 'nav']); Html::addCssClass($this->options, ['widget' => 'nav']);
} }

6
tests/NavTest.php

@ -41,7 +41,7 @@ class NavTest extends TestCase
$expected = <<<EXPECTED $expected = <<<EXPECTED
<ul id="w0" class="nav"><li><a href="#">Page1</a></li> <ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li> <li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <span class="caret"></span></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li></ul> <li class="dropdown-header">Page3</li></ul></li></ul>
EXPECTED; EXPECTED;
@ -80,7 +80,7 @@ EXPECTED;
$expected = <<<EXPECTED $expected = <<<EXPECTED
<ul id="w0" class="nav"><li><a href="#">Page1</a></li> <ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="test1" class="test dropdown-menu" data-id="t1"><li class="dropdown-header">Page2</li> <li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <span class="caret"></span></a><ul id="test1" class="test dropdown-menu" data-id="t1"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li></ul> <li class="dropdown-header">Page3</li></ul></li></ul>
EXPECTED; EXPECTED;
@ -112,7 +112,7 @@ EXPECTED;
$expected = <<<EXPECTED $expected = <<<EXPECTED
<ul id="w0" class="nav"><li><a href="#">Page1</a></li> <ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li> <li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <span class="caret"></span></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li> <li class="dropdown-header">Page3</li></ul></li>
<li><a href="#">Page4</a></li></ul> <li><a href="#">Page4</a></li></ul>
EXPECTED; EXPECTED;

Loading…
Cancel
Save