Extends

MockEmittingWrapper

Index

core/testing/mocks/mock-component.ts

Properties
Methods

Properties

Public events
Default value: new MockGoogleEvents()
Inherited from MockEmittingWrapper
Public api
Type: object
Default value: { runOutsideAngular: jest.fn().mockImplementation(fn => fn()) }
Inherited from MockWrapper
custom
Type: any
Inherited from MockWrapper
Public native
Type: TNative
Inherited from MockWrapper

Methods

clearListeners
clearListeners()
Inherited from MockEmittingWrapper
Returns: void
listenTo
listenTo(eventName: string, handler: (args: any[]) => void)
Inherited from MockEmittingWrapper
Parameters:
Name Type Optional
eventName string No
handler function No
Returns: void
stopListeningTo
stopListeningTo(eventName: string)
Inherited from MockEmittingWrapper
Parameters:
Name Type Optional
eventName string No
Returns: void
Public setCustom
setCustom(custom: any)
Inherited from MockWrapper
Parameters:
Name Type Optional
custom any No
Returns: void
import { Component, Input, Output, EventEmitter, FactoryProvider } from '@angular/core';

import { GoogleMapsComponentBase, WrapperInstance, Hook, IGoogleMapsEventData, NativeObjectWrapper } from '@bespunky/angular-google-maps/core';
import { WrappedNativeFunctions                                                                    } from '@bespunky/angular-google-maps/core';
import { MockNative                                                                                } from './mock-native';
import { MockEmittingWrapper                                                                       } from './mock-emitting-wrapper';

@NativeObjectWrapper<TestWrapper>()
class     TestWrapper extends MockEmittingWrapper<MockNative> { }

interface TestWrapper extends WrappedNativeFunctions<MockNative> { }

export  function TestWrapperFactory()
{
    return new TestWrapper(new MockNative());
}

export const TestWrapperFactoryProvider: FactoryProvider = {
    provide   : WrapperInstance,
    useFactory: TestWrapperFactory
};

// @dynamic
@Component({
    selector: 'test-lifecycle',
    template: '<div></div>',
    providers: [TestWrapperFactoryProvider] // TODO: Move to module
})
export class MockComponent extends GoogleMapsComponentBase<TestWrapper>
{
    public readonly NativeClickEventName  = 'click';
    public readonly NativeChangeEventName = 'dummy_change';

    @Input() something: any;

    @Hook()               @Output() click      : EventEmitter<IGoogleMapsEventData>;
    @Hook('dummy_change') @Output() dummyChange: EventEmitter<IGoogleMapsEventData>;
}

results matching ""

    No results matching ""