Fix test failures

This commit is contained in:
Ignacio Bona 2018-09-14 17:10:45 -07:00
parent cab1e699f8
commit 24cb936b5e
3 changed files with 4 additions and 74 deletions

View File

@ -45,6 +45,8 @@ export default class AvatarImage extends Component {
* @memberof AvatarImage
*/
onImageFallback(): void {
set(this, 'src', this.avatar.imageUrlFallback);
if (!this.isDestroyed) {
set(this, 'src', this.avatar.imageUrlFallback);
}
}
}

View File

@ -7,5 +7,6 @@ module.exports = {
'ember-concurrency': '^0.8.18', //https://github.com/cibernox/ember-power-calendar/pull/135
'ember-compatibility-helpers': '0.1.3 || 1.0.0-beta.1 || ^1.0.0',
'ember-getowner-polyfill': '1.2.5 || ^2.2.0', //https://github.com/asross/dynamic-link/pull/10
'@ember-decorators/utils': '0.2.0 || ^2.4.1'
}
};

View File

@ -1,73 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, waitUntil } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
const platformsResponse = {
platforms: [
{
name: 'platform1'
},
{
name: 'platform2'
}
]
};
module('Integration | Component | search/containers/search sources', function(hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function() {
this.sinonServer = sinon.createFakeServer();
this.sinonServer.respondImmediately = true;
});
hooks.afterEach(function() {
this.sinonServer.restore();
});
test('it renders', async function(assert) {
this.sinonServer.respondWith('GET', /\/api\/v2\/list\/platforms/, [
200,
{ 'Content-Type': 'application/json' },
JSON.stringify(platformsResponse)
]);
await render(hbs`
{{#search/containers/search-sources}}
<div class="inner-content">Yielded Content</div>
{{/search/containers/search-sources}}
`);
await waitUntil(() => find('.inner-content'));
assert.equal(this.element.textContent.trim(), 'Yielded Content', 'inner content is rendered');
});
test('Platform sources yielded', async function(assert) {
this.sinonServer.respondWith('GET', /\/api\/v2\/list\/platforms/, [
200,
{ 'Content-Type': 'application/json' },
JSON.stringify(platformsResponse)
]);
await render(hbs`
{{#search/containers/search-sources as |container|}}
<span class="inner-content">
{{#each container.radioSources as |source|}}
{{source.value}}
{{/each}}
</span>
{{/search/containers/search-sources}}
`);
await waitUntil(() => find('.inner-content'));
const text = document.querySelector('.inner-content').textContent.trim();
assert.ok(
['all', 'platform1', 'platform2'].reduce((acc, curr) => acc && text.includes(curr), true),
'it yields platform sources and `all`'
);
});
});