diff --git a/src/containers/costume-tab.jsx b/src/containers/costume-tab.jsx index efaca4fbe49a968f91ccc4b22178b6db6af711f2..7d5caf341484db4b6ba09d6ac62c160537fdbfbe 100644 --- a/src/containers/costume-tab.jsx +++ b/src/containers/costume-tab.jsx @@ -207,7 +207,7 @@ class CostumeTab extends React.Component { handleFileUpload(e.target, (buffer, fileType, fileName) => { costumeUpload(buffer, fileType, storage, vmCostumes => { vmCostumes.forEach((costume, i) => { - costume.name = `${fileName}${i + 1}`; + costume.name = `${fileName}${i ? i + 1 : ''}`; }); this.handleNewCostume(vmCostumes); }); diff --git a/src/containers/stage-selector.jsx b/src/containers/stage-selector.jsx index efb8dc7d215602b45f381e047f2735e18fef7590..6d9188874287514448f383c20dda46879988d1cc 100644 --- a/src/containers/stage-selector.jsx +++ b/src/containers/stage-selector.jsx @@ -63,9 +63,13 @@ class StageSelector extends React.Component { handleClick () { this.props.onSelect(this.props.id); } - handleNewBackdrop (backdrop) { - this.props.vm.addBackdrop(backdrop.md5, backdrop).then(() => - this.props.onActivateTab(COSTUMES_TAB_INDEX)); + handleNewBackdrop (backdrops_) { + const backdrops = Array.isArray(backdrops_) ? backdrops_ : [backdrops_]; + Promise.all(backdrops.map(backdrop => + this.props.vm.addBackdrop(backdrop.md5, backdrop) + )).then(() => + this.props.onActivateTab(COSTUMES_TAB_INDEX) + ); } handleSurpriseBackdrop () { // @todo should this not add a backdrop you already have? @@ -80,7 +84,7 @@ class StageSelector extends React.Component { handleFileUpload(e.target, (buffer, fileType, fileName) => { costumeUpload(buffer, fileType, storage, vmCostumes => { vmCostumes.forEach((costume, i) => { - costume.name = `${fileName}${i + 1}`; + costume.name = `${fileName}${i ? i + 1 : ''}`; }); this.handleNewBackdrop(vmCostumes); }); diff --git a/src/lib/file-uploader.js b/src/lib/file-uploader.js index 70fb32aff15e6df281afc25d12d2f47df1f46b0f..86e0a29d95d4566d53fc8b8dae1b2b6707970994 100644 --- a/src/lib/file-uploader.js +++ b/src/lib/file-uploader.js @@ -210,7 +210,7 @@ const spriteUpload = function (fileData, fileType, spriteName, storage, handleSp // Make a sprite from an image by making it a costume first costumeUpload(fileData, fileType, storage, vmCostumes => { vmCostumes.forEach((costume, i) => { - costume.name = `${spriteName}${i + 1}`; + costume.name = `${spriteName}${i ? i + 1 : ''}`; }); const newSprite = { name: spriteName, diff --git a/test/integration/backdrops.test.js b/test/integration/backdrops.test.js index d0a3e84aa841f73309fb36c88019092e943b6a03..b9acd830792393af52ecb87b10d70723e482bde3 100644 --- a/test/integration/backdrops.test.js +++ b/test/integration/backdrops.test.js @@ -51,7 +51,7 @@ describe('Working with backdrops', () => { await expect(logs).toEqual([]); }); - test.only('Adding multiple backdrops at the same time', async () => { + test('Adding multiple backdrops at the same time', async () => { const files = [ path.resolve(__dirname, '../fixtures/gh-3582-png.png'), path.resolve(__dirname, '../fixtures/100-100.svg') diff --git a/test/integration/costumes.test.js b/test/integration/costumes.test.js index 19c885ab820bd8c8353d09b80f1aed25d000aa01..0dc7814932397bc975b2d3bdf73fbca214f5a680 100644 --- a/test/integration/costumes.test.js +++ b/test/integration/costumes.test.js @@ -204,7 +204,7 @@ describe('Working with costumes', () => { await expect(logs).toEqual([]); }); - test.only('Adding multiple costumes at the same time', async () => { + test('Adding multiple costumes at the same time', async () => { const files = [ path.resolve(__dirname, '../fixtures/gh-3582-png.png'), path.resolve(__dirname, '../fixtures/100-100.svg') diff --git a/test/integration/sprites.test.js b/test/integration/sprites.test.js index fc026f967b8c9fca105ed329da99db1266e1d874..32c3b690a6850c9653ebe1c7bbae21e81277a31c 100644 --- a/test/integration/sprites.test.js +++ b/test/integration/sprites.test.js @@ -116,7 +116,7 @@ describe('Working with sprites', () => { // Check to make sure the size is right await clickText('Costumes'); - await clickText('100-1001', scope.costumesTab); // The name of the costume + await clickText('100-100', scope.costumesTab); // The name of the costume await clickText('100 x 100', scope.costumesTab); // The size of the costume const logs = await getLogs(); await expect(logs).toEqual([]); @@ -134,7 +134,7 @@ describe('Working with sprites', () => { await clickText('paddleball', scope.spriteTile); // Sprite is named for costume filename await clickText('Costumes'); - await findByText('paddleball1', scope.costumesTab); + await findByText('paddleball', scope.costumesTab); await findByText('paddleball2', scope.costumesTab); await findByText('paddleball3', scope.costumesTab); await findByText('paddleball4', scope.costumesTab); @@ -182,7 +182,7 @@ describe('Working with sprites', () => { await expect(logs).toEqual([]); }); - test.only('Adding multiple sprites at the same time', async () => { + test('Adding multiple sprites at the same time', async () => { const files = [ path.resolve(__dirname, '../fixtures/gh-3582-png.png'), path.resolve(__dirname, '../fixtures/100-100.svg')