Skip to content

waitFor not picking up DOM changes from pipeline with debounceTime #95

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

Closed
sjbuysse opened this issue Apr 17, 2020 · 3 comments · Fixed by #96
Closed

waitFor not picking up DOM changes from pipeline with debounceTime #95

sjbuysse opened this issue Apr 17, 2020 · 3 comments · Fixed by #96
Labels

Comments

@sjbuysse
Copy link

sjbuysse commented Apr 17, 2020

Hi,

I made this simple example component, to demonstrate the issue:

@Component({
  selector: 'mwf-test-timing',
  template: '<ng-container *ngIf="resultSet$ | async as resultSet"> <span data-testid="yes">{{resultSet}}</span> </ng-container> <button (click)="handleClick()">CLICK ME</button>',
  styleUrls: ['./test-timing.component.scss']
})
export class TestTimingComponent implements OnInit {
  click$ = new Subject();
  resultSet$ = this.click$.pipe(
    debounceTime(300),
    tap(() => console.log('button was clicked')),
    map(() => 'this is a result')
  );

  constructor() {
  }

  ngOnInit() {
  }

  handleClick() {
    this.click$.next();
  }
}

In my test I use the waitFor function to see if a result shows up, but it does not.
The console.log in the pipeline is triggered though. But it's as if the re-rendering does not happen.
This test passes if I leave out the debounceTime pipe.

  it('should show results', async () => {
    const {component} = await setup();
    const {getByText, getByTestId} = component;
    const button = getByText('CLICK ME');
    component.click(button);
    await waitFor(() => getByTestId('yes'));
  });
@sjbuysse sjbuysse changed the title waitFor not picking up async changes from pipeline with debounceTime waitFor not picking up DOM changes from pipeline with debounceTime Apr 17, 2020
@timdeschryver
Copy link
Member

Hi, thanks for bringing this up @sjbuysse - I forgot to add this.

@timdeschryver
Copy link
Member

🎉 This issue has been resolved in version 9.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sjbuysse
Copy link
Author

Thanks @timdeschryver !

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