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

fix: generated id="root{n}" should be removed #2164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wellwind
Copy link

Summary

When using snapshot testing, Angular will generate <div id="root{n}"> root tag every time call TestBed.createComponent; this attribute will cause the snapshot not to be stable and should be removed when serializing content.

Test plan

I have updated the testing snapshot content, fixed the code, and the snapshot testing passed.

Does this PR introduce a breaking change?

  • Yes
  • No

All old snapshots containing <div id="root{n}"> will cause failure.

So developers have to update the new snapshot manually after the upgrade.

Other information

@wellwind
Copy link
Author

Hi @ahnpnl,

do you think this PR is fine to approve?

@@ -9,7 +9,9 @@ exports[`snapshot should work 1`] = `
>
<p>
Line 1
</p><div>
</p><div
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid not generating thisid?

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

Successfully merging this pull request may close these issues.

None yet

2 participants