mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix invalid markup in SelectionGroup selected values
This commit is contained in:
parent
625f7b4eee
commit
2512761587
@ -2,7 +2,7 @@
|
|||||||
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
|
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
|
||||||
<% loop $FieldSet %>
|
<% loop $FieldSet %>
|
||||||
<% if $Selected %>
|
<% if $Selected %>
|
||||||
<li$Selected>
|
<li class="selected">
|
||||||
$RadioLabel
|
$RadioLabel
|
||||||
$FieldHolder
|
$FieldHolder
|
||||||
</li>
|
</li>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
|
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
|
||||||
<% loop $FieldSet %>
|
<% loop $FieldSet %>
|
||||||
<li$Selected>
|
<li <% if Selected %>class="selected"<% end_if %>>
|
||||||
<label>{$RadioButton} {$RadioLabel}</label>
|
<label>{$RadioButton} {$RadioLabel}</label>
|
||||||
<% if $FieldList %>
|
<% if $FieldList %>
|
||||||
$FieldHolder
|
$FieldHolder
|
||||||
|
@ -41,6 +41,33 @@ class SelectionGroupTest extends SapphireTest
|
|||||||
$this->assertContains('two view', (string)$listElTwo->div);
|
$this->assertContains('two view', (string)$listElTwo->div);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testSelectedFieldHolder()
|
||||||
|
{
|
||||||
|
$items = array(
|
||||||
|
new SelectionGroup_Item(
|
||||||
|
'one',
|
||||||
|
new LiteralField('one', 'one view'),
|
||||||
|
'one title'
|
||||||
|
),
|
||||||
|
new SelectionGroup_Item(
|
||||||
|
'two',
|
||||||
|
new LiteralField('two', 'two view'),
|
||||||
|
'two title'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$field = new SelectionGroup('MyGroup', $items);
|
||||||
|
$field->setValue('two');
|
||||||
|
|
||||||
|
$parser = new CSSContentParser($field->FieldHolder());
|
||||||
|
$listEls = $parser->getBySelector('li');
|
||||||
|
$listElOne = $listEls[0];
|
||||||
|
$listElTwo = $listEls[1];
|
||||||
|
|
||||||
|
$this->assertEquals('one', (string)$listElOne->label[0]->input[0]['value']);
|
||||||
|
$this->assertEquals('two', (string)$listElTwo->label[0]->input[0]['value']);
|
||||||
|
$this->assertEquals('selected', (string)$listElTwo->attributes()->class);
|
||||||
|
}
|
||||||
|
|
||||||
function testLegacyItemsFieldHolder()
|
function testLegacyItemsFieldHolder()
|
||||||
{
|
{
|
||||||
$items = array(
|
$items = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user