-
Notifications
You must be signed in to change notification settings - Fork 26.5k
refactor(core): add configurable behavior for animations to testbed #62764
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
Conversation
@@ -945,6 +953,10 @@ export class TestBedCompiler { | |||
const providers = [ | |||
{provide: Compiler, useFactory: () => new R3TestCompiler(this)}, | |||
{provide: DEFER_BLOCK_CONFIG, useValue: {behavior: this.deferBlockBehavior}}, | |||
{ | |||
provide: ANIMATIONS_DISABLED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to expose this token to users, instead of exposing new options on TestBed
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I originally had this token exposed as public api, but before landing the feat commit, I was asked to remove it from public api in favor of this approach. I'm sure @AndrewKushnir could provide more thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to put the configuration into the testing context. Originally, the token was exposed via @angular/core
, we could've expose it via @angular/core/testing
, but in this case having a TestBed config looks more consistent (we had a similar config for defer block behavior).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added benefit here is that testbed defaults to animations disabled. So by default they'd only have to provide a configuration if they actually did want to test animations running.
@@ -945,6 +953,10 @@ export class TestBedCompiler { | |||
const providers = [ | |||
{provide: Compiler, useFactory: () => new R3TestCompiler(this)}, | |||
{provide: DEFER_BLOCK_CONFIG, useValue: {behavior: this.deferBlockBehavior}}, | |||
{ | |||
provide: ANIMATIONS_DISABLED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to put the configuration into the testing context. Originally, the token was exposed via @angular/core
, we could've expose it via @angular/core/testing
, but in this case having a TestBed config looks more consistent (we had a similar config for defer block behavior).
9b484d1
to
8c5ef47
Compare
This adds a test module configuration to define whether animations should be enabled or disabled in test. By default, they are disabled.
8c5ef47
to
1f945ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the feedback 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
This PR was merged into the repository by commit 898244a. The changes were merged into the following branches: main |
This adds a test module configuration to define whether animations should be enabled or disabled in test. By default, they are disabled.
Does this PR introduce a breaking change?