Skip to content

Commit

Permalink
Merge pull request #38 from mnoble01/master
Browse files Browse the repository at this point in the history
Allow configurable content classes
  • Loading branch information
PoslinskiNet authored Aug 19, 2018
2 parents a7255ad + 26f2d6a commit fb00557
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addon/components/pell-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ 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();
},
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/components/pell-editor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 fb00557

Please sign in to comment.