Skip to content

Commit

Permalink
Remove no-classic-classes & no-classic-components in docs & convert c…
Browse files Browse the repository at this point in the history
…lassic components to glimmer
  • Loading branch information
mkszepp committed Dec 22, 2023
1 parent da6790b commit f2d3c7b
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 61 deletions.
2 changes: 0 additions & 2 deletions docs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ module.exports = {
browser: true,
},
rules: {
'ember/no-classic-classes': 'off',
'ember/no-classic-components': 'off',
'ember/classic-decorator-no-classic-methods': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
},
Expand Down
9 changes: 0 additions & 9 deletions docs/app/components/custom-group-component.js

This file was deleted.

4 changes: 0 additions & 4 deletions docs/app/components/list-of-countries.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/app/templates/components/custom-group-component.hbs

This file was deleted.

18 changes: 0 additions & 18 deletions docs/app/templates/components/list-of-countries.hbs

This file was deleted.

8 changes: 4 additions & 4 deletions test-app/app/components/custom-group-component.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable ember/classic-decorator-hooks, ember/require-tagless-components */
import Component from '@ember/component';
import Component from '@glimmer/component';
import { action } from '@ember/object';

export default class CustomGroupComponent extends Component {
init() {
super.init(...arguments);
@action
setup() {
this.onInit?.bind(this)();
}
}
3 changes: 1 addition & 2 deletions test-app/app/components/list-of-countries.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable ember/require-tagless-components */
import Component from '@ember/component';
import Component from '@glimmer/component';

export default class ListOfCountriesComponent extends Component {}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="custom-component">{{yield}}</div>
<div class="custom-component" {{did-insert this.setup}}>{{yield}}</div>
38 changes: 20 additions & 18 deletions test-app/app/templates/components/list-of-countries.hbs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<p>
Countries:
</p>
<ul>
{{#if @extra.field}}
{{#each @options as |option index|}}
<li>
{{index}}. {{get option @extra.field}}
</li>
{{/each}}
{{else}}
{{#each @options as |option index|}}
<li>
{{index}}. {{option.name}}
</li>
{{/each}}
{{/if}}
</ul>
<div class="ember-power-select-options">
<p>
Countries:
</p>
<ul>
{{#if @extra.field}}
{{#each @options as |option index|}}
<li>
{{index}}. {{get option @extra.field}}
</li>
{{/each}}
{{else}}
{{#each @options as |option index|}}
<li>
{{index}}. {{option.name}}
</li>
{{/each}}
{{/if}}
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ module(
test('`@groupComponent` has extension points', async function (assert) {
this.groupedNumbers = groupedNumbers;
let numberOfGroups = 5; // number of groups in groupedNumbers
assert.expect(4 * numberOfGroups);

let extra = { foo: 'bar' };
this.extra = extra;
Expand All @@ -419,6 +418,10 @@ module(
`);

await clickTrigger();

assert
.dom('.ember-power-select-options .custom-component')
.exists({ count: numberOfGroups });
});

test('the power-select-multiple placeholder can be customized using `@placeholderComponent`', async function (assert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ module(
<PowerSelect
@options={{this.countries}}
@selected={{this.country}}
@optionsComponent={{component "list-of-countries"}}
@optionsComponent={{component "list-of-countries"}}
@onChange={{fn (mut this.foo)}} as |country|>
{{country.name}}
</PowerSelect>
`);

await clickTrigger();

assert
.dom('.ember-power-select-options')
.includesText('Countries:', 'The given component is rendered');
Expand Down

0 comments on commit f2d3c7b

Please sign in to comment.