Skip to content
Snippets Groups Projects
Unverified Commit 9ba50318 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #3766 from LLK/hotfix-delete-sprite-crash

[Hotfix] Prevent crash after deleting sprite that had been highlighted
parents 5f10ba94 dde9361a
Branches
Tags
No related merge requests found
...@@ -32,7 +32,8 @@ class TargetHighlight extends React.Component { ...@@ -32,7 +32,8 @@ class TargetHighlight extends React.Component {
vm vm
} = this.props; } = this.props;
if (!(highlightedTargetId && vm && vm.renderer)) return null; if (!(highlightedTargetId && vm && vm.renderer &&
vm.runtime.getTargetById(highlightedTargetId))) return null;
const target = vm.runtime.getTargetById(highlightedTargetId); const target = vm.runtime.getTargetById(highlightedTargetId);
const bounds = vm.renderer.getBounds(target.drawableID); const bounds = vm.renderer.getBounds(target.drawableID);
......
import path from 'path';
import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
rightClickText,
getDriver,
getLogs,
loadUri,
scope
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
let driver;
describe('Loading scratch gui', () => {
beforeAll(() => {
driver = getDriver();
});
afterAll(async () => {
await driver.quit();
});
test('Switching small/large stage after highlighting and deleting sprite', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
// Highlight the sprite
await clickText('Sprite1', scope.spriteTile);
// Delete it
await rightClickText('Sprite1', scope.spriteTile);
await clickText('delete', scope.spriteTile);
// Go to small stage mode
await clickXpath('//img[@alt="Switch to small stage"]');
// Confirm app still working
await clickXpath('//img[@alt="Switch to large stage"]');
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment