{"size": 1018, "ext": "js", "max_stars_repo_path": "tests/integration/components/input-money-test.js", "max_stars_repo_name": "vlad-pyjamabosses/ember-vmaskmoney", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/integration/components/input-money-test.js", "max_issues_repo_name": "vlad-pyjamabosses/ember-vmaskmoney", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/integration/components/input-money-test.js", "max_forks_repo_name": "vlad-pyjamabosses/ember-vmaskmoney", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.7894736842, "max_line_length": 128, "alphanum_fraction": 0.637524558}
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('input-money', 'Integration | Component | input money', {
  integration: true
});

test('money', function(assert) {
  this.set('amount', 0);

  this.render(hbs`{{input-money number=amount thousands='.' decimal=',' prefix='R$ ' }}`);

  this.set('amount', 1234.56);

  assert.equal(this.$('input').val(), 'R$ 1.234,56');
});

test('number', function(assert) {
  this.set('amount', 0);

  this.render(hbs`{{input-money number=amount thousands='.' decimal=',' suffix=' %' }}`);

  this.$('input').val('1.234,56 %');
  this.$('input').change();

  assert.equal(this.get('amount'), 1234.56);
});

test('without decimals', function(assert) {
  this.set('amount', 0);

  this.render(hbs`{{input-money number=amount thousands='.' allowDecimal=false decimal='' precision=0 suffix='' preffix='$'}}`);

  this.$('input').val('$100');
  this.$('input').change();

  assert.equal(this.get('amount'), 100);
});