Skip to content

Commit

Permalink
Add userDestroy when block is not added to morphic tree. Fix #1097
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Oct 2, 2020
1 parent 47c80e1 commit 6685820
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6063,7 +6063,9 @@ ReporterBlockMorph.prototype.prepareToBeGrabbed = function (handMorph) {
this.setPosition(oldPos);
}
ReporterBlockMorph.uber.prepareToBeGrabbed.call(this, handMorph);
handMorph.alpha = this.alpha < 1 ? 1 : 0.85;
if (handMorph) {
handMorph.alpha = this.alpha < 1 ? 1 : 0.85;
}
this.cachedSlotSpec = null;
};

Expand Down
19 changes: 19 additions & 0 deletions test/blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,25 @@ describe('blocks', function() {
describe('rpc', function() {
beforeEach(() => driver.reset());

it('should show help when RPC inputs exist', async function() {
const block = await driver.addBlock('getJSFromRPCStruct');
const [serviceField, rpcField] = block.inputs();
await SnapActions.setField(serviceField, 'Dev');
await SnapActions.setField(rpcField, 'echo');
const [/*serviceField*/, /*rpcField*/, input] = block.inputs();
const messageBlock = driver.palette().contents.children.find(
block => block.selector === 'getLastMessage'
);
driver.dragAndDrop(messageBlock, input.center());

await block.showHelp();
const dialog = driver.dialog();
assert(
dialog && dialog.key.includes('Help'),
'Help dialog did not appear'
);
});

it('should populate method with `setField`', async function() {
// create rpc block
const block = await driver.addBlock('getJSFromRPCStruct');
Expand Down

0 comments on commit 6685820

Please sign in to comment.