-
Notifications
You must be signed in to change notification settings - Fork 93
fix: do cleanup when removeAngularAttributes is enabled #69
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
@@ -0,0 +1 @@ | |||
declare function afterEach(fn: () => {}, timeout?: number): void; |
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.
Is this needed to run tests in CI?
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.
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.
Needed to be able to build
@@ -236,3 +239,12 @@ function addAutoImports({ imports, routes }: Pick<RenderComponentOptions<any>, ' | |||
|
|||
return [...imports, ...animations(), ...routing()]; | |||
} | |||
|
|||
if (typeof afterEach === 'function' && !process.env.ATL_SKIP_AUTO_CLEANUP) { |
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.
When process.env.ATL_SKIP_AUTO_CLEANUP
is going to be neccessary?
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.
It's to be consistent with the rest of the testing libraries
@@ -73,6 +75,7 @@ export async function render<SutType, WrapperType = SutType>( | |||
const idAttribute = fixture.nativeElement.getAttribute('id'); | |||
if (idAttribute && idAttribute.startsWith('root')) { | |||
fixture.nativeElement.removeAttribute('id'); | |||
cleanup = () => fixture.nativeElement.setAttribute('id', idAttribute); |
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.
I restore only the id
, because it's the only attribute that Angular need to remove old roots. Should do we restore ng-version
too?
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.
Sorry I wasn't clear, I will follow-up with another PR
@allcontributors please add @tonivj5 for bug, code |
I've put up a pull request to add @tonivj5! 🎉 |
I have taken your branch to add my changes. I think this approach is cleaner, however, I'm okei with your fix, if you prefer it over this, close this PR 👍
Fixing this issue,
removeAngularAttributes
can be enabled by default without problems 🎉Closes #67