mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Editor test modified after changes of the component
This commit is contained in:
parent
11b719e2ca
commit
def3e9f929
1 changed files with 8 additions and 3 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', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue