Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 5d91d18

Browse files
authored
Merge pull request #221 from ckeditor/t/220
Feature: Implemented placeholder in `InputTextView`. Closes #220.
2 parents 8ad3474 + 450cedb commit 5d91d18

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/inputtext/inputtextview.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export default class InputTextView extends View {
3838
*/
3939
this.set( 'id' );
4040

41+
/**
42+
* The `placeholder` attribute of the input.
43+
*
44+
* @observable
45+
* @member {String} #placeholder
46+
*/
47+
this.set( 'placeholder' );
48+
4149
const bind = this.bindTemplate;
4250

4351
this.template = new Template( {
@@ -48,7 +56,8 @@ export default class InputTextView extends View {
4856
'ck-input',
4957
'ck-input-text'
5058
],
51-
id: bind.to( 'id' )
59+
id: bind.to( 'id' ),
60+
placeholder: bind.to( 'placeholder' )
5261
}
5362
} );
5463

tests/inputtext/inputtextview.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ describe( 'InputTextView', () => {
5656
expect( view.element.id ).to.equal( 'baz' );
5757
} );
5858
} );
59+
60+
describe( 'placeholder', () => {
61+
it( 'should react on view#placeholder', () => {
62+
expect( view.element.placeholder ).to.equal( '' );
63+
64+
view.placeholder = 'baz';
65+
66+
expect( view.element.placeholder ).to.equal( 'baz' );
67+
} );
68+
} );
5969
} );
6070

6171
describe( 'select()', () => {

0 commit comments

Comments
 (0)