Skip to content

Commit

Permalink
fix: 🐛 don't overwrite explicitInput with combined input (#59938)
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich authored Mar 11, 2020
1 parent 5009f71 commit f176550
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ describe('EmbeddableActionStorage', () => {
expect(events2).toEqual([event]);
});

test('does not merge .getInput() into .updateInput()', async () => {
const embeddable = new TestEmbeddable();
const storage = new EmbeddableActionStorage(embeddable);
const event: UiActionsSerializedEvent = {
eventId: 'EVENT_ID',
triggerId: 'TRIGGER-ID',
action: {} as any,
};

const spy = jest.spyOn(embeddable, 'updateInput');

await storage.create(event);

expect(spy.mock.calls[0][0].id).toBe(undefined);
expect(spy.mock.calls[0][0].viewMode).toBe(undefined);
});

test('can create multiple events', async () => {
const embeddable = new TestEmbeddable();
const storage = new EmbeddableActionStorage(embeddable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class EmbeddableActionStorage implements UiActionsActionStorage {
}

this.embbeddable.updateInput({
...input,
events: [...events, event],
});
}
Expand All @@ -55,7 +54,6 @@ export class EmbeddableActionStorage implements UiActionsActionStorage {
}

this.embbeddable.updateInput({
...input,
events: [...events.slice(0, index), event, ...events.slice(index + 1)],
});
}
Expand All @@ -74,7 +72,6 @@ export class EmbeddableActionStorage implements UiActionsActionStorage {
}

this.embbeddable.updateInput({
...input,
events: [...events.slice(0, index), ...events.slice(index + 1)],
});
}
Expand Down

0 comments on commit f176550

Please sign in to comment.