Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When using nz-result with only nzStatus set (e.g., nzStatus="success"), no icon is displayed. The icon() computed property only checked nzIcon input and returned undefined when not provided.

Issue Number: #9015

What is the new behavior?

Default icons now display based on nzStatus when nzIcon is not provided:

  • success → check-circle
  • error → close-circle
  • info → exclamation-circle
  • warning → warning

Content projection via [nz-result-icon] directive still works when provided.

Changes:

  • Use ng-content fallback content to render the default icon when no custom [nz-result-icon] is projected
  • Added defaultIcon() computed property to get the icon from IconMap based on nzStatus
<!-- This now correctly shows the success icon -->
<nz-result nzStatus="success" nzTitle="Successfully Purchased!" />

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Added 4 test cases verifying default icon display for each status type.

Original prompt

This section details on the original issue you should resolve

<issue_title>Nz-Result lost default icon</issue_title>
<issue_description>

Reproduction link

https://stackblitz.com/run?file=src%2Fapp%2Fapp.ts

Steps to reproduce

Official site demonstration has the problem, there is no icon when success or info and so on

What is expected?

When use status success or info, should show icon

What is actually happening?

No icon when set success or info and so on

Environment Info
ng-zorro-antd 20.4.3
Browser Chrome 135

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.86%. Comparing base (ae9ad57) to head (0fc4735).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9568   +/-   ##
=======================================
  Coverage   90.86%   90.86%           
=======================================
  Files         574      575    +1     
  Lines       23261    23270    +9     
  Branches     4639     4641    +2     
=======================================
+ Hits        21135    21145   +10     
- Misses       1393     1396    +3     
+ Partials      733      729    -4     

☔ 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.

Copilot AI changed the title [WIP] Fix Nz-Result to show default icons for success and info fix(module:result): show default icon based on status Nov 28, 2025
Copilot AI requested a review from HyperLife1119 November 28, 2025 14:52
Copy link
Collaborator

@HyperLife1119 HyperLife1119 left a comment

Choose a reason for hiding this comment

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

@copilot Do not use contentChild to determine if customIconDirective exists; instead, use the fallback content of <ng-content select="[nz-result-icon]"></ng-content> to render the default icon.

Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

@copilot Do not use contentChild to determine if customIconDirective exists; instead, use the fallback content of <ng-content select="[nz-result-icon]"></ng-content> to render the default icon.

Refactored to use ng-content fallback content instead of contentChild. The default icon is now rendered as fallback when no custom [nz-result-icon] is projected. Commit: 0fc4735

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3821 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-72603484 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,8072765113912794226,8915142031096733298,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium /usr/bin/chromium --user-data-dir=/tmp/karma-72603484 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --disable-gpu --no-sandbox http://localhost:9876/?id=72603484 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • clients2.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3821 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-72603484 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,8072765113912794226,8915142031096733298,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium /usr/bin/chromium --user-data-dir=/tmp/karma-72603484 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --disable-gpu --no-sandbox http://localhost:9876/?id=72603484 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.175/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/142.0.7444.175/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)
  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3821 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-72603484 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,8072765113912794226,8915142031096733298,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium /usr/bin/chromium --user-data-dir=/tmp/karma-72603484 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --disable-gpu --no-sandbox http://localhost:9876/?id=72603484 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • registry.npmmirror.com
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
  • www.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3821 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-72603484 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,8072765113912794226,8915142031096733298,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium /usr/bin/chromium --user-data-dir=/tmp/karma-72603484 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --disable-gpu --no-sandbox http://localhost:9876/?id=72603484 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

HyperLife1119

This comment was marked as outdated.

@HyperLife1119
Copy link
Collaborator

@Laffery 可以看看这个 PR,可以的话还需要合并到 v20 吧

@Laffery
Copy link
Collaborator

Laffery commented Dec 5, 2025

@Laffery 可以看看这个 PR,可以的话还需要合并到 v20 吧

好的。还请将 PR 从 draft 状态改下

@HyperLife1119 HyperLife1119 marked this pull request as ready for review December 5, 2025 08:46
Copilot AI review requested due to automatic review settings December 5, 2025 08:46
Copy link

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

This PR fixes a bug where the nz-result component didn't display default icons when only nzStatus was set without providing a custom nzIcon. The fix uses ng-content fallback to render default status-based icons.

Key Changes:

  • Added defaultIcon() computed property to map status to default icon names
  • Modified template to include fallback content in ng-content that renders the default icon
  • Added comprehensive test coverage for all four status types (success, error, info, warning)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
components/result/result.component.ts Added defaultIcon() computed property and updated template to use ng-content fallback for rendering default icons based on status
components/result/result.spec.ts Added new test component and test suite with 4 test cases to verify default icon rendering for each status type

Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

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

LGTM

@Laffery Laffery merged commit de0faf6 into master Dec 5, 2025
15 of 18 checks passed
HyperLife1119 added a commit to HyperLife1119/ng-zorro-antd that referenced this pull request Dec 5, 2025
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: HyperLife1119 <[email protected]>
Laffery pushed a commit that referenced this pull request Dec 8, 2025
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.

Nz-Result lost default icon

3 participants