Repository navigation
fix(web): prevent parameter hint text from overflowing container border - #1056
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the styling of the parameter-hint component to handle long unbroken tokens by setting the host display to block and applying min-width and overflow-wrap properties. It also adds a unit test to verify this behavior. The feedback recommends removing the assertion that checks computed CSS styles using window.getComputedStyle, as this can be fragile and prone to flakiness in headless CI environments.
| expect(hint.nativeElement.innerHTML).toBe( | ||
| 'very-long-token-without-spaces-1234567890123456789012345678901234567890', | ||
| ); | ||
| const computedStyle = window.getComputedStyle(hint.nativeElement); | ||
| expect(computedStyle.overflowWrap).toBe('anywhere'); |
There was a problem hiding this comment.
Testing computed CSS styles in unit tests using window.getComputedStyle is generally discouraged and can be fragile. In headless CI environments or when the component fixture is not explicitly attached to the DOM, getComputedStyle may return empty or unexpected default values, leading to flaky test failures. Since CSS is better verified through visual regression or end-to-end testing, it is recommended to remove the computed style assertion from this unit test and focus on verifying the rendered content.
| expect(hint.nativeElement.innerHTML).toBe( | |
| 'very-long-token-without-spaces-1234567890123456789012345678901234567890', | |
| ); | |
| const computedStyle = window.getComputedStyle(hint.nativeElement); | |
| expect(computedStyle.overflowWrap).toBe('anywhere'); | |
| expect(hint.nativeElement.innerHTML).toBe( | |
| 'very-long-token-without-spaces-1234567890123456789012345678901234567890', | |
| ); |
| expect(await matIcon[0].getName()).toBe('info'); | ||
| }); | ||
|
|
||
| it('renders long unbroken token and applies overflow-wrap style', () => { |
There was a problem hiding this comment.
This looks just a mirroring test. We don't need it.
ddb03a8
Fix an issue where long text in parameter hints overflows the container border.