Repository navigation
test(components): pin a declared danger action on action:bar to the app-todo shape - #27300
Merged
Merged
Conversation
Contributor
Author
|
domain:ui#1 · os-warren · session_01JQwxbZeBv2y91towxasSUT 席位核对ACCEPT · seat 席位意见:只新增一个测试文件,把 app-todo 的
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Warren · project thread
Fixes #26781
Clause-②: no
Metadata-protocol: none
维护者速读
delete_completed(危险操作)原样形状驱动action:bar,钉住按钮画成红色(destructive)、确认框按钮也是红色。danger, the word ActionSchema.variant uses #26966 合入,但没有任何测试经过action:bar走这条路径,卡要求「在 app-todo 形状上钉住」。ui/packages/components/src/renderers/action/__tests__/action-bar-danger-variant-26781.test.tsx(三个用例:危险按钮样式、对照按钮、确认框选项)。pnpm --dir ui exec vitest run packages/components/src/renderers/action/__tests__/action-bar-danger-variant-26781.test.tsx,预期 3 passed。What changes
One new test file,
action-bar-danger-variant-26781.test.tsx, underui/packages/components/src/renderers/action/__tests__/. No source change.It renders an
action:barshaped like the list page's toolbar (objectViewHeaderToolbar.ts:location: 'list_toolbar',size: 'sm',variant: 'outline') carrying two actions copied key for key fromexamples/app-todo(DeleteCompletedActionandExportToCsvAction,aiblock included), and asserts:delete_completedmember (variant: 'danger') draws with the Button primitive's destructive style (bg-destructive, not the bar's outline);export_csvin the same bar declares no variant and draws the bar'soutline;delete_completedasks itsconfirmTextthrough the confirm handler with{ title, confirmText: label, destructive: true }, and the script handler is not run on a cancel.Why
The code path landed with #26966 (
toButtonVariantmapsdangerto the primitive'sdestructive;toRunnerVariantforwardsdangerto the runner, whose confirm paints destructive). The existingdangerpins (action-variant-confirm-26665.test.tsx) driveaction:button/ icon / group / menu directly; nothing drove a declareddangeraction throughaction:bar, which is where a list toolbar action reaches the screen. The card's Wanted asks for that pin on the app-todo shape.Tests
domproject), run from theui/root.toButtonVariantcase 'danger'returnsdefault⇒ test 1 red (expected '…' to contain 'bg-destructive'), 2 passed; restore verified (blob equal to HEAD,git diff HEADempty).toRunnerVariantdrops itsdangercase ⇒ test 3 red (options losedestructive), 2 passed; restore verified the same way.pnpm --filter @object-ui/components run type-checkexit 0 (itstsconfig.test.jsonincludessrc/**/*.test.tsx).Acceptance notes
ActionConfirmDialog(@object-ui/app-shell) draws from.@object-ui/componentscannot import app-shell, so the dialog's own button class is not rendered here; this is the same layer the 26665 pins read.Verification
Derived gates — 24 derived, 24 run, all exit 0, on head 0d2d769
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 24 commands; each was run with its exit captured before any pipe;--ranreconciliation: "24 derived famil(ies) accounted for — 24 run, 0 NOT-MEASURED".--tier: no path-derived mandate; changed lines 143, under the 3000 threshold. Extra: eslint on the file exit 0;pnpm --dir ui run check:new-line-citationsreports 0 new citations.Tests only, nothing a released package ships:
skip-changeset.Generated by Claude Code