Skip to content
Snippets Groups Projects
Commit 718fb725 authored by Karishma Chadha's avatar Karishma Chadha
Browse files

Fix up tests.

parent 2eb70564
No related branches found
No related tags found
No related merge requests found
...@@ -33,8 +33,6 @@ describe('Working with sounds', () => { ...@@ -33,8 +33,6 @@ describe('Working with sounds', () => {
// Delete the sound // Delete the sound
await rightClickText('Meow', scope.soundsTab); await rightClickText('Meow', scope.soundsTab);
await clickText('delete', scope.soundsTab); await clickText('delete', scope.soundsTab);
await driver.switchTo().alert()
.accept();
// Add it back // Add it back
await clickXpath('//button[@aria-label="Choose a Sound"]'); await clickXpath('//button[@aria-label="Choose a Sound"]');
......
...@@ -55,8 +55,6 @@ describe('Working with sprites', () => { ...@@ -55,8 +55,6 @@ describe('Working with sprites', () => {
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation
await rightClickText('Sprite1', scope.spriteTile); await rightClickText('Sprite1', scope.spriteTile);
await clickText('delete', scope.spriteTile); await clickText('delete', scope.spriteTile);
await driver.switchTo().alert()
.accept();
// Confirm that the stage has been switched to // Confirm that the stage has been switched to
await findByText('Stage selected: no motion blocks'); await findByText('Stage selected: no motion blocks');
const logs = await getLogs(); const logs = await getLogs();
......
...@@ -48,22 +48,11 @@ describe('SpriteSelectorItem Container', () => { ...@@ -48,22 +48,11 @@ describe('SpriteSelectorItem Container', () => {
onDeleteButtonClick = jest.fn(); onDeleteButtonClick = jest.fn();
dispatchSetHoveredSprite = jest.fn(); dispatchSetHoveredSprite = jest.fn();
selected = true; selected = true;
// Mock window.confirm() which is called when the close button is clicked.
global.confirm = jest.fn(() => true);
}); });
test('should confirm if the user really wants to delete the sprite', () => { test('should delete the sprite', () => {
const wrapper = mountWithIntl(getContainer()); const wrapper = mountWithIntl(getContainer());
wrapper.find(CloseButton).simulate('click'); wrapper.find(CloseButton).simulate('click');
expect(global.confirm).toHaveBeenCalled();
expect(onDeleteButtonClick).toHaveBeenCalledWith(1337); expect(onDeleteButtonClick).toHaveBeenCalledWith(1337);
}); });
test('should not delete the sprite if the user cancels', () => {
global.confirm = jest.fn(() => false);
const wrapper = mountWithIntl(getContainer());
wrapper.find(CloseButton).simulate('click');
expect(global.confirm).toHaveBeenCalled();
expect(onDeleteButtonClick).not.toHaveBeenCalled();
});
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment