TB Angular upgrade 20#7141
Conversation
…3.4 to use a newer version of Chrome for testing
karma_web_test_suite from concatjs already defaults to @io_bazel_rules_webtesting//browsers:chromium-local which points to Chrome 123 via browsers-0.3.4 so the custom browser target and json were duplicating what was already there.
| expect(slider.attributes['ng-reflect-min']).toBe('0'); | ||
| expect(slider.attributes['ng-reflect-max']).toBe( | ||
| String(numExecutions - displayCount) | ||
| // angular 20 dropped ng-reflect attrs so we read min and max from componentInstance |
There was a problem hiding this comment.
This is useful context for the PR, but I think we can remove it from the code.
Here and other files where you changed this.
| // Simulate dragging fob to step 10. | ||
| ); | ||
| const testController = cardFobDebugEl.componentInstance; | ||
| // rootTop offsets clientY so mousePosition = clientY - rootTop stays |
There was a problem hiding this comment.
I'm not really following this comment. Can it be clarified or simplified somehow?
What is the "frame of reference" for clientY? Is it with respect to the top of the element? Or the bottom of the element? Or the viewport, or what?
And/or what is rootTop meant to be? Is it an "absolute" position in the viewport, and then clientY too? It seems to be taking the "top" boundary of the card "fob", so maybe the name is confusing.
Maybe instead of rootTop it should be something like fobPosition or startingFobPosition, or something?
I believe this is saying that because the "selection" can only "snap" to existing values, we use 25 to get it "closer to step 10" than "closer to step 5", right?
Perhaps this could be clearer if we say something like this (will likely need to be updated, but the general idea, maybe):
clientYandstartingFobPositionare given as absolute measurements from the bottom of the viewport. The step selector will "snap" to the closest option. Step 5 ends up around 24 pixels fromstartingFobPosition, and step 10 around 27 pixels above, so we set this to a value closer to that step 10.
And then (if this is more or less accurate) I think it would be better to just use 27 for the value, instead of 25?
There was a problem hiding this comment.
Thank you good point, I'll clarify it.
clientYis viewport-relative. From top to bottom. That's the standardMouseEventbehavior.rooTopit's the top of<card-fob-controller>the controller container. It's the same element the component itself uses as its reference point ingetMousePositionFromEvent()I will rename it tocontrollerRootTop- You're right the comment it's about the snapping to an existing step, however is not to the closer steps. The code snaps to the first step it reaches whose axis position the mouse already reached, not the nearest. That's why I picked 25, just needs to land anywhere between step 5 (23.75) and 10 (27.5). I will update the comment to remove closer to.
| describe('formatLong', () => { | ||
| it('formats using localization', () => { | ||
| // jasmine + Angular seems to mock out the timezone by default (to UTC). | ||
| // chrome 123 icu upgrade changed the en-US date time separator from a |
There was a problem hiding this comment.
Again, this is useful context for the review, but we can remove it from the code.
It should be clear that this is the expected output from whatever formatter we're using, and the historical behavior is not relevant context.
|
|
||
| # We use our own browser definition based on the archives defined below, but | ||
| # this seems to be required by the rules_webtesting dependency. | ||
| # browser_repositories registers the Chrome 122/123 binaries for all |
| // Simulate dragging fob to step 10. | ||
| ); | ||
| const testController = cardFobDebugEl.componentInstance; | ||
| // rootTop offsets clientY so mousePosition = clientY - rootTop stays |
There was a problem hiding this comment.
Thank you good point, I'll clarify it.
clientYis viewport-relative. From top to bottom. That's the standardMouseEventbehavior.rooTopit's the top of<card-fob-controller>the controller container. It's the same element the component itself uses as its reference point ingetMousePositionFromEvent()I will rename it tocontrollerRootTop- You're right the comment it's about the snapping to an existing step, however is not to the closer steps. The code snaps to the first step it reaches whose axis position the mouse already reached, not the nearest. That's why I picked 25, just needs to land anywhere between step 5 (23.75) and 10 (27.5). I will update the comment to remove closer to.
| describe('formatLong', () => { | ||
| it('formats using localization', () => { | ||
| // jasmine + Angular seems to mock out the timezone by default (to UTC). | ||
| // chrome 123 icu upgrade changed the en-US date time separator from a |
| expect( | ||
| wallTimeFormatter.formatLong(new Date('2020-1-5 13:23').getTime()) | ||
| ).toBe('January 5, 2020, 1:23:00.000 PM UTC'); | ||
| ).toBe('January 5, 2020 at 1:23:00.000 PM UTC'); |
There was a problem hiding this comment.
jasmine + Angular seems to mock out the timezone by default (to UTC).
Chrome 123 (Angular 20) icu upgrade changed the en-US date time separator from a
omma to the word at so Jan 5 2020 at 1:23 PM instead of comma
| # override the newer versions when called after browser_repositories. | ||
| browser_repositories(chromium = True) | ||
|
|
||
| # Chromium browser for multiple platforms, pinned to Chromium 84.0.4147.0. |
There was a problem hiding this comment.
browser_repositories already registers the Chrome 122 and 123 binaries for all platforms through browsers-0.3.4.bzl. These got removed because calling them after browser_repositories just overrides the newer 122/123 binaries with the old Chrome 84, so they silently downgrading the browser used in tests.
| const testController = cardFobDebugEl.componentInstance; | ||
| // Drag the fob from step 0 to step 10. | ||
| const controllerRootTop = | ||
| // top of the card fob controller host in viewport coords, same point the component uses internally in getMousePositionFromEvent |
There was a problem hiding this comment.
Can we add line breaks to these comments (this and others in this change), so they're more easily readable when the text is wrapped around?
Also, I think the comment should be before the variable name too.
| }); | ||
| // MatSliderThumb sets the initial value async thru NgModel so tick is | ||
| // needed before nativeElement.value is ready. also angular 20 dropped | ||
| // ng-reflect attrs so we read from nativeElement directly |
There was a problem hiding this comment.
Likewise, we can remove this about the ng-reflect that doesn't exist in the code anymore.
| upperValue: 3, | ||
| }); | ||
| // MatSliderThumb sets the initial value async thru NgModel so tick is | ||
| // needed before nativeElement.value is ready. also angular 20 dropped |
There was a problem hiding this comment.
Sorry for not being clear. I think the comment related to the "tick" was still worth keeping. Just not the ng-reflect part that is no longer in the code, so it doesn't really seem useful to someone reading the code in the future.
Motivation for features / changes
Part of a step-by-step Angular migration from v16 to v22. This PR upgrades the frontend from Angular 19 to Angular 20.
Technical description of changes
^20.0.0(resolved 20.3.25 in yarn.lock), @ngrx/* to ^20.0.0, and TypeScript to5.8.3@io_bazel_rules_webtestingfrom browsers-0.3.3 to browsers-0.3.4 to upgrade Chromium from Chrome 94 to Chrome 123tensorboard/tools/browserssince the default alias has restricted visibility and cannot be used from TensorBoard targetsspec_bundletarget to es2021 since Chrome 123 crashes on ES2022 class static blocks emitted by Angular npm packages.ng-reflect-*attributes removed inAngular 20, now reading from componentInstance or nativeElement instead.Detailed steps to verify changes work correctly (as executed by you)
Alternate designs / implementations considered (or N/A)