2231dd84c2
no issue
Ember is migrating to `<AngleBracketSyntax />` for component invocation, see https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
We were in a half-way situation where some templates used angle bracket syntax in some places, this PR updates templates to use the syntax everywhere.
This simplifies the rules for what template code is referring to...
`<Component>` = a component
`{{helper}}` = a helper (or locally assigned handlebars variable)
`{{this.foo}}` = data on the template backing context (a component/controller)
`{{@foo}}` = a named argument passed into the component that the component backing class has not modified (note: this commit does not introduce any named arguments)
- ran codemod https://github.com/ember-codemods/ember-angle-brackets-codemod on the following directories:
- `app/templates`
- `lib/koenig-editor/addon/templates`
- removed positional params from components as angle bracket syntax does not support them
- `gh-feature-flag`
- `gh-tour-item`
- `gh-cm-editor`
- `gh-fullscreen-modal`
- `gh-task-button`
- updates some code that was missed in 3c851293c1
to use explicit this
45 lines
1.6 KiB
JavaScript
45 lines
1.6 KiB
JavaScript
import Service from '@ember/service';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import {click, find, render} from '@ember/test-helpers';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupRenderingTest} from 'ember-mocha';
|
|
|
|
const featureStub = Service.extend({
|
|
testFlag: true
|
|
});
|
|
|
|
describe('Integration: Component: gh-feature-flag', function () {
|
|
setupRenderingTest();
|
|
|
|
beforeEach(function () {
|
|
this.owner.register('service:feature', featureStub);
|
|
});
|
|
|
|
it('renders properties correctly', async function () {
|
|
await render(hbs`<GhFeatureFlag @flag="testFlag" />`);
|
|
expect(find('label').getAttribute('for')).to.equal(find('input[type="checkbox"]').id);
|
|
});
|
|
|
|
it('renders correctly when flag is set to true', async function () {
|
|
await render(hbs`<GhFeatureFlag @flag="testFlag" />`);
|
|
expect(find('label input[type="checkbox"]').checked).to.be.true;
|
|
});
|
|
|
|
it('renders correctly when flag is set to false', async function () {
|
|
let feature = this.owner.lookup('service:feature');
|
|
feature.set('testFlag', false);
|
|
|
|
await render(hbs`<GhFeatureFlag @flag="testFlag" />`);
|
|
expect(find('label input[type="checkbox"]').checked).to.be.false;
|
|
});
|
|
|
|
it('updates to reflect changes in flag property', async function () {
|
|
await render(hbs`<GhFeatureFlag @flag="testFlag" />`);
|
|
expect(find('label input[type="checkbox"]').checked).to.be.true;
|
|
|
|
await click('label');
|
|
expect(find('label input[type="checkbox"]').checked).to.be.false;
|
|
});
|
|
});
|