Skip to content

Commit

Permalink
fix helper tests. #280
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 1, 2020
1 parent bdc74aa commit ea2979f
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 47 deletions.
47 changes: 0 additions & 47 deletions tests/integration/helpers/format-author-test.js

This file was deleted.

83 changes: 83 additions & 0 deletions tests/integration/helpers/format-creator-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('helper:format-creator', function(hooks) {
setupRenderingTest(hooks);

test('it renders comma', async function(assert) {
this.set('creators', [
{
'type': 'Person',
'name': 'Empbh R. Goh',
'given-name': 'Empbh R.',
'family-name': 'Goh',
}, {
'type': 'Person',
'name': 'M. Barrgow',
'given-name': 'M.',
'family-name': 'Barrgow',
}, {
'type': 'Person',
'name': 'M. Barrgoe',
'given-name': 'M.',
'family-name': 'Barrgoe',
},
]);

await render(hbs`{{format-creator creators index=0 }}`);

assert.dom('*').hasText(', ');
});

test('it renders ampersand', async function(assert) {
this.set('creators', [
{
'type': 'Person',
'name': 'Empbh R. Goh',
'given-name': 'Empbh R.',
'family-name': 'Goh',
}, {
'type': 'Person',
'name': 'M. Barrgow',
'given-name': 'M.',
'family-name': 'Barrgow',
}, {
'type': 'Person',
'name': 'M. Barrgoe',
'given-name': 'M.',
'family-name': 'Barrgoe',
},
]);

await render(hbs`{{format-creator creators index=1 }}`);

assert.dom('*').hasText(' & ');
});

test('it renders empty space', async function(assert) {
this.set('creators', [
{
'type': 'Person',
'name': 'Empbh R. Goh',
'given-name': 'Empbh R.',
'family-name': 'Goh',
}, {
'type': 'Person',
'name': 'M. Barrgow',
'given-name': 'M.',
'family-name': 'Barrgow',
}, {
'type': 'Person',
'name': 'M. Barrgoe',
'given-name': 'M.',
'family-name': 'Barrgoe',
},
]);

await render(hbs`{{format-creator creators index=2 }}`);

assert.dom('*').hasText('');
});
});

0 comments on commit ea2979f

Please sign in to comment.