This commit is contained in:
Andrew Paxley 2024-10-22 05:30:41 +13:00 committed by GitHub
commit 1086cc0a7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -139,7 +139,6 @@ trait SearchableDropdownTrait
return $emptyString; return $emptyString;
} }
} }
$name = $this->getName();
if ($this->getUseDynamicPlaceholder()) { if ($this->getUseDynamicPlaceholder()) {
if ($this->getIsSearchable()) { if ($this->getIsSearchable()) {
if (!$this->getIsLazyLoaded()) { if (!$this->getIsLazyLoaded()) {
@ -598,6 +597,9 @@ trait SearchableDropdownTrait
$field->setSource($this->sourceList); $field->setSource($this->sourceList);
$field->setReadonly(true); $field->setReadonly(true);
// Remove the text "Type to search..." on a read-only field
// $field->setPlaceholder('');
return $field; return $field;
} }
} }

View File

@ -73,6 +73,8 @@ class SearchableDropdownTraitTest extends SapphireTest
$this->assertSame('My empty string', $field->getPlaceholder()); $this->assertSame('My empty string', $field->getPlaceholder());
$field->setPlaceholder('My placeholder'); $field->setPlaceholder('My placeholder');
$this->assertSame('My placeholder', $field->getPlaceholder()); $this->assertSame('My placeholder', $field->getPlaceholder());
$readonlyField = $field->performReadonlyTransformation();
$this->assertSame('', $readonlyField->getPlaceholder());
} }
public function testSeachContext(): void public function testSeachContext(): void