Permalink
Browse files

Allow configurable content classes

  • Loading branch information...
mnoble01 committed Jul 10, 2018
1 parent 44629a5 commit 27637944d61733a0785bf78dbfa6c4fb6eb9ef34
Showing with 18 additions and 3 deletions.
  1. +7 −3 addon/components/pell-editor.js
  2. +11 −0 tests/integration/components/pell-editor-test.js
@@ -16,17 +16,21 @@ export default Component.extend({
didInsertElement() {
this._super(...arguments);
let pellInstance = pell.init(this._options());
const options = this._options();
const pellInstance = pell.init(options);
this.set('pell', pellInstance.querySelector(".pell-content"));
const contentClass = options.classes && options.classes.content || 'pell-content';
const contentClassSelector = `.${contentClass.split(' ').join('.')}`;
this.set('pell', pellInstance.querySelector(contentClassSelector));
this._setValue();
},
_options() {
return Object.assign({}, this.get('pellOptions'), {
element: this.element,
onChange: this.onChange
onChange: this.onChange,
});
},
@@ -54,4 +54,15 @@ describe('Integration | Component | pell editor', function() {
expect(this.get('value')).to.equal('Taadaa!');
});
});
it('respects custom content classes', function() {
this.set('value', 'Initial value');
this.set('pellOptions', {
classes: {
content: 'custom class',
}
});
this.render(hbs`{{pell-editor pellOptions=pellOptions value=value}}`);
expect($('.custom.class').html()).to.equal('Initial value');
});
});

0 comments on commit 2763794

Please sign in to comment.