Skip to content

Comments

test(table): remove conditionals from TableChart tests #36149

Merged
sadpandajoe merged 4 commits intomasterfrom
fix-table-test-conditional-statements
Nov 21, 2025
Merged

test(table): remove conditionals from TableChart tests #36149
sadpandajoe merged 4 commits intomasterfrom
fix-table-test-conditional-statements

Conversation

@sadpandajoe
Copy link
Member

SUMMARY

In #35968 I introduced tests with conditionals in it which could prevent parts of the validation to not run. This PR corrects this. Remove conditional logic from table tests following the testing best practice: "tests should not contain conditionals." Split 2 tests with if statements into 4 unconditional tests with explicit assertions, and significantly improve ARIA accessibility validation.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Nov 18, 2025

Code Review Agent Run #1089e0

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7e84731..7e84731
    • superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

@korbit-ai korbit-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.

I've completed my review and didn't find any issues.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

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

This PR refactors TableChart tests to eliminate conditional logic, following the testing best practice "tests should not contain conditionals." The original tests used if (labelledBy) conditionals which could cause assertion skipping, potentially masking issues.

Key changes:

  • Split 2 tests containing conditionals into 4 unconditional tests with explicit assertions
  • Enhanced ARIA accessibility validation to ensure ALL cells have proper aria-labelledby attributes
  • Added explicit checks to catch empty tables and unlabeled cells

…IA validation

Remove conditional logic from table tests following the principle that tests
should not contain conditionals. Split 2 tests with if statements into 4
unconditional tests with explicit assertions.

Changes:
- Remove if(labelledBy) guards from ARIA validation tests
- Split "header IDs" tests to separate ARIA validation into new tests
- Add complete coverage check: all tbody td cells must have aria-labelledby
- Add empty table guard to catch regressions (prevents silent 0===0 pass)
- Replace non-null assertions with explicit truthy checks for clearer errors
- Scope queries to tbody td (excludes footer cells which legitimately lack labels)

Benefits:
- No hidden code paths - all assertions always run
- Better error messages when attributes missing
- 100% data cell coverage for accessibility
- Catches empty table regressions
- Type-safe without suppressions

All 47 tests passing with improved coverage and clarity.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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

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

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

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

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

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

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

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

@sadpandajoe sadpandajoe merged commit e7c5437 into master Nov 21, 2025
78 of 86 checks passed
@sadpandajoe sadpandajoe deleted the fix-table-test-conditional-statements branch November 21, 2025 21:28
LuisSanchez pushed a commit to LuisSanchez/superset that referenced this pull request Nov 25, 2025
kshi020302 pushed a commit to jl141/superset that referenced this pull request Nov 30, 2025
Facyla pushed a commit to Facyla/superset-contrib that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/M viz:charts:table Related to the Table chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants