fix broken gh-image-uploader tests

This commit is contained in:
Kevin Ansfield 2017-03-17 19:13:38 +02:00
parent 0b867dfb89
commit e143bce0b2
3 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@
{{!-- file selection/drag-n-drop --}}
<div class="upload-form">
{{#gh-file-input multiple=false alt=description action=(action "fileSelected") accept=accept}}
<div class="gh-btn gh-btn-outline"><span>{{description}}</span></div>
<div class="gh-btn gh-btn-outline" data-test-file-input-description><span>{{description}}</span></div>
{{/gh-file-input}}
</div>
{{/if}}

View File

@ -100,7 +100,7 @@ describe('Acceptance: Settings - General', function () {
click('.fullscreen-modal .modal-content .gh-image-uploader .image-cancel');
andThen(() => {
expect(find('.fullscreen-modal .modal-content .gh-image-uploader .description').text()).to.equal('Upload an image');
expect(find(testSelector('file-input-description')).text()).to.equal('Upload an image');
});
// click cancel button
@ -119,7 +119,7 @@ describe('Acceptance: Settings - General', function () {
click('.fullscreen-modal .modal-content .gh-image-uploader .image-cancel');
andThen(() => {
expect(find('.fullscreen-modal .modal-content .gh-image-uploader .description').text()).to.equal('Upload an image');
expect(find(testSelector('file-input-description')).text()).to.equal('Upload an image');
});
// click cancel button

View File

@ -11,6 +11,7 @@ import $ from 'jquery';
import run from 'ember-runloop';
import Service from 'ember-service';
import {UnsupportedMediaTypeError} from 'ghost-admin/services/ajax';
import testSelector from 'ember-test-selectors';
const notificationsStub = Service.extend({
showAPIError(/* error, options */) {
@ -72,12 +73,12 @@ describe('Integration: Component: gh-image-uploader', function() {
it('renders form with supplied alt text', function () {
this.render(hbs`{{gh-image-uploader image=image altText="text test"}}`);
expect(this.$('.description').text().trim()).to.equal('Upload image of "text test"');
expect(this.$(testSelector('file-input-description')).text().trim()).to.equal('Upload image of "text test"');
});
it('renders form with supplied text', function () {
this.render(hbs`{{gh-image-uploader image=image text="text test"}}`);
expect(this.$('.description').text().trim()).to.equal('text test');
expect(this.$(testSelector('file-input-description')).text().trim()).to.equal('text test');
});
it('generates request to correct endpoint', function (done) {