import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('f-account', 'Integration | Component | f account', {
  integration: true
});

test('it renders', function(assert) {
  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{f-account}}`);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    {{#f-account}}
      template block text
    {{/f-account}}
  `);

  assert.equal(this.$().text().trim(), 'template block text');
});

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('f-account', 'Integration | Component | f account', {
  integration: true
});

const accountStub = Ember.Object.create({
  name: 'name',
  email: 'email',
  phone: 'phone'
});

test('it can be submitted', function(assert) {
  this.on('submit', () => { assert.ok(true); })

  this.render(hbs`{{f-account submit=(action 'submit')}}`);
  this.$('button').click()
});

test('it bound to account model', function(assert) {
  this.set('account', accountStub);
  this.on('submit', () => {});

  this.render(hbs`{{f-account account=account submit=(action 'submit')}}`);
  this.$('input').val('new name');
  this.$('input').change();
  this.$('button').click();

  assert.ok(this.get('account.name') == 'new name');
});

Add test suite for f-account component