Giter Site home page Giter Site logo

tomyam1 / angular Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bclinkinbeard/angular

0.0 0.0 0.0 1.33 MB

AngularJS compiled with jsdom and provided as a CommonJS module. Intended for testing AngularJS code without depending on a browser.

JavaScript 100.00%

angular's People

Contributors

bclinkinbeard avatar tomyam1-personal avatar

Watchers

 avatar

angular's Issues

monkey patch angular-mocks to support beforeAll and afterAll

Not trivial at all.
This is what a I came up with.
Issues:

  • How to support beforeAll and afterAll in a describe block
  • How to clear injector after last afterAll
// Monkey-patch arround angular-mocks to support

  var origBeforeEach = beforeEach,
    origAfterEach = afterEach,
    beforeSpec, afterSpec;

  window.beforeEach = function (fn) {
    if (beforeSpec) {
      throw new Error('beforeEach was called a second time by angular-mocks');
    }
    beforeSpec = fn;
  }

  window.afterEach = function (fn) {
    if (afterSpec) {
      throw new Error('afterEach was called a second time by angular-mocks');
    }
    afterSpec = fn;
  }

  require(paths.ngMocks);

  if (!beforeSpec) {
    throw new Error('beforeEach was not called by angular-mocks');
  }

  if (!afterSpec) {
    throw new Error('afterEach was not called by angular-mocks');
  }

  window.beforeEach = origBeforeEach;
  window.afterEach = origAfterEach;

  // prepare injector for beforeAll blocks
  beforeAll(beforeSpec);

  // clear inspector before the first spec
  var isFirst = true;
  beforeEach(function() {
    if (isFirst) {
      isFirst = false;
      afterSpec();
    }
  });

  // prepare injector for the afterAll blocks
  afterAll(beforeSpec);

  // prepare and clear injector for each spec
  beforeEach(beforeSpec);
  afterEach(afterSpec);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.