Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e6450be6
Commit
e6450be6
authored
Nov 26, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6150: `yii\bootstrap\Tabs` dropdown IDs were generated incorrectly
parent
25a7c84e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
3 deletions
+94
-3
CHANGELOG.md
extensions/bootstrap/CHANGELOG.md
+1
-0
Tabs.php
extensions/bootstrap/Tabs.php
+4
-3
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
BootstrapTestCase.php
tests/unit/extensions/bootstrap/BootstrapTestCase.php
+16
-0
TabsTest.php
tests/unit/extensions/bootstrap/TabsTest.php
+72
-0
No files found.
extensions/bootstrap/CHANGELOG.md
View file @
e6450be6
...
...
@@ -5,6 +5,7 @@ Yii Framework 2 bootstrap extension Change Log
-----------------------
-
Bug #5570:
`yii\bootstrap\Tabs`
would throw an exception if
`content`
is not set for one of its
`items`
(RomeroMsk)
-
Bug #6150:
`yii\bootstrap\Tabs`
dropdown IDs were generated incorrectly (samdark)
-
Enh #4181: Added
`yii\bootstrap\Modal::$headerOptions`
and
`yii\bootstrap\Modal::$footerOptions`
(tuxoff, samdark)
-
Enh #4450: Added
`yii\bootstrap\Nav::renderDropdown()`
(qiangxue)
-
Enh #5735: Added
`yii\bootstrap\Tabs::renderTabContent`
to support manually rendering tab contents (RomeroMsk)
...
...
extensions/bootstrap/Tabs.php
View file @
e6450be6
...
...
@@ -154,7 +154,7 @@ class Tabs extends Widget
$label
.=
' <b class="caret"></b>'
;
Html
::
addCssClass
(
$headerOptions
,
'dropdown'
);
if
(
$this
->
renderDropdown
(
$item
[
'items'
],
$panes
))
{
if
(
$this
->
renderDropdown
(
$
n
,
$
item
[
'items'
],
$panes
))
{
Html
::
addCssClass
(
$headerOptions
,
'active'
);
}
...
...
@@ -202,12 +202,13 @@ class Tabs extends Widget
/**
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
* configure `panes` accordingly.
* @param string $itemNumber number of the item
* @param array $items the dropdown items configuration.
* @param array $panes the panes reference array.
* @return boolean whether any of the dropdown items is `active` or not.
* @throws InvalidConfigException
*/
protected
function
renderDropdown
(
&
$items
,
&
$panes
)
protected
function
renderDropdown
(
$itemNumber
,
&
$items
,
&
$panes
)
{
$itemActive
=
false
;
...
...
@@ -228,7 +229,7 @@ class Tabs extends Widget
$itemActive
=
true
;
}
$options
[
'id'
]
=
ArrayHelper
::
getValue
(
$options
,
'id'
,
$this
->
options
[
'id'
]
.
'-dd-tab'
.
$n
);
$options
[
'id'
]
=
ArrayHelper
::
getValue
(
$options
,
'id'
,
$this
->
options
[
'id'
]
.
'-dd
'
.
$itemNumber
.
'
-tab'
.
$n
);
$item
[
'url'
]
=
'#'
.
$options
[
'id'
];
$item
[
'linkOptions'
][
'data-toggle'
]
=
'tab'
;
...
...
framework/CHANGELOG.md
View file @
e6450be6
...
...
@@ -34,6 +34,7 @@ Yii Framework 2 Change Log
-
Bug #6172:
`yii\rbac\DbManager`
should properly quote table and column names (qiangxue)
-
Bug #6164: Added missing support for
`yii\db\Expression`
to QueryBuilder
`BETWEEN`
and
`LIKE`
conditions (cebe)
-
Bug #6236: No JS scripts should be registered when
`yii\widgets\ActiveForm::enableClientScript`
is false (qiangxue)
-
Bug #6150:
`yii\bootstrap\Tabs`
dropdown IDs were generated incorrectly (samdark)
-
Bug #6266: Clicking on reset button does not hide error summary when using
`ActiveForm`
(InteLigent, qiangxue)
-
Bug #6271: Query caching returns the same data when running the same SQL with different fetch modes (grachov)
-
Bug: Gii console command help information does not contain global options (qiangxue)
...
...
tests/unit/extensions/bootstrap/BootstrapTestCase.php
0 → 100644
View file @
e6450be6
<?php
namespace
yiiunit\extensions\bootstrap
;
use
yiiunit\TestCase
;
/**
* BootstrapTestCase is the base class for all bootstrap extension test cases
*/
abstract
class
BootstrapTestCase
extends
TestCase
{
public
function
setUp
()
{
$this
->
mockWebApplication
();
}
}
\ No newline at end of file
tests/unit/extensions/bootstrap/TabsTest.php
0 → 100644
View file @
e6450be6
<?php
namespace
yiiunit\extensions\bootstrap
;
use
yii\bootstrap\Tabs
;
/**
* Tests for Tabs widget
*/
class
TabsTest
extends
BootstrapTestCase
{
/**
* Each tab should have a corresponding unique ID
*
* @see https://github.com/yiisoft/yii2/issues/6150
*/
public
function
testIds
()
{
$out
=
Tabs
::
widget
([
'items'
=>
[
[
'label'
=>
'Page1'
,
'content'
=>
'Page1'
,
],
[
'label'
=>
'Dropdown1'
,
'items'
=>
[
[
'label'
=>
'Page2'
,
'content'
=>
'Page2'
],
[
'label'
=>
'Page3'
,
'content'
=>
'Page3'
],
]
],
[
'label'
=>
'Dropdown2'
,
'items'
=>
[
[
'label'
=>
'Page4'
,
'content'
=>
'Page4'
],
[
'label'
=>
'Page5'
,
'content'
=>
'Page5'
],
]
]
]
]);
$page1
=
'w0-tab0'
;
$page2
=
'w0-dd1-tab0'
;
$page3
=
'w0-dd1-tab1'
;
$page4
=
'w0-dd2-tab0'
;
$page5
=
'w0-dd2-tab1'
;
$shouldContain
=
[
'w0'
,
// nav widget container
"#
$page1
"
,
// Page1
'w1'
,
// Dropdown1
"
$page2
"
,
// Page2
"
$page3
"
,
// Page3
'w2'
,
// Dropdown2
"#
$page4
"
,
// Page4
"#
$page5
"
,
// Page5
// containers
"id=
\"
$page1
\"
"
,
"id=
\"
$page2
\"
"
,
"id=
\"
$page3
\"
"
,
"id=
\"
$page4
\"
"
,
"id=
\"
$page5
\"
"
,
];
foreach
(
$shouldContain
as
$string
)
{
$this
->
assertContains
(
$string
,
$out
);
}
}
}
\ No newline at end of file
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