Skip to content

Fixed breadcrumb styling and added tests #1435

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

Merged
merged 4 commits into from
Apr 28, 2025

Conversation

samyak003
Copy link
Collaborator

Fixes: #1413

Copy link
Contributor

coderabbitai bot commented Apr 27, 2025

Summary by CodeRabbit

  • Style

    • Adjusted vertical spacing by removing top margins from several main containers and components, resulting in a more compact layout.
    • Updated breadcrumb container positioning for simplified and consistent spacing.
  • Tests

    • Added new unit tests for breadcrumb navigation and hover styles.
    • Enhanced test coverage for project and chapter detail links to verify correct navigation behavior.
    • Introduced an additional end-to-end test for project details navigation.
      """

Summary by CodeRabbit

  • Style
    • Adjusted vertical spacing across multiple pages and components by removing top margin from main containers, resulting in reduced space above content.
    • Simplified breadcrumb container layout by removing absolute positioning and related offsets.
  • Tests
    • Added unit tests to verify breadcrumb link targets and hover styles.

Walkthrough

This set of changes primarily removes the mt-16 (top margin) class from the main container elements across several page and layout components, including About, Snapshots, CardDetailsPage, and SearchPageLayout. The BreadCrumbs component's outer container styling is adjusted by eliminating absolute positioning and related offsets, now relying on margin and padding for layout. Additionally, two new unit tests are added to the BreadCrumbs component to verify correct link behavior and hover styles. No changes were made to exported or public entity declarations.

Changes

Files Change Summary
frontend/src/app/about/page.tsx
frontend/src/app/snapshots/[id]/page.tsx
frontend/src/app/snapshots/page.tsx
frontend/src/components/CardDetailsPage.tsx
frontend/src/components/SearchPageLayout.tsx
Removed mt-16 (top margin) class from main container <div> elements in multiple pages and components.
frontend/src/components/BreadCrumbs.tsx Removed absolute positioning and offsets from the breadcrumb container, now uses margin and padding only.
frontend/tests/unit/components/BreadCrumbs.test.tsx Added two unit tests for verifying breadcrumb link hrefs and hover styles.

Assessment against linked issues

Objective Addressed Explanation
Ensure hyperlinks in main content areas are clickable and interactive (including pointer cursor on hover) after breadcrumb changes (#1413)

Possibly related PRs

Suggested reviewers

  • kasya
  • arkid15r
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @samyak003 !
I checked it locally and it works.

As for the tests -- the idea is always make sure the bug doesn't happen again. So in this case we'd like to see tests (unit/e2e) that check for some chapter/project detail links clickability. Please look into adding it when you get a chance.

Thank you!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bc758b and a7297a4.

📒 Files selected for processing (3)
  • frontend/__tests__/e2e/pages/Projects.spec.ts (1 hunks)
  • frontend/__tests__/unit/pages/Chapters.test.tsx (1 hunks)
  • frontend/__tests__/unit/pages/Projects.test.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (2)
frontend/__tests__/unit/pages/Chapters.test.tsx (1)

135-147: LGTM! Good test for multi-link navigation verification.

This test properly extends coverage by verifying that all "View Details" links navigate correctly, not just the first one. The test structure follows best practices with proper assertions and router verification.

frontend/__tests__/unit/pages/Projects.test.tsx (1)

145-159: LGTM! Comprehensive test for all navigation buttons.

This test enhances coverage by verifying that all "View Details" buttons navigate to their correct respective URLs. The implementation is well-structured with:

  • Proper role-based element selection with getByRole
  • Verification of link existence before testing
  • Index-based URL validation for each button
  • Appropriate mock restoration

This complements the existing single-button test case nicely.

@arkid15r arkid15r enabled auto-merge April 28, 2025 19:24
@arkid15r arkid15r added this pull request to the merge queue Apr 28, 2025
Merged via the queue into OWASP:main with commit 14b1286 Apr 28, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hyperlinks Non-Functional on Pages
2 participants