Eliemerson Fonseca
Eliemerson Fonseca

Reputation: 757

Unit test ViewChild with mat sort and set content, Jasmine and Karma

I have ViewChild with set content. I would like to know how you can test this piece of code using Unit test.

This image is code coverage

enter image description here

  @ViewChild(MatSort) set content(content: ElementRef) {
    this.sort = content;
    Iif (this.sort) {
      this.historyReport.sort = this.sort;
    }
  }

Upvotes: 3

Views: 1751

Answers (1)

Gopal Jayaraman
Gopal Jayaraman

Reputation: 26

add MatSortModule in the dependency, will help you

      imports: [MatSortModule],
      declarations: [],
      providers: [
      ]
    }).compileComponents();```

Upvotes: 1

Related Questions