diff --git a/src/containers/sprite-selector-item.jsx b/src/containers/sprite-selector-item.jsx index a0197ad6dd9ecfc09e61c5a783878395eef7e509..b2fb8f8770552f02b290cd58a38907683861a0c2 100644 --- a/src/containers/sprite-selector-item.jsx +++ b/src/containers/sprite-selector-item.jsx @@ -2,7 +2,6 @@ import bindAll from 'lodash.bindall'; import PropTypes from 'prop-types'; import React from 'react'; import {connect} from 'react-redux'; -import {defineMessages, injectIntl, intlShape} from 'react-intl'; import {setHoveredSprite} from '../reducers/hovered-target'; import {updateAssetDrag} from '../reducers/asset-drag'; @@ -12,14 +11,6 @@ import SpriteSelectorItemComponent from '../components/sprite-selector-item/spri const dragThreshold = 3; // Same as the block drag threshold -const messages = defineMessages({ - deleteSpriteConfirmation: { - defaultMessage: 'Are you sure you want to delete this?', - description: 'Confirmation for deleting sprites', - id: 'gui.spriteSelectorItem.deleteSpriteConfirmation' - } -}); - class SpriteSelectorItem extends React.Component { constructor (props) { super(props); @@ -84,10 +75,7 @@ class SpriteSelectorItem extends React.Component { } handleDelete (e) { e.stopPropagation(); // To prevent from bubbling back to handleClick - // eslint-disable-next-line no-alert - if (window.confirm(this.props.intl.formatMessage(messages.deleteSpriteConfirmation))) { - this.props.onDeleteButtonClick(this.props.id); - } + this.props.onDeleteButtonClick(this.props.id); } handleDuplicate (e) { e.stopPropagation(); // To prevent from bubbling back to handleClick @@ -144,7 +132,6 @@ SpriteSelectorItem.propTypes = { dragType: PropTypes.string, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), index: PropTypes.number, - intl: intlShape.isRequired, name: PropTypes.string, onClick: PropTypes.func, onDeleteButtonClick: PropTypes.func, @@ -172,4 +159,4 @@ const mapDispatchToProps = dispatch => ({ export default connect( mapStateToProps, mapDispatchToProps -)(injectIntl(SpriteSelectorItem)); +)(SpriteSelectorItem); diff --git a/test/integration/sounds.test.js b/test/integration/sounds.test.js index 7c306a5eee2c9c05c2d16d1c9ed8a1a489f5370c..ca1a3d275d8271e63af5068659429d4b4a4cee7e 100644 --- a/test/integration/sounds.test.js +++ b/test/integration/sounds.test.js @@ -33,8 +33,6 @@ describe('Working with sounds', () => { // Delete the sound await rightClickText('Meow', scope.soundsTab); await clickText('delete', scope.soundsTab); - await driver.switchTo().alert() - .accept(); // Add it back await clickXpath('//button[@aria-label="Choose a Sound"]'); diff --git a/test/integration/sprites.test.js b/test/integration/sprites.test.js index 41f2eec3ab4220e83fc08f8936c35328367f3da4..5b99efcb62e0496312d31f15e8746b260ad204a1 100644 --- a/test/integration/sprites.test.js +++ b/test/integration/sprites.test.js @@ -55,8 +55,6 @@ describe('Working with sprites', () => { await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation await rightClickText('Sprite1', scope.spriteTile); await clickText('delete', scope.spriteTile); - await driver.switchTo().alert() - .accept(); // Confirm that the stage has been switched to await findByText('Stage selected: no motion blocks'); const logs = await getLogs(); diff --git a/test/unit/containers/sprite-selector-item.test.jsx b/test/unit/containers/sprite-selector-item.test.jsx index 85032603d4b3a1712db3fb431a96d109dc40d7d7..f133c02a25789791f754e275edcfb58eb813c777 100644 --- a/test/unit/containers/sprite-selector-item.test.jsx +++ b/test/unit/containers/sprite-selector-item.test.jsx @@ -48,22 +48,11 @@ describe('SpriteSelectorItem Container', () => { onDeleteButtonClick = jest.fn(); dispatchSetHoveredSprite = jest.fn(); 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()); wrapper.find(CloseButton).simulate('click'); - expect(global.confirm).toHaveBeenCalled(); 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(); - }); });