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

Bug? Cannot combine @Input decorators with query decorators #181

Closed
appienvanveen opened this issue Aug 24, 2020 · 16 comments · Fixed by #184
Closed

Bug? Cannot combine @Input decorators with query decorators #181

appienvanveen opened this issue Aug 24, 2020 · 16 comments · Fixed by #184

Comments

@appienvanveen
Copy link

appienvanveen commented Aug 24, 2020

Hi,

im using your lib version 10.1.2 with angular 9.1.2 in combination with the Syncfusion angular framework.

I'm getting the following error when I run my tests:
`

Error: Cannot combine @Input decorators with query decorators
    at http://localhost:9876/_karma_webpack_/D:/Work/Java

`

Code looks like follows:

describe('XComponent', () => {
    let component: XComponent;
    let fixture: MockedComponentFixture<XComponent>;
    beforeEach(() => MockBuilder(XComponent, XModule)
        .provide({provide: ControlContainer, useValue: fgd}),
    );
    beforeEach(() => {
        fixture = MockRender(XComponent);
        component = fixture.point.componentInstance;
        fixture.detectChanges();
    });
    it('should create', () => {
        expect(component).toBeTruthy();
        expect(component.controlContainer).toBeDefined();
    });
});

I'm not sure if this is caused by the mock framework or by the syncfusion library. Running the project works fine; even as building the project. This just happens when running the tests.

@satanTime
Copy link
Member

Hi again,

might you share code of XComponent, or create a min code sample with the failing test?

@appienvanveen
Copy link
Author

example-bug.zip

Please find a sample project attached :)

@appienvanveen
Copy link
Author

Any idea yet? @satanTime :)

@satanTime
Copy link
Member

Hi, unfortunately, didn't check it yet. I'll do that latest on Sunday evening. Sorry for the delay.

@appienvanveen
Copy link
Author

No problem, take your time :)

@appienvanveen
Copy link
Author

Any update yet? :)

@satanTime
Copy link
Member

Checking :)

@satanTime
Copy link
Member

Hi, I'm investigating it deeper, I have a fix, but I want to find the cause.

@appienvanveen
Copy link
Author

Ah cool. I was thinking it was caused by the syncfusion library, but since it only occurse during testing/mocking I doubted this.

@satanTime
Copy link
Member

Yep, the way they are creating components and directives in the lib causes the issue, they use decorators in an interesting manner, but if I do a copy for testing it doesn't fail anymore. So I'll try to dig deeper for understanding of the exact cause.

@appienvanveen
Copy link
Author

Hi, it appears that when i disable ivy for the test in my tsconfig, the tests run fine.

@satanTime
Copy link
Member

Ah, that's an awesome hint! Thanks, I'll try this way.

@satanTime
Copy link
Member

Hi again, might you check if it solves your issue?
ng-mocks.zip

@appienvanveen
Copy link
Author

Works like a charm!

@satanTime
Copy link
Member

Thanks for checking, I'll release the changes this week.

@satanTime
Copy link
Member

A new version has been released. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants