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

Commit

Permalink
Merge pull request #221 from ckeditor/t/220
Browse files Browse the repository at this point in the history
Feature: Implemented placeholder in `InputTextView`. Closes #220.
  • Loading branch information
oskarwrobel authored May 8, 2017
2 parents 8ad3474 + 450cedb commit 5d91d18
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/inputtext/inputtextview.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export default class InputTextView extends View {
*/
this.set( 'id' );

/**
* The `placeholder` attribute of the input.
*
* @observable
* @member {String} #placeholder
*/
this.set( 'placeholder' );

const bind = this.bindTemplate;

this.template = new Template( {
Expand All @@ -48,7 +56,8 @@ export default class InputTextView extends View {
'ck-input',
'ck-input-text'
],
id: bind.to( 'id' )
id: bind.to( 'id' ),
placeholder: bind.to( 'placeholder' )
}
} );

Expand Down
10 changes: 10 additions & 0 deletions tests/inputtext/inputtextview.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ describe( 'InputTextView', () => {
expect( view.element.id ).to.equal( 'baz' );
} );
} );

describe( 'placeholder', () => {
it( 'should react on view#placeholder', () => {
expect( view.element.placeholder ).to.equal( '' );

view.placeholder = 'baz';

expect( view.element.placeholder ).to.equal( 'baz' );
} );
} );
} );

describe( 'select()', () => {
Expand Down

0 comments on commit 5d91d18

Please sign in to comment.