mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
3 commits
3e1bb8959f
...
14785d20d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14785d20d4 | ||
|
|
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']);
|
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} />);
|
render(<Editor {...sampleProps} />);
|
||||||
const deleteButton = screen.getAllByLabelText('delete')[0]; // Match original aria-label
|
const deleteButton = screen.getAllByLabelText('delete')[0];
|
||||||
fireEvent.click(deleteButton);
|
fireEvent.click(deleteButton);
|
||||||
expect(mockOnValuesChange).toHaveBeenCalledWith(['Question 2']);
|
expect(mockOnValuesChange).toHaveBeenCalledWith([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('renders delete buttons for each question', () => {
|
test('renders delete buttons for each question', () => {
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ const Editor: React.FC<EditorProps> = ({ label, values, onValuesChange, onFocusQ
|
||||||
{...provided.draggableProps}
|
{...provided.draggableProps}
|
||||||
{...provided.dragHandleProps}
|
{...provided.dragHandleProps}
|
||||||
sx={{
|
sx={{
|
||||||
marginBottom: '24px',
|
marginBottom: '8px',
|
||||||
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)',
|
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)',
|
||||||
border: '1px solid rgba(0, 0, 0, 0.1)',
|
border: '1px solid rgba(0, 0, 0, 0.1)',
|
||||||
padding: '16px',
|
padding: '16px',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue