Skip to content

Commit

Permalink
Add test for component card
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Oct 7, 2015
1 parent a32bee1 commit dad4bac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"broccoli-funnel": "^0.2.8",
"content-kit-editor": "^0.4.6",
"ember-cli-babel": "^5.1.3",
"ember-cli-htmlbars": "^1.0.0"
"ember-cli-htmlbars": "^1.0.0",
"ember-wormhole": "^0.3.4"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/components/content-kit-editor/component-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { moduleForComponent, test } from 'ember-qunit';
import { selectRange } from 'dummy/tests/helpers/selection';
import hbs from 'htmlbars-inline-precompile';
import createComponentCard from 'ember-content-kit/utils/create-component-card';

function simpleMobileDoc(text) {
return {
Expand Down Expand Up @@ -213,3 +214,18 @@ test('it de-links selected text and fires `on-change`', function(assert) {
'a tag removed'
);
});

test('it adds a component to the content-kit editor', function(assert) {
assert.expect(1);
this.registry.register('template:components/demo-card-editor', hbs`DEMO`);
this.set('cards', [
createComponentCard('demo-card')
]);
this.render(hbs`
{{#content-kit-editor cards=cards as |contentKit|}}
<button {{action contentKit.addCard 'demo-card'}}></button>
{{/content-kit-editor}}
`);
this.$('button').click();
assert.ok(!!this.$(`div:contains(DEMO)`).length, 'Card added');
});

0 comments on commit dad4bac

Please sign in to comment.