feat(18-01): money list column, danger record actions, preview Edit rule and table kit (task 2)
- columns.yaml type: money with currency or currencyFrom (exactly one), never searchable, not sortable by default; every list row carries the currencyFrom column's value under its own key; the schema serves currency and currencyFrom on the column - pact.AdminRecordAction.Danger, served as danger on cabana.RecordAction (absent when false); RecordActions.vue passes it to the confirm dialog - CellValue money kind through formatMoney with the row's code, the em dash when empty and the amount alone without a code; DataTable aligns money headers and cells to the right - PreviewView renders Edit only when a registered value field allows update (F6) - main.css .summer-table* and .summer-stat__note kit classes (F7) over --c-* variables; cabana README kit rows - fixture record actions void (danger) and resend; TestMoneyListCompile, TestMoneyListSmoke and TestRecordActionDangerSmoke; regenerated OpenAPI and TS types; rebuilt dist; lists-and-filters and admin-controllers docs
This commit is contained in:
@@ -294,3 +294,39 @@ describe('preview view footer (UI-SPEC S2, D-10)', () => {
|
||||
expect(router.currentRoute.value.path).toBe('/acme/roster/people/1')
|
||||
})
|
||||
})
|
||||
|
||||
describe('preview edit rule (UI-SPEC F6)', () => {
|
||||
it('shows no Edit button and no primary fill when the form holds only partial fields', async () => {
|
||||
const partialOnly = schemaWith((schema) => {
|
||||
schema.fields = [
|
||||
{ name: 'cart', type: 'partial', label: 'Cart', path: 'cart' },
|
||||
{ name: 'payments', type: 'partial', label: 'Payments', path: 'payments' },
|
||||
] as typeof schema.fields
|
||||
})
|
||||
const { wrapper } = await mountApp(
|
||||
PREVIEW,
|
||||
routes({
|
||||
[`GET ${LIST}/schema/form`]: partialOnly,
|
||||
[`GET ${LIST}/partials/cart`]: { body: noHint },
|
||||
[`GET ${LIST}/partials/payments`]: { body: noHint },
|
||||
[`GET ${RECORD}`]: recordWith((record) => (record.meta.actions = [{ name: 'activate', label: 'Activate' }])),
|
||||
}),
|
||||
)
|
||||
expect(wrapper.find('[data-action="edit"]').exists()).toBe(false)
|
||||
expect(wrapper.findAll('[data-preview] footer .bg-primary')).toHaveLength(0)
|
||||
expect(footerButtons(wrapper)).toEqual(['activate'])
|
||||
})
|
||||
|
||||
it('keeps the Edit button when the form has a text field the update context allows', async () => {
|
||||
const { wrapper } = await mountApp(PREVIEW, routes())
|
||||
expect(wrapper.find('[data-action="edit"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('hides the Edit button when every value field is preview-only', async () => {
|
||||
const previewOnly = schemaWith((schema) => {
|
||||
schema.fields = [{ name: 'joined_ip', type: 'text', label: 'Joined from', context: 'preview' }] as typeof schema.fields
|
||||
})
|
||||
const { wrapper } = await mountApp(PREVIEW, routes({ [`GET ${LIST}/schema/form`]: previewOnly }))
|
||||
expect(wrapper.find('[data-action="edit"]').exists()).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user