Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

quartetcom/angular-directive-mocker

 
 

Repository files navigation

angular-directive-mocker

Build Status npm version

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

About

Simple AngularJS directive/component mocking helper

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 61.8%
  • JavaScript 38.2%