-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat(#9413): update dynamic url widget to use MutationObserver #9414
feat(#9413): update dynamic url widget to use MutationObserver #9414
Conversation
@jkuester As I'm about to head on leave can I hand this over to you for review? I've approved so I don't block the eventual merge... |
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.
Approved to unblock.
…dynamic url widget mutation test
0d8fe2e
to
46488f8
Compare
@ChinHairSaintClair did you mean to push that last commit with the contact summary changes to this branch? |
@jkuester no. Accidentally pushed the other branch's work to this one 🤦 . |
91a5777
to
46488f8
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.
Very nice, thank you for these updates! (We are only 10+ years behind on removing the deprecated DOMSubtreeModified
code....) 😅
I left one minor question about the type check, but besides that this should be good to go!
setTimeout(() => { | ||
expect($(DynamicUrlWidget.selector).attr('href')).to.equal(`http://google.com?q=${dynamic}`); | ||
done(); | ||
}, 0); |
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 just for the record (for anyone that is looking into this in the future) the normal Angular way of testing async UI updates via fakeAsync
does not seem to work here. And from reading online this seems to be expected (I guess the MutationObserver falls outside of what Angular has control of). In general the consensus seems to be against trying too hard to unit test MutationObserver behavior. However, since this works (at least for now) I say we ship it as is! 👍
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.
LGTM! Thanks @ChinHairSaintClair!
Description
This approach ensures that the assertion occurs as the last action on the macro-task queue, which seems to address our pipeline issue without introducing too much additional code.
Closes #9413
Code review checklist
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.