Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENHANCEMENT Added OptionsetField->setDisabledItems() to allow specifi…
…cally disabling certain checkboxes ENHANCEMENT Added CheckboxSetField->setDefaultItems() to tick specified checkboxes regardless of the value passed git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@99596 467b73ca-7a2a-4603-9d3b-597d59a354a9
- Loading branch information
Showing
4 changed files
with
114 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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'], | ||
'' | ||
); | ||
} | ||
} |