Compare commits

..

No commits in common. "656598a63c1980a243dd12d6c73903647b22269a" and "5f7fb8828928b047fb6617fb4556e827159b036e" have entirely different histories.

2 changed files with 1 additions and 18 deletions

View File

@ -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;
}

View File

@ -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()