sadpandajoe opened a new pull request, #44847:
URL: https://github.com/apache/superset/pull/44847
### SUMMARY
Adds React Testing Library coverage for the time range and metric popovers
in Explore. This change touches test files only.
- **Date filter** (`DateFilterLabel.test.tsx`, plus new
`CommonFrame.test.tsx` and `DateLabel.test.tsx`)
- The popover opens on the frame guessed from the value: No filter,
Common, Calendar, Current, Custom or Advanced.
- Switching range types swaps the frame.
- No filter applies `NO_TIME_RANGE`.
- An invalid Advanced expression shows an error and disables Apply until
it is fixed.
- Cancel restores the original frame and discards unsaved selections.
- Fake timers are reset after each test, so the debounce tests don't
depend on test order.
- `CommonFrame`: its radio options, and the fallback for an invalid value.
- `DateLabel`: rendering, ref forwarding, and it does not submit a
surrounding form.
- **Comparison range label** (`ComparisonRangeLabel.test.tsx`, new)
- Renders nothing without a time range filter or a comparison.
- Maps the legacy `y`, `m`, `w`, `r` and `c` shorthands.
- Custom shifts are derived from `start_date_offset`.
- Inherited shifts.
- Combines shifts into one request.
- **Adhoc metric popover trigger** (`AdhocMetricPopoverTrigger.test.tsx`,
new)
- The edited title resets when the metric changes, and survives a rerender
of the same metric.
- The title is read-only on the Saved tab.
- Controlled and uncontrolled visibility.
Each new test was checked by breaking the related product code, and the test
failed each time.
Some behavior that looks like a bug was left unpinned on purpose:
- In controlled mode, `ControlPopover` keeps its own visibility state, so it
opens on click even when the parent keeps `visible={false}`.
- `ComparisonRangeLabel` can render the "Actual range for comparison" header
with an empty label.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A: tests only.
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
npx jest \
src/explore/components/controls/DateFilterControl/tests \
src/explore/components/controls/ComparisonRangeLabel.test.tsx \
src/explore/components/controls/MetricControl/AdhocMetricPopoverTrigger.test.tsx
```
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]