Skip to content

fix(web): prevent parameter hint text from overflowing container border - #1056

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
K53:push-tqwkrmznmwqp
Sep 29, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
K53:push-tqwkrmznmwqp

Conversation

@K53

@K53 K53 commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Fix an issue where long text in parameter hints overflows the container border.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +124 to +128
expect(hint.nativeElement.innerHTML).toBe(
'very-long-token-without-spaces-1234567890123456789012345678901234567890',
);
const computedStyle = window.getComputedStyle(hint.nativeElement);
expect(computedStyle.overflowWrap).toBe('anywhere');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks just a mirroring test. We don't need it.

@kyasbal
kyasbal added this pull request to the merge queue Sep 29, 2026
Merged via the queue into GoogleCloudPlatform:main with commit ddb03a8 Sep 29, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants