Fixed #43
This commit is contained in:
parent
3890336681
commit
c943bc32e9
@ -4,6 +4,7 @@ Yii Framework 2 bootstrap5 extension Change Log
|
|||||||
2.0.4 under development
|
2.0.4 under development
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
- Bug #43: Accordion widget does not set "collapsed" class on toggle button (simialbi)
|
||||||
- Enh #39: Add inline mode to `BaseHtml::checkboxList()` and `BaseHtml::radioList()` (WinterSilence)
|
- Enh #39: Add inline mode to `BaseHtml::checkboxList()` and `BaseHtml::radioList()` (WinterSilence)
|
||||||
- Enh #40: Breadcrumbs refactoring (WinterSilence)
|
- Enh #40: Breadcrumbs refactoring (WinterSilence)
|
||||||
|
|
||||||
|
@ -213,8 +213,12 @@ class Accordion extends Widget
|
|||||||
if ($itemToggleTag === 'a') {
|
if ($itemToggleTag === 'a') {
|
||||||
ArrayHelper::remove($itemToggleOptions, 'data.bs-target');
|
ArrayHelper::remove($itemToggleOptions, 'data.bs-target');
|
||||||
$headerToggle = Html::a($header, '#' . $id, $itemToggleOptions) . "\n";
|
$headerToggle = Html::a($header, '#' . $id, $itemToggleOptions) . "\n";
|
||||||
|
} else {
|
||||||
|
if (!$expand) {
|
||||||
|
Html::addCssClass($itemToggleOptions, ['widget' => 'accordion-button collapsed']);
|
||||||
} else {
|
} else {
|
||||||
Html::addCssClass($itemToggleOptions, ['widget' => 'accordion-button']);
|
Html::addCssClass($itemToggleOptions, ['widget' => 'accordion-button']);
|
||||||
|
}
|
||||||
$headerToggle = Button::widget([
|
$headerToggle = Button::widget([
|
||||||
'label' => $header,
|
'label' => $header,
|
||||||
'encodeLabel' => false,
|
'encodeLabel' => false,
|
||||||
|
@ -82,14 +82,14 @@ class AccordionTest extends TestCase
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="testId" class="testClass accordion-item"><div id="w0-collapse1-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w2" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse1" aria-expanded="false" aria-controls="w0-collapse1">Collapsible Group Item #2</button>
|
<div id="testId" class="testClass accordion-item"><div id="w0-collapse1-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w2" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse1" aria-expanded="false" aria-controls="w0-collapse1">Collapsible Group Item #2</button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse1" class="testContentOptions collapse" aria-labelledby="w0-collapse1-heading" data-bs-parent="#w0">
|
<div id="w0-collapse1" class="testContentOptions collapse" aria-labelledby="w0-collapse1-heading" data-bs-parent="#w0">
|
||||||
<div class="accordion-body">Das ist das Haus vom Nikolaus</div>
|
<div class="accordion-body">Das ist das Haus vom Nikolaus</div>
|
||||||
|
|
||||||
<div class="accordion-footer">Footer</div>
|
<div class="accordion-footer">Footer</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="testId2" class="testClass2 accordion-item"><div id="w0-collapse2-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w3" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse2" aria-expanded="false" aria-controls="w0-collapse2"><h1>Collapsible Group Item #3</h1></button>
|
<div id="testId2" class="testClass2 accordion-item"><div id="w0-collapse2-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w3" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse2" aria-expanded="false" aria-controls="w0-collapse2"><h1>Collapsible Group Item #3</h1></button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse2" class="testContentOptions2 collapse" aria-labelledby="w0-collapse2-heading" data-bs-parent="#w0">
|
<div id="w0-collapse2" class="testContentOptions2 collapse" aria-labelledby="w0-collapse2-heading" data-bs-parent="#w0">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@ -99,7 +99,7 @@ class AccordionTest extends TestCase
|
|||||||
|
|
||||||
<div class="accordion-footer">Footer2</div>
|
<div class="accordion-footer">Footer2</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="testId3" class="testClass3 accordion-item"><div id="w0-collapse3-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w4" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse3" aria-expanded="false" aria-controls="w0-collapse3"><h1>Collapsible Group Item #4</h1></button>
|
<div id="testId3" class="testClass3 accordion-item"><div id="w0-collapse3-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w4" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse3" aria-expanded="false" aria-controls="w0-collapse3"><h1>Collapsible Group Item #4</h1></button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse3" class="testContentOptions3 collapse" aria-labelledby="w0-collapse3-heading" data-bs-parent="#w0">
|
<div id="w0-collapse3" class="testContentOptions3 collapse" aria-labelledby="w0-collapse3-heading" data-bs-parent="#w0">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@ -145,19 +145,19 @@ HTML
|
|||||||
<div class="accordion-body">Content1</div>
|
<div class="accordion-body">Content1</div>
|
||||||
|
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="accordion-item"><div id="w0-collapse1-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w2" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse1" aria-expanded="false" aria-controls="w0-collapse1">Item2</button>
|
<div class="accordion-item"><div id="w0-collapse1-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w2" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse1" aria-expanded="false" aria-controls="w0-collapse1">Item2</button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse1" class="collapse" aria-labelledby="w0-collapse1-heading" data-bs-parent="#w0">
|
<div id="w0-collapse1" class="collapse" aria-labelledby="w0-collapse1-heading" data-bs-parent="#w0">
|
||||||
<div class="accordion-body">Content2</div>
|
<div class="accordion-body">Content2</div>
|
||||||
|
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="accordion-item"><div id="w0-collapse2-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w3" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse2" aria-expanded="false" aria-controls="w0-collapse2">Item3</button>
|
<div class="accordion-item"><div id="w0-collapse2-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w3" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse2" aria-expanded="false" aria-controls="w0-collapse2">Item3</button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse2" class="collapse" aria-labelledby="w0-collapse2-heading" data-bs-parent="#w0">
|
<div id="w0-collapse2" class="collapse" aria-labelledby="w0-collapse2-heading" data-bs-parent="#w0">
|
||||||
<div class="accordion-body">Content3</div>
|
<div class="accordion-body">Content3</div>
|
||||||
|
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="accordion-item"><div id="w0-collapse3-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w4" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse3" aria-expanded="false" aria-controls="w0-collapse3">FormField</button>
|
<div class="accordion-item"><div id="w0-collapse3-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w4" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse3" aria-expanded="false" aria-controls="w0-collapse3">FormField</button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse3" class="collapse" aria-labelledby="w0-collapse3-heading" data-bs-parent="#w0">
|
<div id="w0-collapse3" class="collapse" aria-labelledby="w0-collapse3-heading" data-bs-parent="#w0">
|
||||||
<div class="accordion-body"><div class="form-group field-dynamicmodel-test">
|
<div class="accordion-body"><div class="form-group field-dynamicmodel-test">
|
||||||
@ -186,7 +186,7 @@ HTML
|
|||||||
|
|
||||||
$this->assertEqualsWithoutLE(<<<HTML
|
$this->assertEqualsWithoutLE(<<<HTML
|
||||||
<div id="w0" class="accordion">
|
<div id="w0" class="accordion">
|
||||||
<div class="accordion-item"><div id="w0-collapse0-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w1" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#w0-collapse0" aria-expanded="false" aria-controls="w0-collapse0">Item1</button>
|
<div class="accordion-item"><div id="w0-collapse0-heading" class="accordion-header"><h5 class="mb-0"><button type="button" id="w1" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#w0-collapse0" aria-expanded="false" aria-controls="w0-collapse0">Item1</button>
|
||||||
</h5></div>
|
</h5></div>
|
||||||
<div id="w0-collapse0" class="collapse" aria-labelledby="w0-collapse0-heading" data-bs-parent="#w0">
|
<div id="w0-collapse0" class="collapse" aria-labelledby="w0-collapse0-heading" data-bs-parent="#w0">
|
||||||
<div class="accordion-body">Content1</div>
|
<div class="accordion-body">Content1</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user