File

core/testing/mocks/mock-component.ts

Extends

GoogleMapsComponentBase

Metadata

Index

Properties
Methods
Inputs
Outputs

Inputs

something
Type : any
custom
Type : any
Inherited from GoogleMapsComponentBase

Outputs

click
Type : EventEmitter<IGoogleMapsEventData>
dummyChange
Type : EventEmitter<IGoogleMapsEventData>

Methods

Protected initEmitters
initEmitters()
Inherited from GoogleMapsComponentBase

Executed by the constructor, before angular attempts to bind events. Calls the api.hookAndSetEmitters() method with the appropriate implementation. The default call is api.hookAndSetEmitters(this) which will hook native events to this component instance using the inner wrapper and no event filtering. Override this method to change implementation.

Returns: void
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Inherited from GoogleMapsComponentBase
Parameters:
Name Type Optional
changes SimpleChanges No
Returns: void

Properties

Public Readonly NativeChangeEventName
Type: string
Default value: 'dummy_change'
Public Readonly NativeClickEventName
Type: string
Default value: 'click'
Public Readonly wrapper
Type: TWrapper
Decorators:
@Inject(WrapperInstance)
Inherited from GoogleMapsComponentBase
The instance of the wrapper to use with this component. Should be provided at the extending component level using the `WrapperInstance` token.
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>;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""