Ghost/ghost/admin/tests/integration/components/modal-transfer-owner-test.js

28 lines
918 B
JavaScript
Raw Normal View History

import RSVP from 'rsvp';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
import {click, render} from '@ember/test-helpers';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {setupRenderingTest} from 'ember-mocha';
describe('Integration: Component: modal-transfer-owner', function () {
setupRenderingTest();
it('triggers confirm action', async function () {
2016-11-24 01:50:57 +03:00
let confirm = sinon.stub();
let closeModal = sinon.spy();
2016-11-24 01:50:57 +03:00
confirm.returns(RSVP.resolve({}));
this.set('confirm', confirm);
this.set('closeModal', closeModal);
await render(hbs`{{modal-transfer-owner confirm=(action confirm) closeModal=(action closeModal)}}`);
await click('.gh-btn.gh-btn-red');
2016-11-24 01:50:57 +03:00
expect(confirm.calledOnce, 'confirm called').to.be.true;
expect(closeModal.calledOnce, 'closeModal called').to.be.true;
});
});