Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Testing utilities for ng-metadata to match Angular 2

License

Notifications You must be signed in to change notification settings

aciccarello/ng-metadata-testing

Repository files navigation

ng-metadata-testing

Testing utilities for ng-metadata to match Angular 2

Developing the project

  1. Start typescript compiler watching for changes

npm start

  1. Start tests

npm test -- --watch

See ngParty/ng-metadata#93

ng-metadata-testing API

ComponentFixture (partially implemented)

/**
 * Fixture for debugging and testing a component.
 */
export declare class ComponentFixture<T> {
    /** Instance of the component from the scope */
    componentInstance: T;
    
    /** The native HTML element at the root of the component */
    nativeElement: HTMLElement;

    /** The jQuery wrapped element */
    elementRef: ng.IAugmentedJQuery;

    /** $scope of the component */
    $scope: ComponentScope<T>;

    constructor(componentRef: {
        new (): T;
    });

    /** Trigger a change detection cycle */
    detectChanges(): void;

    /** Not implemented yet */
    destroy(): void;
}

/**
 * Scope of the component instance with the `$ctrl` property typed
 */
export interface ComponentScope<T> extends ng.IScope {
    $ctrl: T;
}

inject (implemented)

/**
 * Allows injecting dependencies based on their token
 * @param tokens Array of injectable classes or string service names as registered with angular
 * @param fn Callback fn to run with parameters matching the tokens Array
 * @return angular.mock.inject called with the callback fn
 */
export declare function inject(tokens: any[], fn: Function): () => any;

TestBed (not implemented)

About

Testing utilities for ng-metadata to match Angular 2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published