Skip to content

Commit

Permalink
Angular mocks changes for 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredreynolds authored and John Emau committed Oct 23, 2013
1 parent b24f27d commit 465dfba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
20 changes: 20 additions & 0 deletions angularjs/angular-mocks-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// <reference path="angular-mocks.d.ts" />

declare var mock: ng.IMockStatic;

mock.dump({ key: 'value' });

mock.inject(
function () { return 1; },
function () { return 2; }
);

mock.module('module1', 'module2');
mock.module(
function () { return 1; },
function () { return 2; }
);
mock.module({ module1: function () { return 1; } });

mock.TzDate(-7, '2013-1-1T15:00:00Z');
mock.TzDate(-8, 12345678);
13 changes: 7 additions & 6 deletions angularjs/angular-mocks.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module)
// Type definitions for Angular JS 1.2.0 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Definitions: https://github.com/daptiv/DefinitelyTyped


/// <reference path="angular.d.ts" />
Expand All @@ -26,14 +25,16 @@ declare module ng {
}

interface IMockStatic {
// see http://docs.angularjs.org/api/angular.mock.debug
debug(obj: any): string;
// see http://docs.angularjs.org/api/angular.mock.dump
dump(obj: any): string;

// see http://docs.angularjs.org/api/angular.mock.inject
inject(...fns: Function[]): any;

// see http://docs.angularjs.org/api/angular.mock.module
module(...modules: any[]): any;
module(...modules: string[]): any;
module(...modules: Function[]): any;
module(modules: Object): any;

This comment has been minimized.

Copy link
@basarat

basarat Jul 26, 2014

Member

this seems wrong. You should be able to do the following and ^ prevents it:

angular.mock.module("myApp", function($provide) {
    $provide.value("myService", {
        ...
    });
})

This comment has been minimized.

Copy link
@basarat

basarat Jul 26, 2014

Member

Fixed in : #2564


// see http://docs.angularjs.org/api/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
Expand Down

0 comments on commit 465dfba

Please sign in to comment.