Skip to content

Commit

Permalink
Add integration test - image-cover component
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeurant authored and [a525125] Coulaud Baptiste committed Dec 18, 2019
1 parent a234d0c commit 9385946
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/integration/components/image-cover-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | image cover', function(hooks) {
setupRenderingTest(hooks);

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

await render(hbs`{{image-cover name='akira'}}`);

assert.notEqual(find('img'), null);
assert.ok(find('img').classList.contains('cover'));
assert.ok(find('img').src.indexOf("/assets/images/comics/covers/akira.jpg") >= 0);
});

test('renders image-cover - root is image', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });

await render(hbs`{{image-cover name='akira'}}`);

assert.ok(this.element.firstElementChild.tagName === 'IMG');
assert.ok(this.element.firstElementChild.classList.contains('cover'));
assert.ok(this.element.firstElementChild.src.indexOf("/assets/images/comics/covers/akira.jpg") >= 0);
});
});

0 comments on commit 9385946

Please sign in to comment.