Skip to content

test(Table): add SearchItemMetaData unit test#7774

Merged
ArgoZhang merged 14 commits intomainfrom
test-table
Mar 19, 2026
Merged

test(Table): add SearchItemMetaData unit test#7774
ArgoZhang merged 14 commits intomainfrom
test-table

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Mar 17, 2026

Link issues

fixes #7773

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Ensure table column metadata copying includes search form metadata and add unit coverage for it.

Enhancements:

  • Extend ITableColumnExtensions.CopyValue to copy SearchFormItemMetaData when present.

Tests:

  • Add a unit test verifying SearchFormItemMetaData is set and copied for table columns.

Copilot AI review requested due to automatic review settings March 17, 2026 00:27
@bb-auto bb-auto bot added the test This is unit test label Mar 17, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds propagation and unit test coverage for the SearchFormItemMetaData property in table column extension copying logic.

Class diagram for ITableColumn and CopyValue extension update

classDiagram
    class ITableColumn {
        bool? IsRequiredWhenAdd
        bool? IsRequiredWhenEdit
        bool? IgnoreWhenExport
        object SearchFormItemMetaData
    }

    class TableColumnExtensions {
        +void CopyValue(ITableColumn col, ITableColumn dest)
    }

    TableColumnExtensions ..> ITableColumn : uses
Loading

Flow diagram for CopyValue SearchFormItemMetaData propagation

flowchart TD
    A[CopyValue called with col and dest] --> B{col.IsRequiredWhenAdd has value?}
    B -->|yes| C[dest.IsRequiredWhenAdd = col.IsRequiredWhenAdd]
    B -->|no| D[skip]

    C --> E{col.IsRequiredWhenEdit has value?}
    D --> E
    E -->|yes| F[dest.IsRequiredWhenEdit = col.IsRequiredWhenEdit]
    E -->|no| G[skip]

    F --> H{col.IgnoreWhenExport has value?}
    G --> H
    H -->|yes| I[dest.IgnoreWhenExport = col.IgnoreWhenExport]
    H -->|no| J[skip]

    I --> K{col.SearchFormItemMetaData is not null?}
    J --> K
    K -->|yes| L[dest.SearchFormItemMetaData = col.SearchFormItemMetaData]
    K -->|no| M[skip]

    L --> N[CopyValue returns]
    M --> N
Loading

File-Level Changes

Change Details Files
Extend ITableColumn.CopyValue to handle SearchFormItemMetaData and add unit test coverage.
  • Update CopyValue extension method to copy SearchFormItemMetaData from source to destination when not null
  • Extend existing CopyValue_Ok unit test column attribute setup to include a StringSearchMetaData instance
  • Add assertion in CopyValue_Ok unit test to verify SearchFormItemMetaData is copied to the destination column
src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs
test/UnitTest/Extensions/ITableColumnExtensionsTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7773 Add a unit test that covers the SearchItemMetaData (SearchFormItemMetaData) behavior for the relevant Table/ITableColumn extension functionality.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added this to the v10.4.0 milestone Mar 17, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Copying SearchFormItemMetaData by reference may lead to unintended shared mutable state between columns; consider whether a defensive clone or copy-constructor is more appropriate here, consistent with how you expect this metadata to be used.
  • The new unit test only checks SearchFormItemMetaData for non-null; to ensure the new behavior is actually verified, assert that the destination column received the same instance or expected property values from the source.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Copying `SearchFormItemMetaData` by reference may lead to unintended shared mutable state between columns; consider whether a defensive clone or copy-constructor is more appropriate here, consistent with how you expect this metadata to be used.
- The new unit test only checks `SearchFormItemMetaData` for non-null; to ensure the new behavior is actually verified, assert that the destination column received the same instance or expected property values from the source.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4e0b4bf) to head (403eb52).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #7774   +/-   ##
========================================
  Coverage   99.99%   100.00%           
========================================
  Files         764       764           
  Lines       33953     33960    +7     
  Branches     4673      4675    +2     
========================================
+ Hits        33951     33960    +9     
+ Misses          2         0    -2     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds unit coverage for (and fixes) propagation of custom search-form metadata when copying table column definitions, ensuring SearchFormItemMetaData isn’t dropped during column merges/copy operations.

Changes:

  • Extend ITableColumnExtensions.CopyValue to copy SearchFormItemMetaData when present.
  • Update the existing CopyValue_Ok unit test to set SearchFormItemMetaData on the source column and assert it is present on the destination after copy.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs Copies SearchFormItemMetaData during ITableColumnITableColumn value transfer.
test/UnitTest/Extensions/ITableColumnExtensionsTest.cs Adds coverage asserting SearchFormItemMetaData is populated after CopyValue.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ArgoZhang ArgoZhang merged commit 6847ec2 into main Mar 19, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the test-table branch March 19, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test This is unit test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(Table): add SearchItemMetaData unit test

2 participants