// ProductTextModal loads a product, surfaces a TextControl for `name` or a // TextareaControl for `short_description`, and on Save writes the field via // saveProduct + pushes a `product` undo entry. No-op when unchanged. import { act, fireEvent, render, waitFor } from '@testing-library/react'; const mockLoadProduct = jest.fn(); const mockSaveProduct = jest.fn(); const mockTrack = jest.fn(); const mockPushUndo = jest.fn(); jest.mock('@quick-edit/lib/api', () => ({ loadProduct: (...args) => mockLoadProduct(...args), saveProduct: (...args) => mockSaveProduct(...args), })); jest.mock('@quick-edit/lib/cmd-enter-save', () => ({ useCmdEnterSave: jest.fn(), })); jest.mock('@quick-edit/lib/insights', () => ({ track: (...args) => mockTrack(...args), })); jest.mock('@quick-edit/state/undo', () => ({ pushUndo: (...args) => mockPushUndo(...args), })); jest.mock('@wordpress/components', () => ({ Modal: ({ title, onRequestClose, children }) => (
), Button: ({ children, onClick, disabled, isBusy }) => ( ), Notice: ({ children, status }) => (
{children}
), Spinner: () => , TextControl: ({ label, value, onChange }) => ( ), TextareaControl: ({ label, value, onChange, rows }) => (