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

table[mat-table] doesn't allow debugElement.query to find directives inside it #14375

Goodwine opened this Issue Dec 3, 2018 · 0 comments


2 participants

Goodwine commented Dec 3, 2018

Bug, feature request, or proposal:

Bug: table[mat-table] makes testing hard because it doesn't have a way for getting debugElements to be queried.

What is the expected behavior?

fixture.debugElement.query(By.css('*')) should find directives inside a mat-table

What is the current behavior?

fixture.debugElement.query(By.css('*')) only finds table[mat-table] as a DebugElement but it can't find any other debug element that's a child of the table

What are the steps to reproduce?
This has 2 describes: 1 with table[mat-table] (normal table) and another with mat-table (flex tables)

What is the use-case or motivation for changing an existing behavior?

Testing is hard otherwise, my work around has been overriding the module, remove the directive, make a fake directive that has @HostBinding('click') click() { capturedInstance = this; } and test with that.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?


Is there anything else we should know?

As implicitly mentioned above, <mat-table> works OK, the problem seems to be on how <table mat-table> renders the rows which seems to be with createEmbeddedView

@andrewseguin andrewseguin added the P4 label Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment