Skip to content

Commit

Permalink
pass placeholder, autofocus and spellcheck through to the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rlivsey committed Oct 14, 2015
1 parent 06be559 commit f19ef19
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addon/components/content-kit-editor/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default Component.extend({
tagName: 'article',
classNames: ['content-kit-editor'],

placeholder: 'Write here...',
spellcheck: true,
autofocus: true,

init() {
this._super(...arguments);
let mobiledoc = this.get('mobiledoc');
Expand Down Expand Up @@ -135,6 +139,9 @@ export default Component.extend({
let editor = new window.ContentKit.Editor({
mobiledoc,
cards: this.get('cards') || [],
placeholder: this.get('placeholder'),
autofocus: this.get('autofocus'),
spellcheck: this.get('spellcheck'),
cardOptions: {
onAddComponentCard: (element, cardName, env, payload) => {
let cardId = Ember.uuid();
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/components/content-kit-editor/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ test('it renders a yielded toolbar content-kit', function(assert) {
);
});

test('it displays a custom placeholder', function(assert) {
assert.expect(1);
this.render(hbs`
{{content-kit-editor placeholder="Write something in me"}}
`);
assert.equal(
this.$('[data-placeholder]').data("placeholder"),
'Write something in me'
);
});

test('passes through spellcheck option', function(assert) {
assert.expect(1);
this.render(hbs`
{{content-kit-editor spellcheck=false}}
`);
assert.equal(
this.$('[spellcheck]').attr('spellcheck'),
"false"
);
});


test('it bolds the text and fires `on-change`', function(assert) {
assert.expect(2);
Expand Down

0 comments on commit f19ef19

Please sign in to comment.