feat(navbar-vertical): improve animations#1415
Conversation
Summary of ChangesHello @dauriamarco, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refines the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves animations and adds new badge transition features to the vertical navbar. The changes include updates to the component logic, templates, and styles to support these new features, along with new examples and updated tests. The code is well-structured, and the new features are covered by tests. I found one issue in a test case for the new hideBadgeWhenCollapsed feature, where the test logic does not match its description. My review includes a suggestion to fix this. Overall, this is a good improvement to the navbar component.
| it('should not affect emphasis badges', () => { | ||
| const emphasisColors = ['primary-emphasis', 'danger-emphasis', 'warning-emphasis']; | ||
|
|
||
| emphasisColors.forEach(badgeColor => { | ||
| badgeTestComponent.item.set({ | ||
| type: 'link', | ||
| label: 'Test', | ||
| href: '#', | ||
| badge: 5, | ||
| badgeColor | ||
| }); | ||
| badgeTestFixture.detectChanges(); | ||
|
|
||
| const linkElement = badgeTestFixture.nativeElement.querySelector('a.navbar-vertical-item'); | ||
| expect(linkElement.classList.contains('hide-badge-collapsed')).toBe(false); | ||
|
|
||
| const badgeElement = badgeTestFixture.nativeElement.querySelector('.badge'); | ||
| expect(badgeElement).toBeTruthy(); | ||
| expect(badgeElement.classList.contains(`bg-${badgeColor}`)).toBe(true); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
This test case appears to be flawed. The title should not affect emphasis badges suggests it's testing that hideBadgeWhenCollapsed does not apply to emphasis badges. However, the test implementation never sets hideBadgeWhenCollapsed: true on the test item. As a result, it only asserts that the hide-badge-collapsed class is not present when the property is falsy, which is expected but doesn't test the intended interaction with emphasis badges.
To properly test this, hideBadgeWhenCollapsed: true should be set. If the intended behavior is that emphasis badges are not hidden, the component's hideBadgeCollapsed logic should be updated to exclude them, and this test should verify that behavior.
it('should not add hide-badge-collapsed class for emphasis badges when hideBadgeWhenCollapsed is true', () => {
const emphasisColors = ['primary-emphasis', 'danger-emphasis', 'warning-emphasis'];
emphasisColors.forEach(badgeColor => {
badgeTestComponent.item.set({
type: 'link',
label: 'Test',
href: '#',
badge: 5,
badgeColor,
hideBadgeWhenCollapsed: true
});
badgeTestFixture.detectChanges();
const linkElement = badgeTestFixture.nativeElement.querySelector('a.navbar-vertical-item');
// This assertion assumes that emphasis badges are never hidden.
// This would require updating the `hideBadgeCollapsed` computed property in the component
// to not add the class for emphasis badges.
expect(linkElement.classList.contains('hide-badge-collapsed')).toBe(false);
const badgeElement = badgeTestFixture.nativeElement.querySelector('.badge');
expect(badgeElement).toBeTruthy();
expect(badgeElement.classList.contains(`bg-${badgeColor}`)).toBe(true);
});
});|
Documentation. Coverage Reports: |
Improves initial animations and adds new badges transitions in the vertical navbar.