mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
916518e8c5
ENHANCEMENT Added CheckboxSetField->setDefaultItems() to tick specified checkboxes regardless of the value passed (from r99596) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@99664 467b73ca-7a2a-4603-9d3b-597d59a354a9
27 lines
537 B
PHP
27 lines
537 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class OptionsetFieldTest extends SapphireTest {
|
|
function testSetDisabledItems() {
|
|
$f = new OptionsetField(
|
|
'Test',
|
|
false,
|
|
array(0 => 'Zero', 1 => 'One')
|
|
);
|
|
|
|
$f->setDisabledItems(array(0));
|
|
$p = new CSSContentParser($f->Field());
|
|
$item0 = $p->getBySelector('#Test_0');
|
|
$item1 = $p->getBySelector('#Test_1');
|
|
$this->assertEquals(
|
|
(string)$item0[0]['disabled'],
|
|
'disabled'
|
|
);
|
|
$this->assertEquals(
|
|
(string)$item1[0]['disabled'],
|
|
''
|
|
);
|
|
}
|
|
} |