import { Embeddable , EmbeddableInput } from '../../../../../../../src/plugins/embeddable/public' ; import { EnhancedEmbeddable } from '../../../../../embeddable_enhanced/public' ; import { UiActionsEnhancedMemoryActionStorage as MemoryActionStorage , UiActionsEnhancedDynamicActionManager as DynamicActionManager , AdvancedUiActionsStart , } from '../../../../../ui_actions_enhanced/public' ; import { uiActionsEnhancedPluginMock } from '../../../../../ui_actions_enhanced/public/mocks' ; export class MockEmbeddable extends Embeddable { public rootType = 'dashboard' ; public readonly type = 'mock' ; private readonly triggers : string [ ] = [ ] ; constructor ( initialInput , params ) { super ( initialInput , { } , undefined ) ; this . triggers = params . supportedTriggers ?? [ ] ; } public render ( node ) { } public reload ( ) { } public supportedTriggers ( ) { return this . triggers ; } public getRoot ( ) { return { type : this . rootType , } as Embeddable ; } } export const enhanceEmbeddable = < E extends MockEmbeddable > ( embeddable , uiActions = uiActionsEnhancedPluginMock . createStartContract ( ) ) : EnhancedEmbeddable < E > => { ( embeddable as EnhancedEmbeddable < E > ) . enhancements = { dynamicActions : new DynamicActionManager ( { storage : new MemoryActionStorage ( ) , isCompatible : async ( ) => true , uiActions , } ) , } ; return embeddable as EnhancedEmbeddable < E > ; } ;