Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing test for export default plus decorator #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/dummy/app/components/bug-case.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// this gets imported directly into the test suite. It's in a separate file
// because the bad behavior seems to depend specifically on `export default
// class` plus a decorated property.

import Component from '@ember/component';
import { inject } from '@ember/service'

export default class Example extends Component {
@inject router;
}

9 changes: 9 additions & 0 deletions tests/unit/classic-decorator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EmberObject from '@ember/object';
import Controller from '@ember/controller';
import classic from 'ember-classic-decorator';
import { DEBUG } from '@glimmer/env';
import BugComponent from 'dummy/components/bug-case';

module('@classic', () => {
if (DEBUG) {
Expand Down Expand Up @@ -129,6 +130,14 @@ module('@classic', () => {
FooController.reopenClass({});
}, /You attempted to use the .reopen\(\) method on the FooController class/);
});

test('throws without the decorator when combining export default and a decorated property', assert => {
assert.throws(() => {
// The BugComponent lives in a separate file because the bug only
// manifests when combining `export default` with decorators.
BugComponent.reopenClass({});
}, /You attempted to use the .reopen\(\) method on the @ember\/component class/);
});
});
});
} else {
Expand Down