Skip to content

Commit 7fa7336

Browse files
committed
Fix placeholder compatibility
1 parent 8febf0c commit 7fa7336

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Html/Editor/Fields/Select2.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ public function allowClear(bool $state = true): static
1818
return $this->opts(['allowClear' => $state]);
1919
}
2020

21+
/**
22+
* @param string $value
23+
* @return $this
24+
*/
25+
public function placeholder(string $value): static
26+
{
27+
return $this->optsPlaceholder($value);
28+
}
29+
2130
/**
2231
* @param string $text
2332
* @param string $id

tests/FieldTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ public function it_can_create_select2_field()
196196
$field->processPaginatedResults('username', 'user_id');
197197
$this->assertStringContainsString('e.text = e.username', $field->opts['ajax']['processResults']);
198198
$this->assertStringContainsString('e.id = e.user_id', $field->opts['ajax']['processResults']);
199+
200+
$field->placeholder('New Placeholder');
201+
$this->assertEquals('New Placeholder', $field->opts['placeholder']['text']);
199202
}
200203

201204
/** @test */

0 commit comments

Comments
 (0)