angular-directive-mocker
v1.1.0
Published
angular directive mocking helper
Downloads
3
Readme
angular-directive-mocker
angular-directive-mocker
is a simple AngularJS directive/component mocking helper.
functional test source code here
Usage
Install
$ npm install angular-directive-mocker --save-dev
Mocking directives/components
Define mocks
import { directiveMockerBuilder } from 'angular-directive-mocker';
let mocker = directiveMockerBuilder()
.directive('bar', {
restrict: 'E',
scope: {
data: '='
},
template: 'bar mock'
})
.get();
Getting mocks
interface BarScope extends IScope {
data: string
}
let bar = mocker.mock<BarScope>('bar');
Bootstrap mocking module with application module
angular.mock.module('app', mocker.getModule().name);
Refer mock data
let bar = mocker.mock<BarScope>('bar');
bar().$scope; // `$scope` of bar directive/component