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

Question: What is difference between autoDetectChanges and detectChanges #2

Open
mitsuruog opened this issue May 10, 2016 · 0 comments

Comments

@mitsuruog
Copy link

mitsuruog commented May 10, 2016

@juliemr Thanks for your great presentation.

I have a few question about fake-async_test.ts.

I think that autoDetectChanges feature is useful for testing.
so, I tried to change following code, and run test.
as result of test is passing same as before the change.

fake-async_test.ts

  it('should count down and throw rock', fakeAsync(() => {
    let fixture;
    builder.createAsync(RockPaperScissors).then((compFixture: ComponentFixture<RockPaperScissors>) => {
      fixture = compFixture;
      fixture.autoDetectChanges(); // <= using autoDetectChanges
    });
    tick();

    let output = fixture.debugElement.query(By.css('span')).nativeElement;
    fixture.debugElement.query(By.css('button')).nativeElement.click();

    // fixture.detectChanges(); // <= comment out
    expect(output.textContent).toEqual('3');

    ....

What is difference between autoDetectChanges and detectChanges in this case?
If both of same. Which do you think better?

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

No branches or pull requests

1 participant