ea9c8c03fe
refs https://github.com/TryGhost/Ghost/pull/15550 Pulled out of the rolled up node+ember-js+ember-template rollup linter update PR as it required fairly extensive changes. - bumped package - renamed `no-down-event-binding` to `no-pointer-down-event-binding` - disabled `no-pointer-down-event-binding` rule - disabled `no-triple-curlies` rule - ran `yarn lint:hbs --fix` - updated integration tests to match Octane syntax - fixed various one-off errors - updated .lint-todo
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
import hbs from 'htmlbars-inline-precompile';
|
|
import sinon from 'sinon';
|
|
import {blur, fillIn, find, findAll, render} from '@ember/test-helpers';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupRenderingTest} from 'ember-mocha';
|
|
|
|
describe('Integration: Component: gh-psm-visibility-input', function () {
|
|
setupRenderingTest();
|
|
|
|
it('renders', async function () {
|
|
this.set('post', {
|
|
visibility: 'members'
|
|
});
|
|
|
|
await render(hbs`<GhPsmVisibilityInput @post={{this.post}} />`);
|
|
|
|
expect(this.element, 'top-level elements').to.exist;
|
|
expect(findAll('option'), 'number of options').to.have.length(4);
|
|
expect(find('select').value, 'selected option value').to.equal('members');
|
|
});
|
|
|
|
it('updates post visibility on change', async function () {
|
|
let setVisibility = sinon.spy();
|
|
|
|
this.set('post', {
|
|
visibility: 'public',
|
|
set: setVisibility
|
|
});
|
|
|
|
await render(hbs`<GhPsmVisibilityInput @post={{this.post}} />`);
|
|
|
|
expect(this.element, 'top-level elements').to.exist;
|
|
expect(findAll('option'), 'number of options').to.have.length(4);
|
|
expect(find('select').value, 'selected option value').to.equal('public');
|
|
|
|
await fillIn('select', 'paid');
|
|
await blur('select');
|
|
|
|
expect(setVisibility.calledTwice).to.be.true;
|
|
expect(setVisibility.calledWith('visibility', 'paid')).to.be.true;
|
|
expect(setVisibility.calledWith('tiers', [])).to.be.true;
|
|
});
|
|
});
|