mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
2 commits
11b719e2ca
...
33bc038d32
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33bc038d32 | ||
|
|
def3e9f929 |
2 changed files with 9 additions and 4 deletions
|
|
@ -38,11 +38,16 @@ describe('Editor Component', () => {
|
|||
expect(mockOnValuesChange).toHaveBeenCalledWith(['Updated Question 1', 'Question 2']);
|
||||
});
|
||||
|
||||
test('calls onValuesChange with updated values when a question is deleted', () => {
|
||||
test('calls onValuesChange with updated values when an empty question is deleted', () => {
|
||||
const sampleProps = {
|
||||
label: 'Test Editor',
|
||||
values: [''],
|
||||
onValuesChange: mockOnValuesChange,
|
||||
};
|
||||
render(<Editor {...sampleProps} />);
|
||||
const deleteButton = screen.getAllByLabelText('delete')[0]; // Match original aria-label
|
||||
const deleteButton = screen.getAllByLabelText('delete')[0];
|
||||
fireEvent.click(deleteButton);
|
||||
expect(mockOnValuesChange).toHaveBeenCalledWith(['Question 2']);
|
||||
expect(mockOnValuesChange).toHaveBeenCalledWith([]);
|
||||
});
|
||||
|
||||
test('renders delete buttons for each question', () => {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ const Editor: React.FC<EditorProps> = ({ label, values, onValuesChange, onFocusQ
|
|||
{...provided.draggableProps}
|
||||
{...provided.dragHandleProps}
|
||||
sx={{
|
||||
marginBottom: '24px',
|
||||
marginBottom: '8px',
|
||||
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)',
|
||||
border: '1px solid rgba(0, 0, 0, 0.1)',
|
||||
padding: '16px',
|
||||
|
|
|
|||
Loading…
Reference in a new issue