mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 09:05:32 +00:00
Compare commits
No commits in common. "63cfb0d5916954b38f5fadac1931ba3506c7cd5a" and "845794fb99cad27912a24bb9f8eea0f3d32f77c9" have entirely different histories.
63cfb0d591
...
845794fb99
@ -27,8 +27,7 @@ class ReadonlyTagField extends TagField
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// only get the selected options
|
||||
foreach ($this->getOptions(true) as $option) {
|
||||
foreach ($this->getOptions()->filter('Selected', true) as $option) {
|
||||
$options[] = $option->Title;
|
||||
}
|
||||
|
||||
|
@ -408,22 +408,6 @@ class TagFieldTest extends SapphireTest
|
||||
$field->setTitleField('Name');
|
||||
$readOnlyField = $field->performReadonlyTransformation();
|
||||
$this->assertEquals('Name', $readOnlyField->getTitleField());
|
||||
|
||||
// Also check Field options
|
||||
$field = new TagField('Tags', '', TagFieldTestBlogTag::get());
|
||||
$field->setTitleField('Title');
|
||||
$field->setValue(['Tag1']);
|
||||
|
||||
// When not read only (and not lazy-loading) all source options are returned
|
||||
$htmlText = $field->Field();
|
||||
$this->assertStringContainsString('Tag1', $htmlText);
|
||||
$this->assertStringContainsString('222', $htmlText);
|
||||
|
||||
// When read only mode, only selected options are returned
|
||||
$readOnlyField = $field->performReadonlyTransformation();
|
||||
$htmlText = $readOnlyField->Field();
|
||||
$this->assertStringContainsString('Tag1', $htmlText);
|
||||
$this->assertStringNotContainsString('222', $htmlText);
|
||||
}
|
||||
|
||||
public function testItDisplaysWithSelectedValuesFromDataList()
|
||||
|
Loading…
x
Reference in New Issue
Block a user