import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { htmlSafe } from '@ember/template';

module('Integration | Component | froala-content', function(hooks) {
  setupRenderingTest(hooks);

  test('.fr-view class is applied', async function(assert) {
    await render(hbs`<FroalaContent />`);
    assert.dom('div').hasClass('fr-view');
  });

  test('custom class names are applied', async function(assert) {
    assert.expect(2);
    await render(hbs`<FroalaContent class="foobar" />`);
    assert.dom('div').hasClass('fr-view');
    assert.dom('div').hasClass('foobar');
  });

  test('@content is output inside the block', async function(assert) {
    this.set('content', htmlSafe('foobar'))
    await render(hbs`<FroalaContent @content={{this.content}} />`);
    assert.equal(this.element.textContent.trim(), 'foobar');
  });

  test("block content is properly yield'ed", async function(assert) {
    this.set('content', htmlSafe('foobar'))
    await render(hbs`<FroalaContent>{{this.content}}</FroalaContent>`);
    assert.equal(this.element.textContent.trim(), 'foobar');
  });

});

@@ -463,24 +463,150 @@
 ');%0A  %7D);%0A%0A 
+ // Test fails on scenarios %3C ember 3.9%0A  // https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill/issues/62%0A  //
  test('custo
@@ -655,24 +655,27 @@
 (assert) %7B%0A 
+ //
    assert.ex
@@ -680,24 +680,27 @@
 expect(2);%0A 
+ //
    await ren
@@ -736,32 +736,35 @@
 %22foobar%22 /%3E%60);%0A 
+ //
    assert.dom('d
@@ -786,24 +786,27 @@
 fr-view');%0A 
+ //
    assert.do
@@ -826,32 +826,195 @@
 lass('foobar');%0A
+  // %7D);%0A%0A  test('passed in id is applied', async function(assert) %7B%0A    await render(hbs%60%3CFroalaContent id=%22myEditor%22 /%3E%60);%0A    assert.dom('#myEditor').exists();%0A
   %7D);%0A%0A  test('@

Change splattributes test to work around class bug