Merge pull request #1 from borisyankov/master

Updating local fork
This commit is contained in:
jvilk
2013-11-03 01:15:52 -08:00
423 changed files with 26214 additions and 1509 deletions

View File

@@ -1,4 +1,4 @@
DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped)
DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped)
===============
The repository for *high quality* TypeScript type definitions.
@@ -29,6 +29,7 @@ List of Definitions
* [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei))
* [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/))
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
@@ -44,9 +45,12 @@ List of Definitions
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
* [d3.js](http://d3js.org/) (from TypeScript samples)
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
* [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem))
@@ -68,10 +72,12 @@ List of Definitions
* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros))
* [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk))
* [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/))
* [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo))
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [Dániel Tar](https://github.com/qcz))
* [GoJS](http://gojs.net/) (by [Barbara Duckworth](https://github.com/barbara42))
* [Greasemonkey](http://www.greasespot.net/) (by [Kota Saito](https://github.com/kotas))
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
* [Grunt JS](http://gruntjs.com/) (by [Basarat Ali Syed](https://github.com/basarat))
* [Grunt JS](http://gruntjs.com/) (by [Jeff May](https://github.com/jeffmay) and [Basarat Ali Syed](https://github.com/basarat))
* [Google API Client](https://code.google.com/p/google-api-javascript-client/) (by [Frank M](https://github.com/sgtfrankieboy))
* [Google App Engine Channel API](https://developers.google.com/appengine/docs/java/channel/javascript) (by [vvakame](https://github.com/vvakame))
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
@@ -122,6 +128,7 @@ List of Definitions
* [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski))
* [jQuery.timeago](http://timeago.yarp.com/) (by [François Guillot](http://fguillot.developpez.com/))
* [jQuery.Timepicker](http://fgelinas.com/code/timepicker/) (by [Anwar Javed](https://github.com/anwarjaved))
* [jQuery.Timer](http://jchavannes.com/jquery-timer/demo) (by [Joshua Strobl](https://github.com/JoshStrobl))
* [jQuery.TinyCarousel](http://baijs.nl/tinycarousel/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.TinyScrollbar](http://baijs.nl/tinyscrollbar/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U))
@@ -137,6 +144,7 @@ List of Definitions
* [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC))
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel](https://github.com/JudahGabriel))
* [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig))
@@ -151,6 +159,7 @@ List of Definitions
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone))
* [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle))
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
* [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams] (https://github.com/flurg))
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/))
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
@@ -163,6 +172,7 @@ List of Definitions
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
* [OpenLayers] (https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))

View File

@@ -586,6 +586,8 @@ var DefinitelyTyped;
var command = 'node ./_infrastructure/tests/typescript/tsc.js --module commonjs ';
if (IO.fileExists(tsfile + '.tscparams')) {
command += '@' + tsfile + '.tscparams';
} else {
command += '--noImplicitAny';
}
Exec.exec(command, [tsfile], function (ExecResult) {
callback(ExecResult);

View File

@@ -31,6 +31,8 @@ module DefinitelyTyped {
var command = 'node ./_infrastructure/tests/typescript/tsc.js --module commonjs ';
if (IO.fileExists(tsfile + '.tscparams')) {
command += '@' + tsfile + '.tscparams';
} else {
command += '--noImplicitAny';
}
Exec.exec(command, [tsfile], (ExecResult) => {
callback(ExecResult);

1
ace/ace.d.ts.tscparams Normal file
View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -35,6 +35,7 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
* `ng.cookies` for **ngCookies**
* `ng.mock` for **ngMock**
* `ng.resource` for **ngResource**
* `ng.route` for **ngRoute**
* `ng.sanitize` for **ngSanitize**
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.

View File

@@ -0,0 +1,219 @@
/// <reference path="angular-1.0.d.ts" />
// issue: https://github.com/borisyankov/DefinitelyTyped/issues/369
https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2012 Witold Szczerba
* License: MIT
*/
angular.module('http-auth-interceptor', [])
.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer = [];
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
buffer.push({
config: config,
deferred: deferred
});
}
this.$get = ['$rootScope', '$injector', <any>function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
}
function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
}
buffer = [];
}
return {
loginConfirmed: function () {
$rootScope.$broadcast('event:auth-loginConfirmed');
retryAll();
}
}
}]
})
/**
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider) {
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
function success(response: ng.IHttpPromiseCallbackArg<any>) {
return response;
}
function error(response: ng.IHttpPromiseCallbackArg<any>) {
if (response.status === 401) {
var deferred = $q.defer();
authServiceProvider.pushToBuffer(response.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
// otherwise
return $q.reject(response);
}
return function (promise: ng.IHttpPromise<any>) {
return promise.then(success, error);
}
}];
$httpProvider.responseInterceptors.push(interceptor);
}]);
module HttpAndRegularPromiseTests {
interface Person {
firstName: string;
lastName: string;
}
interface ExpectedResponse extends Person { }
interface SomeControllerScope extends ng.IScope {
person: Person;
theAnswer: number;
letters: string[];
}
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
$http.get("http://somewhere/some/resource")
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would type check
$scope.person = response.data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would NOT type check
$scope.person = response.data;
});
var aPromise: ng.IPromise<Person> = $q.when({ firstName: "Jack", lastName: "Sparrow" });
aPromise.then((person: Person) => {
$scope.person = person;
});
var bPromise: ng.IPromise<number> = $q.when(42);
bPromise.then((answer: number) => {
$scope.theAnswer = answer;
});
var cPromise: ng.IPromise<string[]> = $q.when(["a", "b", "c"]);
cPromise.then((letters: string[]) => {
$scope.letters = letters;
});
}
// Test that we can pass around a type-checked success/error Promise Callback
var anotherController: Function = ($scope: SomeControllerScope, $http:
ng.IHttpService, $q: ng.IQService) => {
var buildFooData: Function = () => 42;
var doFoo: Function = (callback: ng.IHttpPromiseCallback<ExpectedResponse>) => {
$http.get('/foo', buildFooData())
.success(callback);
}
doFoo((data) => console.log(data));
}
}
// Test for AngularJS Syntax
module My.Namespace {
export var x; // need to export something for module to kick in
}
// IModule Registering Test
var mod = angular.module('tests', []);
mod.controller('name', function ($scope: ng.IScope) { })
mod.controller('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.controller(My.Namespace);
mod.directive('name', <any>function ($scope: ng.IScope) { })
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.directive(My.Namespace);
mod.factory('name', function ($scope: ng.IScope) { })
mod.factory('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.factory(My.Namespace);
mod.filter('name', function ($scope: ng.IScope) { })
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.filter(My.Namespace);
mod.provider('name', function ($scope: ng.IScope) { })
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.provider(My.Namespace);
mod.service('name', function ($scope: ng.IScope) { })
mod.service('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.service(My.Namespace);
mod.constant('name', 23);
mod.constant('name', "23");
mod.constant(My.Namespace);
mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
// Promise signature tests
var foo: ng.IPromise<number>;
foo.then((x) => {
// x is inferred to be a number
return "asdf";
}).then((x) => {
// x is inferred to be string
x.length;
return 123;
}).then((x) => {
// x is infered to be a number
x.toFixed();
return;
}).then((x) => {
// x is infered to be void
// Typescript will prevent you to actually use x as a local variable
// Try object:
return { a: 123 };
}).then((x) => {
// Object is inferred here
x.a = 123;
//Try a promise
var y: ng.IPromise<number>;
return y;
}).then((x) => {
// x is infered to be a number, which is the resolved value of a promise
x.toFixed();
});
// angular.element() tests
var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();

View File

@@ -0,0 +1 @@
""

760
angularjs/angular-1.0.d.ts vendored Executable file
View File

@@ -0,0 +1,760 @@
// Type definitions for Angular JS 1.0
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare var angular: ng.IAngularStatic;
// Support for painless dependency injection
interface Function {
$inject:string[];
}
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng {
// All service providers extend this interface
interface IServiceProvider {
$get(): any;
}
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// see http://docs.angularjs.org/api
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
bind(context: any, fn: Function, ...args: any[]): Function;
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
bootstrap(element: Document, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: IAugmentedJQueryStatic;
equals(value1: any, value2: any): boolean;
extend(destination: any, ...sources: any[]): any;
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
fromJson(json: string): any;
identity(arg?: any): any;
injector(modules?: any[]): auto.IInjectorService;
isArray(value: any): boolean;
isDate(value: any): boolean;
isDefined(value: any): boolean;
isElement(value: any): boolean;
isFunction(value: any): boolean;
isNumber(value: any): boolean;
isObject(value: any): boolean;
isString(value: any): boolean;
isUndefined(value: any): boolean;
lowercase(str: string): string;
/** construct your angular application
official docs: Interface for configuring angular modules.
see: http://docs.angularjs.org/api/angular.Module
*/
module(
/** name of your module you want to create */
name: string,
/** name of modules yours depends on */
requires?: string[],
configFunction?: any): IModule;
noop(...args: any[]): void;
toJson(obj: any, pretty?: boolean): string;
uppercase(str: string): string;
version: {
full: string;
major: number;
minor: number;
dot: number;
codename: string;
};
}
///////////////////////////////////////////////////////////////////////////
// Module
// see http://docs.angularjs.org/api/angular.Module
///////////////////////////////////////////////////////////////////////////
interface IModule {
animation(name: string, animationFactory: Function): IModule;
animation(name: string, inlineAnnotadedFunction: any[]): IModule;
animation(object: Object): IModule;
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(configFn: Function): IModule;
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(inlineAnnotadedFunction: any[]): IModule;
constant(name: string, value: any): IModule;
constant(object: Object): IModule;
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(object: Object): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(object: Object): IModule;
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
filter(object: Object): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
provider(name: string, inlineAnnotadedConstructor: any[]): IModule;
provider(object: Object): IModule;
run(initializationFunction: Function): IModule;
run(inlineAnnotadedFunction: any[]): IModule;
service(name: string, serviceConstructor: Function): IModule;
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
service(object: Object): IModule;
value(name: string, value: any): IModule;
value(object: Object): IModule;
// Properties
name: string;
requires: string[];
}
///////////////////////////////////////////////////////////////////////////
// Attributes
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$observe(name: string, fn:(value?:any)=>any):void;
$attr: any;
}
///////////////////////////////////////////////////////////////////////////
// FormController
// see http://docs.angularjs.org/api/ng.directive:form.FormController
///////////////////////////////////////////////////////////////////////////
interface IFormController {
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
$error: any;
$setDirty(): void;
$setPristine(): void;
}
///////////////////////////////////////////////////////////////////////////
// NgModelController
// see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController
///////////////////////////////////////////////////////////////////////////
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: boolean): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$error: any;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
}
interface IModelParser {
(value: any): any;
}
interface IModelFormatter {
(value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// Scope
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
///////////////////////////////////////////////////////////////////////////
interface IScope {
$apply(): any;
$apply(exp: string): any;
$apply(exp: (scope: IScope) => any): any;
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
$evalAsync(expression: (scope: IScope) => any): void;
// Defaults to false by the implementation checking strategy
$new(isolate?: boolean): IScope;
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
$watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$parent: IScope;
$id: number;
// Hidden members
$$isolateBindings: any;
$$phase: any;
}
interface IAngularEvent {
targetScope: IScope;
currentScope: IScope;
name: string;
preventDefault: Function;
defaultPrevented: boolean;
// Available only events that were $emit-ted
stopPropagation?: Function;
}
///////////////////////////////////////////////////////////////////////////
// WindowService
// see http://docs.angularjs.org/api/ng.$window
///////////////////////////////////////////////////////////////////////////
interface IWindowService extends Window {}
///////////////////////////////////////////////////////////////////////////
// BrowserService
// TODO undocumented, so we need to get it from the source code
///////////////////////////////////////////////////////////////////////////
interface IBrowserService {}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see http://docs.angularjs.org/api/ng.$timeout
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(func: Function, delay?: number, invokeApply?: boolean): IPromise<any>;
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
// FilterService
// see http://docs.angularjs.org/api/ng.$filter
// see http://docs.angularjs.org/api/ng.$filterProvider
///////////////////////////////////////////////////////////////////////////
interface IFilterService {
(name: string): Function;
}
interface IFilterProvider extends IServiceProvider {
register(name: string, filterFactory: Function): IServiceProvider;
}
///////////////////////////////////////////////////////////////////////////
// LocaleService
// see http://docs.angularjs.org/api/ng.$locale
///////////////////////////////////////////////////////////////////////////
interface ILocaleService {
id: string;
// These are not documented
// Check angular's i18n files for exemples
NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor;
pluralCat: (num: any) => string;
}
interface ILocaleNumberFormatDescriptor {
DECIMAL_SEP: string;
GROUP_SEP: string;
PATTERNS: ILocaleNumberPatternDescriptor[];
CURRENCY_SYM: string;
}
interface ILocaleNumberPatternDescriptor {
minInt: number;
minFrac: number;
maxFrac: number;
posPre: string;
posSuf: string;
negPre: string;
negSuf: string;
gSize: number;
lgSize: number;
}
interface ILocaleDateTimeFormatDescriptor {
MONTH: string[];
SHORTMONTH: string[];
DAY: string[];
SHORTDAY: string[];
AMPMS: string[];
medium: string;
short: string;
fullDate: string;
longDate: string;
mediumDate: string;
shortDate: string;
mediumTime: string;
shortTime: string;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see http://docs.angularjs.org/api/ng.$log
///////////////////////////////////////////////////////////////////////////
interface ILogService {
debug: ILogCall;
error: ILogCall;
info: ILogCall;
log: ILogCall;
warn: ILogCall;
}
// We define this as separete interface so we can reopen it later for
// the ngMock module.
interface ILogCall {
(...args: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// ParseService
// see http://docs.angularjs.org/api/ng.$parse
///////////////////////////////////////////////////////////////////////////
interface IParseService {
(expression: string): ICompiledExpression;
}
interface ICompiledExpression {
(context: any, locals?: any): any;
// If value is not provided, undefined is gonna be used since the implementation
// does not check the parameter. Let's force a value for consistency. If consumer
// whants to undefine it, pass the undefined value explicitly.
assign(context: any, value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// LocationService
// see http://docs.angularjs.org/api/ng.$location
// see http://docs.angularjs.org/api/ng.$locationProvider
// see http://docs.angularjs.org/guide/dev_guide.services.$location
///////////////////////////////////////////////////////////////////////////
interface ILocationService {
absUrl(): string;
hash(): string;
hash(newHash: string): ILocationService;
host(): string;
path(): string;
path(newPath: string): ILocationService;
port(): number;
protocol(): string;
replace(): ILocationService;
search(): any;
search(parametersMap: any): ILocationService;
search(parameter: string, parameterValue: any): ILocationService;
url(): string;
url(url: string): ILocationService;
}
interface ILocationProvider extends IServiceProvider {
hashPrefix(): string;
hashPrefix(prefix: string): ILocationProvider;
html5Mode(): boolean;
// Documentation states that parameter is string, but
// implementation tests it as boolean, which makes more sense
// since this is a toggler
html5Mode(active: boolean): ILocationProvider;
}
///////////////////////////////////////////////////////////////////////////
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
interface IDocumentService extends Document {}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see http://docs.angularjs.org/api/ng.$exceptionHandler
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerService {
(exception: Error, cause?: string): void;
}
///////////////////////////////////////////////////////////////////////////
// RootElementService
// see http://docs.angularjs.org/api/ng.$rootElement
///////////////////////////////////////////////////////////////////////////
interface IRootElementService extends JQuery {}
///////////////////////////////////////////////////////////////////////////
// QService
// see http://docs.angularjs.org/api/ng.$q
///////////////////////////////////////////////////////////////////////////
interface IQService {
all(promises: IPromise<any>[]): IPromise<any[]>;
defer<T>(): IDeferred<T>;
reject(reason?: any): IPromise<void>;
when<T>(value: T): IPromise<T>;
}
interface IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
}
interface IDeferred<T> {
resolve(value?: T): void;
reject(reason?: any): void;
promise: IPromise<T>;
}
///////////////////////////////////////////////////////////////////////////
// AnchorScrollService
// see http://docs.angularjs.org/api/ng.$anchorScroll
///////////////////////////////////////////////////////////////////////////
interface IAnchorScrollService {
(): void;
}
interface IAnchorScrollProvider extends IServiceProvider {
disableAutoScrolling(): void;
}
///////////////////////////////////////////////////////////////////////////
// CacheFactoryService
// see http://docs.angularjs.org/api/ng.$cacheFactory
///////////////////////////////////////////////////////////////////////////
interface ICacheFactoryService {
// Lets not foce the optionsMap to have the capacity member. Even though
// it's the ONLY option considered by the implementation today, a consumer
// might find it useful to associate some other options to the cache object.
//(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
(cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
// Methods bellow are not documented
info(): any;
get (cacheId: string): ICacheObject;
}
interface ICacheObject {
info(): {
id: string;
size: number;
// Not garanteed to have, since it's a non-mandatory option
//capacity: number;
};
put(key: string, value?: any): void;
get (key: string): any;
remove(key: string): void;
removeAll(): void;
destroy(): void;
}
///////////////////////////////////////////////////////////////////////////
// CompileService
// see http://docs.angularjs.org/api/ng.$compile
// see http://docs.angularjs.org/api/ng.$compileProvider
///////////////////////////////////////////////////////////////////////////
interface ICompileService {
(element: string, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: Element, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: JQuery, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
}
interface ICompileProvider extends IServiceProvider {
directive(name: string, directiveFactory: Function): ICompileProvider;
// Undocumented, but it is there...
directive(directivesMap: any): ICompileProvider;
}
interface ITemplateLinkingFunction {
// Let's hint but not force cloneAttachFn's signature
(scope: IScope, cloneAttachFn?: (clonedElement?: JQuery, scope?: IScope) => any): JQuery;
}
///////////////////////////////////////////////////////////////////////////
// ControllerService
// see http://docs.angularjs.org/api/ng.$controller
// see http://docs.angularjs.org/api/ng.$controllerProvider
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
(controllerConstructor: Function, locals?: any): any;
(controllerName: string, locals?: any): any;
}
interface IControllerProvider extends IServiceProvider {
register(name: string, controllerConstructor: Function): void;
register(name: string, dependencyAnnotadedConstructor: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// HttpService
// see http://docs.angularjs.org/api/ng.$http
///////////////////////////////////////////////////////////////////////////
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise<any>;
get (url: string, RequestConfig?: any): IHttpPromise<any>;
delete (url: string, RequestConfig?: any): IHttpPromise<any>;
head(url: string, RequestConfig?: any): IHttpPromise<any>;
jsonp(url: string, RequestConfig?: any): IHttpPromise<any>;
post(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
put(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
defaults: IRequestConfig;
// For debugging, BUT it is documented as public, so...
pendingRequests: any[];
}
// This is just for hinting.
// Some opetions might not be available depending on the request.
// see http://docs.angularjs.org/api/ng.$http#Usage for options explanations
interface IRequestConfig {
method: string;
url: string;
params?: any;
// XXX it has it's own structure... perhaps we should define it in the future
headers?: any;
cache?: any;
timeout?: number;
withCredentials?: boolean;
// These accept multiple types, so let's defile them as any
data?: any;
transformRequest?: any;
transformResponse?: any;
}
interface IHttpPromiseCallback<T> {
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void;
}
interface IHttpPromiseCallbackArg<T> {
data?: T;
status?: number;
headers?: (headerName: string) => string;
config?: IRequestConfig;
}
interface IHttpPromise<T> extends IPromise<T> {
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
error(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
}
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
interceptors: any[];
responseInterceptors: any[];
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see http://docs.angularjs.org/api/ng.$httpBackend
// You should never need to use this service directly.
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
// XXX Perhaps define callback signature in the future
(method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void;
}
///////////////////////////////////////////////////////////////////////////
// InterpolateService
// see http://docs.angularjs.org/api/ng.$interpolate
// see http://docs.angularjs.org/api/ng.$interpolateProvider
///////////////////////////////////////////////////////////////////////////
interface IInterpolateService {
(text: string, mustHaveExpression?: boolean): IInterpolationFunction;
endSymbol(): string;
startSymbol(): string;
}
interface IInterpolationFunction {
(context: any): string;
}
interface IInterpolateProvider extends IServiceProvider {
startSymbol(): string;
startSymbol(value: string): IInterpolateProvider;
endSymbol(): string;
endSymbol(value: string): IInterpolateProvider;
}
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ng.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// TemplateCacheService
// see http://docs.angularjs.org/api/ng.$templateCache
///////////////////////////////////////////////////////////////////////////
interface ITemplateCacheService extends ICacheObject {}
///////////////////////////////////////////////////////////////////////////
// RootScopeService
// see http://docs.angularjs.org/api/ng.$rootScope
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
when(path: string, route: IRoute): IRouteProvider;
}
///////////////////////////////////////////////////////////////////////////
// Directive
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirective{
priority?: number;
template?: any;
templateUrl?: any;
replace?: boolean;
transclude?: any;
restrict?: string;
scope?: any;
link?: Function;
compile?: Function;
controller?: any;
}
///////////////////////////////////////////////////////////////////////////
// angular.element
// when calling angular.element, angular returns a jQuery object,
// augmented with additional methods like e.g. scope.
// see: http://docs.angularjs.org/api/angular.element
///////////////////////////////////////////////////////////////////////////
interface IAugmentedJQueryStatic extends JQueryStatic {
(selector: string, context?: any): IAugmentedJQuery;
(element: Element): IAugmentedJQuery;
(object: {}): IAugmentedJQuery;
(elementArray: Element[]): IAugmentedJQuery;
(object: JQuery): IAugmentedJQuery;
(func: Function): IAugmentedJQuery;
(array: any[]): IAugmentedJQuery;
(): IAugmentedJQuery;
}
interface IAugmentedJQuery extends JQuery {
// TODO: events, how to define?
//$destroy
find(selector: string): IAugmentedJQuery;
find(element: any): IAugmentedJQuery;
find(obj: JQuery): IAugmentedJQuery;
controller(name: string): any;
injector(): any;
scope(): IScope;
inheritedData(key: string, value: any): JQuery;
inheritedData(obj: { [key: string]: any; }): JQuery;
inheritedData(key?: string): any;
}
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export module auto {
///////////////////////////////////////////////////////////////////////
// InjectorService
// see http://docs.angularjs.org/api/AUTO.$injector
///////////////////////////////////////////////////////////////////////
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotadedFunction: any[]): string[];
get (name: string): any;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(func: Function, context?: any, locals?: any): any;
}
///////////////////////////////////////////////////////////////////////
// ProvideService
// see http://docs.angularjs.org/api/AUTO.$provide
///////////////////////////////////////////////////////////////////////
interface IProvideService {
// Documentation says it returns the registered instance, but actual
// implementation does not return anything.
// constant(name: string, value: any): any;
constant(name: string, value: any): void;
decorator(name: string, decorator: Function): void;
decorator(name: string, decoratorInline: any[]): void;
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;
service(name: string, constructor: Function): ng.IServiceProvider;
value(name: string, value: any): ng.IServiceProvider;
}
}
}

30
angularjs/angular-cookies-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,30 @@
/// Type definitions for Angular JS 1.0 (ngCookies module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngCookies module (angular-cookies.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.cookies {
///////////////////////////////////////////////////////////////////////////
// CookieService
// see http://docs.angularjs.org/api/ngCookies.$cookies
///////////////////////////////////////////////////////////////////////////
interface ICookiesService {}
///////////////////////////////////////////////////////////////////////////
// CookieStoreService
// see http://docs.angularjs.org/api/ngCookies.$cookieStore
///////////////////////////////////////////////////////////////////////////
interface ICookieStoreService {
get(key: string): any;
put(key: string, value: any): void;
remove(key: string): void;
}
}

View File

@@ -1,4 +1,4 @@
/// Type definitions for Angular JS 1.0 (ngCookies module)
/// Type definitions for Angular JS 1.2 (ngCookies module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

150
angularjs/angular-mocks-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,150 @@
// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
declare var module: (...modules: any[]) => any;
declare var inject: (...fns: Function[]) => any;
///////////////////////////////////////////////////////////////////////////////
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
mock: IMockStatic;
}
interface IMockStatic {
// see http://docs.angularjs.org/api/angular.mock.debug
debug(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;
// see http://docs.angularjs.org/api/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see http://docs.angularjs.org/api/ngMock.$exceptionHandler
// see http://docs.angularjs.org/api/ngMock.$exceptionHandlerProvider
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerProvider extends IServiceProvider {
mode(mode: string): void;
}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see http://docs.angularjs.org/api/ngMock.$timeout
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(): void;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see http://docs.angularjs.org/api/ngMock.$log
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ILogService {
assertEmpty(): void;
reset(): void;
}
interface LogCall {
logs: string[];
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see http://docs.angularjs.org/api/ngMock.$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
flush(count?: number): void;
resetExpectations(): void;
verifyNoOutstandingExpectation(): void;
verifyNoOutstandingRequest(): void;
expect(method: string, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectDELETE(url: string, headers?: any): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
expectGET(url: string, headers?: any): mock.IRequestHandler;
expectGET(url: RegExp, headers?: any): mock.IRequestHandler;
expectHEAD(url: string, headers?: any): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expectJSONP(url: string): mock.IRequestHandler;
expectJSONP(url: RegExp): mock.IRequestHandler;
expectPATCH(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
whenDELETE(url: string, headers?: any): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
whenGET(url: string, headers?: any): mock.IRequestHandler;
whenGET(url: RegExp, headers?: any): mock.IRequestHandler;
whenHEAD(url: string, headers?: any): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
whenJSONP(url: string): mock.IRequestHandler;
whenJSONP(url: RegExp): mock.IRequestHandler;
whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
respond(func: Function): void;
respond(status: number, data?: any, headers?: any): void;
respond(data: any, headers?: any): void;
// Available wehn ngMockE2E is loaded
passThrough(): void;
}
}
}

View File

@@ -0,0 +1,288 @@
/// <reference path="angular-mocks.d.ts" />
///////////////////////////////////////
// IAngularStatic
///////////////////////////////////////
var angular: ng.IAngularStatic;
var mock: ng.IMockStatic;
mock = angular.mock;
///////////////////////////////////////
// IMockStatic
///////////////////////////////////////
var date: Date;
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; } });
date = mock.TzDate(-7, '2013-1-1T15:00:00Z');
date = mock.TzDate(-8, 12345678);
///////////////////////////////////////
// IExceptionHandlerProvider
///////////////////////////////////////
var exceptionHandlerProvider: ng.IExceptionHandlerProvider;
exceptionHandlerProvider.mode('log');
///////////////////////////////////////
// IExceptionHandlerProvider
///////////////////////////////////////
var timeoutService: ng.ITimeoutService;
timeoutService.flush();
timeoutService.flush(1234);
timeoutService.flushNext();
timeoutService.flushNext(1234);
timeoutService.verifyNoPendingTasks();
///////////////////////////////////////
// ILogService, ILogCall
///////////////////////////////////////
var logService: ng.ILogService;
var logCall: ng.ILogCall;
var logs: string[];
logService.assertEmpty();
logService.reset();
logCall = logService.debug;
logCall = logService.error;
logCall = logService.info;
logCall = logService.log;
logCall = logService.warn;
logs = logCall.logs;
///////////////////////////////////////
// IHttpBackendService
///////////////////////////////////////
var httpBackendService: ng.IHttpBackendService;
var requestHandler: ng.mock.IRequestHandler;
httpBackendService.flush();
httpBackendService.flush(1234);
httpBackendService.resetExpectations();
httpBackendService.verifyNoOutstandingExpectation();
httpBackendService.verifyNoOutstandingRequest();
requestHandler = httpBackendService.expect('GET', 'http://test.local');
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data');
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/);
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/);
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expectDELETE('http://test.local');
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectGET('http://test.local');
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectHEAD('http://test.local');
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectJSONP('http://test.local');
requestHandler = httpBackendService.expectJSONP(/test.local/);
requestHandler = httpBackendService.expectPATCH('http://test.local');
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data');
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/);
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/);
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local');
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data');
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/);
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/);
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local');
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data');
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/);
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/);
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local');
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data');
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/);
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/);
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.whenDELETE('http://test.local');
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenGET('http://test.local');
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenHEAD('http://test.local');
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenJSONP('http://test.local');
requestHandler = httpBackendService.whenJSONP(/test.local/);
requestHandler = httpBackendService.whenPATCH('http://test.local');
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data');
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/);
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/);
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local');
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data');
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/);
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/);
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local');
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data');
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/);
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/);
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
///////////////////////////////////////
// IRequestHandler
///////////////////////////////////////
requestHandler.passThrough();
requestHandler.respond(function () { });
requestHandler.respond({ key: 'value' });
requestHandler.respond({ key: 'value' }, { header: 'value' });
requestHandler.respond(404);
requestHandler.respond(404, { key: 'value' });
requestHandler.respond(404, { key: 'value' }, { header: 'value' });

View File

@@ -0,0 +1 @@
""

View File

@@ -1,9 +1,8 @@
// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module)
// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
@@ -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;
// see http://docs.angularjs.org/api/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
@@ -55,7 +56,9 @@ declare module ng {
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(): void;
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
///////////////////////////////////////////////////////////////////////////
@@ -68,7 +71,7 @@ declare module ng {
reset(): void;
}
interface LogCall {
interface ILogCall {
logs: string[];
}
@@ -82,62 +85,127 @@ declare module ng {
verifyNoOutstandingExpectation(): void;
verifyNoOutstandingRequest(): void;
expect(method: string, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectDELETE(url: string, headers?: any): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
expectGET(url: string, headers?: any): mock.IRequestHandler;
expectGET(url: RegExp, headers?: any): mock.IRequestHandler;
expectHEAD(url: string, headers?: any): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expect(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
expectDELETE(url: string, headers?: Object): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
expectGET(url: string, headers?: Object): mock.IRequestHandler;
expectGET(url: RegExp, headers?: Object): mock.IRequestHandler;
expectHEAD(url: string, headers?: Object): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
expectJSONP(url: string): mock.IRequestHandler;
expectJSONP(url: RegExp): mock.IRequestHandler;
expectPATCH(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
whenDELETE(url: string, headers?: any): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
whenGET(url: string, headers?: any): mock.IRequestHandler;
whenGET(url: RegExp, headers?: any): mock.IRequestHandler;
whenHEAD(url: string, headers?: any): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expectPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenDELETE(url: string, headers?: Object): mock.IRequestHandler;
whenDELETE(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenGET(url: string, headers?: Object): mock.IRequestHandler;
whenGET(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenGET(url: RegExp, headers?: Object): mock.IRequestHandler;
whenGET(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenHEAD(url: string, headers?: Object): mock.IRequestHandler;
whenHEAD(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenJSONP(url: string): mock.IRequestHandler;
whenJSONP(url: RegExp): mock.IRequestHandler;
whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
}
whenPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
respond(func: Function): void;
respond(func: Function): void;
respond(status: number, data?: any, headers?: any): void;
respond(data: any, headers?: any): void;
@@ -145,6 +213,6 @@ declare module ng {
passThrough(): void;
}
}
}
}

View File

@@ -0,0 +1 @@
""

82
angularjs/angular-resource-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,82 @@
// Type definitions for Angular JS 1.0 (ngResource module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngResource module (angular-resource.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.resource {
///////////////////////////////////////////////////////////////////////////
// ResourceService
// see http://docs.angularjs.org/api/ngResource.$resource
// Most part of the following definitions were achieved by analyzing the
// actual implementation, since the documentation doesn't seem to cover
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
}
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
method: string;
isArray?: boolean;
params?: any;
headers?: any;
}
// Baseclass for everyresource with default actions.
// If you define your new actions for the resource, you will need
// to extend this interface and typecast the ResourceClass to it.
interface IResourceClass {
get: IActionCall;
save: IActionCall;
query: IActionCall;
remove: IActionCall;
delete: IActionCall;
}
// In case of passing the first argument as anything but a function,
// it's gonna be considered data if the action method is POST, PUT or
// PATCH (in other words, methods with body). Otherwise, it's going
// to be considered as parameters to the request.
interface IActionCall {
(): IResource;
(dataOrParams: any): IResource;
(dataOrParams: any, success: Function): IResource;
(success: Function, error?: Function): IResource;
(params: any, data: any, success?: Function, error?: Function): IResource;
}
interface IResource {
$save: IActionCall;
$remove: IActionCall;
$delete: IActionCall;
// No documented, but they are there, just as any custom action will be
$query: IActionCall;
$get: IActionCall;
}
/** when creating a resource factory via IModule.factory */
interface IResourceServiceFactoryFunction {
($resource: ng.resource.IResourceService): ng.resource.IResourceClass;
}
}
/** extensions to base ng based on using angular-resource */
declare module ng {
interface IModule {
/** creating a resource service factory */
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule;
}
}

View File

@@ -0,0 +1,74 @@
/// <reference path="angular-resource.d.ts" />
///////////////////////////////////////
// IActionDescriptor
///////////////////////////////////////
var actionDescriptor: ng.resource.IActionDescriptor;
actionDescriptor.headers = { header: 'value' };
actionDescriptor.isArray = true;
actionDescriptor.method = 'method action';
actionDescriptor.params = { key: 'value' };
///////////////////////////////////////
// IResourceClass
///////////////////////////////////////
var resourceClass: ng.resource.IResourceClass;
var resource: ng.resource.IResource;
resource = resourceClass.delete();
resource = resourceClass.delete({ key: 'value' });
resource = resourceClass.delete({ key: 'value' }, function () { });
resource = resourceClass.delete(function () { });
resource = resourceClass.delete(function () { }, function () { });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.get();
resource = resourceClass.get({ key: 'value' });
resource = resourceClass.get({ key: 'value' }, function () { });
resource = resourceClass.get(function () { });
resource = resourceClass.get(function () { }, function () { });
resource = resourceClass.get({ key: 'value' }, { key: 'value' });
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.query();
resource = resourceClass.query({ key: 'value' });
resource = resourceClass.query({ key: 'value' }, function () { });
resource = resourceClass.query(function () { });
resource = resourceClass.query(function () { }, function () { });
resource = resourceClass.query({ key: 'value' }, { key: 'value' });
resource = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.remove();
resource = resourceClass.remove({ key: 'value' });
resource = resourceClass.remove({ key: 'value' }, function () { });
resource = resourceClass.remove(function () { });
resource = resourceClass.remove(function () { }, function () { });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.save();
resource = resourceClass.save({ key: 'value' });
resource = resourceClass.save({ key: 'value' }, function () { });
resource = resourceClass.save(function () { });
resource = resourceClass.save(function () { }, function () { });
resource = resourceClass.save({ key: 'value' }, { key: 'value' });
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { });
///////////////////////////////////////
// IModule
///////////////////////////////////////
var mod: ng.IModule;
var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction;
var resourceService: ng.resource.IResourceService;
resourceServiceFactoryFunction = function (resourceService) { return resourceClass };
mod = mod.factory('factory name', resourceServiceFactoryFunction);

View File

@@ -1,4 +1,4 @@
// Type definitions for Angular JS 1.0 (ngResource module)
// Type definitions for Angular JS 1.2 (ngResource module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -19,10 +19,10 @@ declare module ng.resource {
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
}
// Just a reference to facilitate describing new actions

View File

@@ -0,0 +1,14 @@
/// <reference path="angular-route.d.ts" />
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2013 Jonathan Park @ Daptiv Solutions Inc
* License: MIT
*/
declare var $routeProvider: ng.route.IRouteProvider;
$routeProvider
.when('/projects/:projectId/dashboard',{
controller: ''
})
.otherwise({redirectTo: '/'});

64
angularjs/angular-route.d.ts vendored Normal file
View File

@@ -0,0 +1,64 @@
// Type definitions for Angular JS 1.2 (ngRoute module)
// Project: http://angularjs.org
// Definitions by: Jonathan Park
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngRoute module (angular-route.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.route {
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ngRoute.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ngRoute.$route
// see http://docs.angularjs.org/api/ngRoute.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ngRoute.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
controllerAs?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
/**
* This is a description
*
*/
when(path: string, route: IRoute): IRouteProvider;
}
}

22
angularjs/angular-sanitize-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
// Type definitions for Angular JS 1.0 (ngSanitize module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngSanitize module (angular-sanitize.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.sanitize {
///////////////////////////////////////////////////////////////////////////
// SanitizeService
// see http://docs.angularjs.org/api/ngSanitize.$sanitize
///////////////////////////////////////////////////////////////////////////
interface ISanitizeService {
(html: string): string;
}
}

View File

@@ -1,4 +1,4 @@
// Type definitions for Angular JS 1.0 (ngSanitize module)
// Type definitions for Angular JS 1.2 (ngSanitize module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

155
angularjs/angular-scenario-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,155 @@
// Type definitions for Angular Scenario Testing
// Project: [http://angularjs.org]
// Definitions by: [RomanoLindano]
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angularScenario {
export interface AngularModel {
scenario: any;
}
export interface RunFunction {
(functionToRun: any): any;
}
export interface RunFunctionWithDescription {
(description: string, functionToRun: any): any;
}
export interface PauseFunction {
(): any;
}
export interface SleepFunction {
(seconds: number): any;
}
export interface Future {
}
export interface testWindow {
href(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface testLocation {
url(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface Browser {
navigateTo(url: string): void;
navigateTo(urlDescription: string, urlFunction: () => string): void;
reload(): void;
window(): testWindow;
location(): testLocation;
}
export interface Matchers {
toEqual(value: any): void;
toBe(value: any): void;
toBeDefined(): void;
toBeTruthy(): void;
toBeFalsy(): void;
toMatch(regularExpression: any): void;
toBeNull(): void;
toContain(value: any): void;
toBeLessThan(value: any): void;
toBeGreaterThan(value: any): void;
}
export interface CustomMatchers extends Matchers{
}
export interface Expect extends CustomMatchers {
not(): angularScenario.CustomMatchers;
}
export interface UsingFunction {
(selector: string, selectorDescription?: string): void;
}
export interface BindingFunction {
(bracketBindingExpression: string): Future;
}
export interface Input {
enter(value: any);
check(): any;
select(radioButtonValue: any): any;
val(): Future;
}
export interface Repeater {
count(): Future;
row(index: number): Future;
column(ngBindingExpression: string): Future;
}
export interface Select {
option(value: any): any;
option(...listOfValues: any[]): any;
}
export interface Element {
count(): Future;
click(): any;
query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any;
val(): Future;
text(): Future;
html(): Future;
height(): Future;
innerHeight(): Future;
outerHeight(): Future;
width(): Future;
innerWidth(): Future;
outerWidth(): Future;
position(): Future;
scrollLeft(): Future;
scrollTop(): Future;
offset(): Future;
val(value: any): void;
text(value: any): void;
html(value: any): void;
height(value: any): void;
innerHeight(value: any): void;
outerHeight(value: any): void;
width(value: any): void;
innerWidth(value: any): void;
outerWidth(value: any): void;
position(value: any): void;
scrollLeft(value: any): void;
scrollTop(value: any): void;
offset(value: any): void;
attr(key: any): Future;
prop(key: any): Future;
css(key: any): Future;
attr(key: any, value: any): void;
prop(key: any, value: any): void;
css(key: any, value: any): void;
}
}
declare var describe: angularScenario.RunFunctionWithDescription;
declare var xdescribe: angularScenario.RunFunctionWithDescription;
declare var beforeEach: angularScenario.RunFunction;
declare var afterEach: angularScenario.RunFunction;
declare var it: angularScenario.RunFunctionWithDescription;
declare var xit: angularScenario.RunFunctionWithDescription;
declare var pause: angularScenario.PauseFunction;
declare var sleep: angularScenario.SleepFunction;
declare function browser(): angularScenario.Browser;
declare function expect(expectation: angularScenario.Future): angularScenario.Expect;
declare var using: angularScenario.UsingFunction;
declare var binding: angularScenario.BindingFunction;
declare function input(ngModelBinding: string): angularScenario.Input;
declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater;
declare function select(ngModelBinding: string): angularScenario.Select;
declare function element(selector: string, elementDescription?: string): angularScenario.Element;
declare var angular: angularScenario.AngularModel;

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -182,6 +182,7 @@ mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
// Promise signature tests
var foo: ng.IPromise<number>;
foo.then((x) => {
@@ -217,3 +218,17 @@ var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();
function test_IAttributes(attributes: ng.IAttributes){
return attributes;
}
test_IAttributes({
$addClass: function (classVal){},
$removeClass: function(classVal){},
$set: function(key, value){},
$observe: function(name, fn){
return fn;
},
$attr: {}
});

View File

@@ -0,0 +1 @@
""

125
angularjs/angular.d.ts vendored
View File

@@ -81,11 +81,11 @@ declare module ng {
animation(name: string, animationFactory: Function): IModule;
animation(name: string, inlineAnnotadedFunction: any[]): IModule;
animation(object: Object): IModule;
/** configure existing services.
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(configFn: Function): IModule;
/** configure existing services.
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(inlineAnnotadedFunction: any[]): IModule;
@@ -94,9 +94,9 @@ declare module ng {
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(object: Object): IModule;
directive(object: Object): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(object: Object): IModule;
@@ -124,9 +124,33 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$observe(name: string, fn:(value?:any)=>any):void;
$attr: any;
// this is necessary to be able to access the scoped attributes. it's not very elegant
// because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way
// this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656
[name: string]: any;
// Adds the CSS class value specified by the classVal parameter to the
// element. If animations are enabled then an animation will be triggered
// for the class addition.
$addClass(classVal: string): void;
// Removes the CSS class value specified by the classVal parameter from the
// element. If animations are enabled then an animation will be triggered for
// the class removal.
$removeClass(classVal: string): void;
// Set DOM element attribute value.
$set(key: string, value: any): void;
// Observes an interpolated attribute.
// The observer function will be invoked once during the next $digest
// following compilation. The observer is then invoked whenever the
// interpolated value changes.
$observe(name: string, fn:(value?:any)=>any): Function;
// A map of DOM element attribute names to the normalized name. This is needed
// to do reverse lookup from normalized name back to actual name.
$attr: Object;
}
///////////////////////////////////////////////////////////////////////////
@@ -139,6 +163,8 @@ declare module ng {
$valid: boolean;
$invalid: boolean;
$error: any;
$addControl(control: ng.INgModelController): void;
$removeControl(control: ng.INgModelController): void;
$setDirty(): void;
$setPristine(): void;
}
@@ -150,14 +176,11 @@ declare module ng {
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: boolean): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
// Documentation states viewValue and modelValue to be a string but other
// types do work and it's common to use them.
$setViewValue(value: any): void;
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
@@ -192,8 +215,8 @@ declare module ng {
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
$eval(expression: string, args?: Object): any;
$eval(expression: (scope: IScope) => any, args?: Object): any;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
@@ -215,7 +238,7 @@ declare module ng {
$parent: IScope;
$id: number;
// Hidden members
$$isolateBindings: any;
$$phase: any;
@@ -605,12 +628,6 @@ declare module ng {
endSymbol(value: string): IInterpolateProvider;
}
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ng.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// TemplateCacheService
// see http://docs.angularjs.org/api/ng.$templateCache
@@ -623,46 +640,6 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
when(path: string, route: IRoute): IRouteProvider;
}
///////////////////////////////////////////////////////////////////////////
// Directive
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
@@ -670,15 +647,29 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IDirective{
compile?:
(templateElement: any,
templateAttributes: IAttributes,
transclude: (scope: IScope, cloneLinkingFn: Function) => void
) => any;
controller?: any;
controllerAs?: string;
link?:
(scope: IScope,
instanceElement: any,
instanceAttributes: IAttributes,
controller: any
) => void;
name?: string;
priority?: number;
template?: string;
templateUrl?: string;
replace?: boolean;
transclude?: any;
require?: any;
restrict?: string;
scope?: any;
link?: Function;
compile?: Function;
template?: any;
templateUrl?: any;
terminal?: boolean;
transclude?: any;
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,630 @@
/// <reference path="appframework.d.ts" />
af(($: appFrameworkStatic) => {});
((): appFrameworkCollection => {
return $('div'); //=> all DIV elements on the page
})();
((): appFrameworkCollection => {
return $("<p />", {}); // context
})();
((): appFrameworkCollection => {
return $($('')); // appFrameworkCollection
})();
((): appFrameworkCollection => {
return $(document.createElement('div')); // HTMLElement
})();
((): appFrameworkCollection => {
return $({}); // Object(any)
})();
((): boolean => {
return $.is$($(''));
})();
((): boolean[] => {
return $.map([], (item: any, index: number): boolean => {
return true;
});
})();
$.each([], (index: number, item: any) => { });
$.each({}, (key: string, value: any) => { });
((): Object => {
return $.extend({ one: 'patridge' }, { two: 'turtle doves' });
})();
((): boolean => {
return $.isArray({});
})();
((): boolean => {
return $.isFunction({});
})();
((): boolean => {
return $.isObject({});
})();
((): Object => {
return $.fn;
})();
((): Object => {
return $.ajaxSettings;
})();
$.jsonP({});
((): XMLHttpRequest => {
return $.ajax({});
})();
((): XMLHttpRequest => {
return $.get('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): string => {
return $.param({});
})();
((): string => {
return $.param({}, '');
})();
((): Object => {
return $.parseJSON('');
})();
((): Object => {
return $.parseXML('');
})();
((): string => {
return $.uuid();
})();
((): Object => {
return $.getCssMatrix(document.createElement('div'));
})();
((): Object => {
return $.getCssMatrix($(''));
})();
((): appFrameworkCollection => {
return $.create('');
})();
((): appFrameworkCollection => {
return $.create('', {});
})();
((): appFrameworkCollection => {
return $.query('');
})();
((): appFrameworkCollection => {
return $.query('', {});
})();
((): Object => {
return $.Event('', {});
})();
((): void => {
return $.bind({}, '', () => {});
})();
((): void => {
return $.trigger({}, '');
})();
((): void => {
return $.trigger({}, '', []);
})();
((): void => {
return $.unbind({}, '', () => {});
})();
((): void => {
return $.proxy(() => {}, {});
})();
((): void => {
return $.cleanUpContent(document.createElement('div'), false, false);
})();
((): void => {
return $.asap(() => {});
})();
((): void => {
return $.asap(() => {}, {});
})();
((): void => {
return $.asap(() => {}, {}, []);
})();
((): void => {
return $.parseJS('');
})();
((): void => {
return $.parseJS(document.createElement('div'));
})();
$.os.webkit;
$.os.android;
$.os.androidICS;
$.os.ipad;
$.os.iphone;
$.os.ios7;
$.os.webos;
$.os.touchpad;
$.os.ios;
$.os.playbook;
$.os.blackberry;
$.os.blackberry10;
$.os.chrome;
$.os.opera;
$.os.fennec;
$.os.ie;
$.os.ieTouch;
$.os.supportsTouch;
$.feat.nativeTouchScroll;
$.feat.cssPrefix;
$.feat.cssTransformStart;
$.feat.cssTransformEnd;
((): appFrameworkCollection => {
return $('').reduce((hoge) => { return hoge; });
})();
((): number => {
return $('').push($(''));
})();
((): number => {
return $('').indexOf($(''));
})();
((): appFrameworkCollection[] => {
return $('').concat($(''));
})();
((): appFrameworkCollection[] => {
return $('').slice(0);
})();
((): number => {
return $('').length;
})();
((): appFrameworkCollection => {
return $('').map(() => {});
})();
((): appFrameworkCollection => {
return $('').each(() => {});
})();
((): void => {
return $('').forEach(() => {});
})();
((): appFrameworkStatic => {
return $('').ready(() => {});
})();
((): appFrameworkCollection => {
return $('').find('');
})();
((): string => {
return $('').html();
})();
((): appFrameworkCollection => {
return $('').html('');
})();
((): appFrameworkCollection => {
return $('').html('', false);
})();
((): string => {
return $('').text();
})();
((): appFrameworkCollection => {
return $('').text('');
})();
(() => {
return $('').css('');
})();
((): appFrameworkCollection => {
return $('').css('', '');
})();
((): appFrameworkCollection => {
return $('').css({});
})();
((): appFrameworkCollection => {
return $('').vendorCss('');
})();
((): appFrameworkCollection => {
return $('').computedStyle('');
})();
((): appFrameworkCollection => {
return $('').empty();
})();
((): appFrameworkCollection => {
return $('').hide();
})();
((): appFrameworkCollection => {
return $('').show();
})();
((): appFrameworkCollection => {
return $('').toggle();
})();
((): string => {
return $('').val();
})();
((): appFrameworkCollection => {
return $('').val('');
})();
((): string => {
return $('').attr('');
})();
((): appFrameworkCollection => {
return $('').attr({});
})();
((): appFrameworkCollection => {
return $('').attr('', '');
})();
((): appFrameworkCollection => {
return $('').attr('', {});
})();
((): appFrameworkCollection => {
return $('').removeAttr('');
})();
((): string => {
return $('').prop('');
})();
((): appFrameworkCollection => {
return $('').prop({});
})();
((): appFrameworkCollection => {
return $('').prop('', '');
})();
((): appFrameworkCollection => {
return $('').prop('', {});
})();
((): appFrameworkCollection => {
return $('').removeProp('');
})();
((): appFrameworkCollection => {
return $('').remove();
})();
((): appFrameworkCollection => {
return $('').remove('');
})();
((): appFrameworkCollection => {
return $('').remove(document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').remove($(''));
})();
((): appFrameworkCollection => {
return $('').addClass('');
})();
((): appFrameworkCollection => {
return $('').removeClass('');
})();
((): appFrameworkCollection => {
return $('').toggleClass('');
})();
((): appFrameworkCollection => {
return $('').replaceClass('', '');
})();
((): boolean => {
return $('').hasClass('', document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').append('');
})();
((): appFrameworkCollection => {
return $('').appendTo('');
})();
((): appFrameworkCollection => {
return $('').prependTo('');
})();
((): appFrameworkCollection => {
return $('').prepend('');
})();
((): appFrameworkCollection => {
return $('').insertBefore('');
})();
((): void => {
return $('').insertAfter('');
})();
((): HTMLElement[] => {
return $('').get();
})();
((): HTMLElement => {
return $('').get(0);
})();
((): {
left: number;
top: number;
right: number;
bottom: number;
width: number;
height: number;
} => {
return $('').offset();
})();
((): string => {
return $('').height();
})();
((): string => {
return $('').width();
})();
((): appFrameworkCollection => {
return $('').parent();
})();
((): appFrameworkCollection => {
return $('').parents();
})();
((): appFrameworkCollection => {
return $('').children();
})();
((): appFrameworkCollection => {
return $('').siblings();
})();
((): appFrameworkCollection => {
return $('').closest();
})();
((): appFrameworkCollection => {
return $('').filter();
})();
((): appFrameworkCollection => {
return $('').not();
})();
((): any => {
return $('').data('');
})();
((): appFrameworkCollection => {
return $('').data('', '');
})();
((): appFrameworkCollection => {
return $('').data('', {});
})();
((): appFrameworkCollection => {
return $('').end();
})();
((): appFrameworkCollection => {
return $('').clone();
})();
((): number => {
return $('').size();
})();
((): string => {
return $('').serialize();
})();
((): appFrameworkCollection => {
return $('').eq(0);
})();
((): number => {
return $('').index();
})();
((): number => {
return $('').index('');
})();
((): number => {
return $('').is('');
})();
((): appFrameworkCollection => {
return $('').bind({});
})();
((): appFrameworkCollection => {
return $('').bind('', () => {});
})();
((): appFrameworkCollection => {
return $('').unbind({});
})();
((): appFrameworkCollection => {
return $('').unbind();
})();
((): appFrameworkCollection => {
return $('').unbind('', () => {});
})();
((): appFrameworkCollection => {
return $('').one({});
})();
((): appFrameworkCollection => {
return $('').one('', () => {});
})();
((): appFrameworkCollection => {
return $('').delegate('', {});
})();
((): appFrameworkCollection => {
return $('').delegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').on({});
})();
((): appFrameworkCollection => {
return $('').on('', () => {});
})();
((): appFrameworkCollection => {
return $('').on('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').off({});
})();
((): appFrameworkCollection => {
return $('').off('', () => {});
})();
((): appFrameworkCollection => {
return $('').off('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').trigger('');
})();
((): appFrameworkCollection => {
return $('').trigger({});
})();
((): appFrameworkCollection => {
return $('').click();
})();
((): appFrameworkCollection => {
return $('').click(() => {});
})();
((): appFrameworkCollection => {
return $('').keydown();
})();
((): appFrameworkCollection => {
return $('').keydown(() => {});
})();
((): appFrameworkCollection => {
return $('').keyup();
})();
((): appFrameworkCollection => {
return $('').keyup(() => {});
})();
((): appFrameworkCollection => {
return $('').keypress();
})();
((): appFrameworkCollection => {
return $('').keypress(() => {});
})();
((): appFrameworkCollection => {
return $('').submit();
})();
((): appFrameworkCollection => {
return $('').submit(() => {});
})();
((): appFrameworkCollection => {
return $('').load();
})();
((): appFrameworkCollection => {
return $('').load(() => {});
})();
((): appFrameworkCollection => {
return $('').resize();
})();
((): appFrameworkCollection => {
return $('').resize(() => {});
})();
((): appFrameworkCollection => {
return $('').change();
})();
((): appFrameworkCollection => {
return $('').change(() => {});
})();
((): appFrameworkCollection => {
return $('').select();
})();
((): appFrameworkCollection => {
return $('').select(() => {});
})();
((): appFrameworkCollection => {
return $('').error();
})();
((): appFrameworkCollection => {
return $('').error(() => {});
})();
((): appFrameworkCollection => {
return $('').focus();
})();
((): appFrameworkCollection => {
return $('').focus(() => {});
})();
((): appFrameworkCollection => {
return $('').blur();
})();
((): appFrameworkCollection => {
return $('').blur(() => {});
})();

1318
appframework/appframework.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

4
async/async.d.ts vendored
View File

@@ -13,7 +13,7 @@ interface AsyncWorker<T> { (task: T, callback: Function): void; }
interface AsyncQueue<T> {
length(): number;
concurrency: number;
push(task: T, callback: AsyncMultipleResultsCallback<T>): void;
push(task: T, callback?: AsyncMultipleResultsCallback<T>): void;
saturated: AsyncMultipleResultsCallback<T>;
empty: AsyncMultipleResultsCallback<T>;
drain: AsyncMultipleResultsCallback<T>;
@@ -79,4 +79,4 @@ declare var async: Async;
declare module "async" {
export = async;
}
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -67,16 +67,16 @@ declare module Backbone {
}
class Events {
on(eventName: any, callback?: (...args: any[]) => void , context?: any): any;
off(eventName?: string, callback?: (...args: any[]) => void , context?: any): any;
on(eventName: any, callback?: Function, context?: any): any;
off(eventName?: string, callback?: Function, context?: any): any;
trigger(eventName: string, ...args: any[]): any;
bind(eventName: string, callback: (...args: any[]) => void , context?: any): any;
unbind(eventName?: string, callback?: (...args: any[]) => void , context?: any): any;
bind(eventName: string, callback: Function, context?: any): any;
unbind(eventName?: string, callback?: Function, context?: any): any;
once(events: string, callback: (...args: any[]) => void , context?: any): any;
listenTo(object: any, events: string, callback: (...args: any[]) => void ): any;
listenToOnce(object: any, events: string, callback: (...args: any[]) => void ): any;
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void ): any;
once(events: string, callback: Function, context?: any): any;
listenTo(object: any, events: string, callback: Function): any;
listenToOnce(object: any, events: string, callback: Function): any;
stopListening(object?: any, events?: string, callback?: Function): any;
}
class ModelBase extends Events {
@@ -248,7 +248,7 @@ declare module Backbone {
constructor(options?: RouterOptions);
initialize(options?: RouterOptions);
route(route: string, name: string, callback?: (...parameter: any[]) => void );
route(route: string, name: string, callback?: Function);
navigate(fragment: string, options?: NavigateOptions);
navigate(fragment: string, trigger?: boolean);
@@ -269,7 +269,7 @@ declare module Backbone {
getHash(window?: Window): string;
getFragment(fragment?: string, forcePushState?: boolean): string;
stop(): void;
route(route: string, callback: (...args: any[]) => void );
route(route: string, callback: Function);
checkUrl(e?: any): void;
loadUrl(fragmentOverride: string): boolean;
navigate(fragment: string, options?: any);
@@ -339,4 +339,3 @@ declare module Backbone {
function setDomLibrary(jQueryNew);
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -1,4 +1,4 @@
// Type definitions for bootstrap.datepicker
// Type definitions for bootstrap.datepicker
// Project: https://github.com/eternicode/bootstrap-datepicker
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -24,4 +24,10 @@ interface JQuery {
datepicker(methodName: string): JQuery;
datepicker(methodName: string, params: any): JQuery;
datepicker(options: DatepickerOptions): JQuery;
}
off(events?: "changeDate", selector?: any, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", selector?: string, data?: any, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", selector?: string, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", handler?: (eventObject: any) => any): JQuery;
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -9,25 +9,25 @@ declare module "browser-harness" {
import events = require("events");
interface HarnessEvents extends events.NodeEventEmitter {
once(event: string, listener: (driver: Driver) => void);
once(event: 'ready', listener: (driver: Driver) => void);
once(event: string, listener: (driver: Driver) => void): events.NodeEventEmitter;
once(event: 'ready', listener: (driver: Driver) => void): events.NodeEventEmitter;
on(event: string, listener: (driver: Driver) => void);
on(event: 'ready', listener: (driver: Driver) => void);
on(event: string, listener: (driver: Driver) => void): events.NodeEventEmitter;
on(event: 'ready', listener: (driver: Driver) => void): events.NodeEventEmitter;
}
interface DriverEvents extends events.NodeEventEmitter {
once(event: string, listener: (text: string) => void);
once(event: 'console.log', listener: (text: string) => void);
once(event: 'console.warn', listener: (text: string) => void);
once(event: 'console.error', listener: (text: string) => void);
once(event: 'window.onerror', listener: (text: string) => void);
once(event: string, listener: (text: string) => void): events.NodeEventEmitter;
once(event: 'console.log', listener: (text: string) => void): events.NodeEventEmitter;
once(event: 'console.warn', listener: (text: string) => void): events.NodeEventEmitter;
once(event: 'console.error', listener: (text: string) => void): events.NodeEventEmitter;
once(event: 'window.onerror', listener: (text: string) => void): events.NodeEventEmitter;
on(event: string, listener: (text: string) => void);
on(event: 'console.log', listener: (text: string) => void);
on(event: 'console.warn', listener: (text: string) => void);
on(event: 'console.error', listener: (text: string) => void);
on(event: 'window.onerror', listener: (text: string) => void);
on(event: string, listener: (text: string) => void): events.NodeEventEmitter;
on(event: 'console.log', listener: (text: string) => void): events.NodeEventEmitter;
on(event: 'console.warn', listener: (text: string) => void): events.NodeEventEmitter;
on(event: 'console.error', listener: (text: string) => void): events.NodeEventEmitter;
on(event: 'window.onerror', listener: (text: string) => void): events.NodeEventEmitter;
}
export interface Driver {

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

138
chai/chai-assert.d.ts vendored
View File

@@ -7,108 +7,108 @@ declare module chai
{
interface Assert
{
(express:any, msg?:string);
(express:any, msg?:string):void;
fail(actual?:any, expected?:any, msg?:string, operator?:string);
fail(actual?:any, expected?:any, msg?:string, operator?:string):void;
ok(val:any, msg?:string);
notOk(val:any, msg?:string);
ok(val:any, msg?:string):void;
notOk(val:any, msg?:string):void;
equal(act:any, exp:any, msg?:string);
notEqual(act:any, exp:any, msg?:string);
equal(act:any, exp:any, msg?:string):void;
notEqual(act:any, exp:any, msg?:string):void;
strictEqual(act:any, exp:any, msg?:string);
notStrictEqual(act:any, exp:any, msg?:string);
strictEqual(act:any, exp:any, msg?:string):void;
notStrictEqual(act:any, exp:any, msg?:string):void;
deepEqual(act:any, exp:any, msg?:string);
notDeepEqual(act:any, exp:any, msg?:string);
deepEqual(act:any, exp:any, msg?:string):void;
notDeepEqual(act:any, exp:any, msg?:string):void;
isTrue(val:any, msg?:string);
isFalse(val:any, msg?:string);
isTrue(val:any, msg?:string):void;
isFalse(val:any, msg?:string):void;
isNull(val:any, msg?:string);
isNotNull(val:any, msg?:string);
isNull(val:any, msg?:string):void;
isNotNull(val:any, msg?:string):void;
isUndefined(val:any, msg?:string);
isDefined(val:any, msg?:string);
isUndefined(val:any, msg?:string):void;
isDefined(val:any, msg?:string):void;
isFunction(val:any, msg?:string);
isNotFunction(val:any, msg?:string);
isFunction(val:any, msg?:string):void;
isNotFunction(val:any, msg?:string):void;
isObject(val:any, msg?:string);
isNotObject(val:any, msg?:string);
isObject(val:any, msg?:string):void;
isNotObject(val:any, msg?:string):void;
isArray(val:any, msg?:string);
isNotArray(val:any, msg?:string);
isArray(val:any, msg?:string):void;
isNotArray(val:any, msg?:string):void;
isString(val:any, msg?:string);
isNotString(val:any, msg?:string);
isString(val:any, msg?:string):void;
isNotString(val:any, msg?:string):void;
isNumber(val:any, msg?:string);
isNotNumber(val:any, msg?:string);
isNumber(val:any, msg?:string):void;
isNotNumber(val:any, msg?:string):void;
isBoolean(val:any, msg?:string);
isNotBoolean(val:any, msg?:string);
isBoolean(val:any, msg?:string):void;
isNotBoolean(val:any, msg?:string):void;
typeOf(val:any, type:string, msg?:string);
notTypeOf(val:any, type:string, msg?:string);
typeOf(val:any, type:string, msg?:string):void;
notTypeOf(val:any, type:string, msg?:string):void;
instanceOf(val:any, type:Function, msg?:string);
notInstanceOf(val:any, type:Function, msg?:string);
instanceOf(val:any, type:Function, msg?:string):void;
notInstanceOf(val:any, type:Function, msg?:string):void;
include(exp:string, inc:any, msg?:string);
include(exp:any[], inc:any, msg?:string);
include(exp:string, inc:any, msg?:string):void;
include(exp:any[], inc:any, msg?:string):void;
notInclude(exp:string, inc:any, msg?:string);
notInclude(exp:any[], inc:any, msg?:string);
notInclude(exp:string, inc:any, msg?:string):void;
notInclude(exp:any[], inc:any, msg?:string):void;
match(exp:any, re:RegExp, msg?:string);
notMatch(exp:any, re:RegExp, msg?:string);
match(exp:any, re:RegExp, msg?:string):void;
notMatch(exp:any, re:RegExp, msg?:string):void;
property(obj:Object, prop:string, msg?:string);
notProperty(obj:Object, prop:string, msg?:string);
deepProperty(obj:Object, prop:string, msg?:string);
notDeepProperty(obj:Object, prop:string, msg?:string);
property(obj:Object, prop:string, msg?:string):void;
notProperty(obj:Object, prop:string, msg?:string):void;
deepProperty(obj:Object, prop:string, msg?:string):void;
notDeepProperty(obj:Object, prop:string, msg?:string):void;
propertyVal(obj:Object, prop:string, val:any, msg?:string);
propertyNotVal(obj:Object, prop:string, val:any, msg?:string);
propertyVal(obj:Object, prop:string, val:any, msg?:string):void;
propertyNotVal(obj:Object, prop:string, val:any, msg?:string):void;
deepPropertyVal(obj:Object, prop:string, val:any, msg?:string);
deepPropertyNotVal(obj:Object, prop:string, val:any, msg?:string);
deepPropertyVal(obj:Object, prop:string, val:any, msg?:string):void;
deepPropertyNotVal(obj:Object, prop:string, val:any, msg?:string):void;
lengthOf(exp:any, len:number, msg?:string);
lengthOf(exp:any, len:number, msg?:string):void;
//alias frenzy
throw(fn:Function, msg?:string);
throw(fn:Function, regExp:RegExp);
throw(fn:Function, errType:Function, msg?:string);
throw(fn:Function, errType:Function, regExp:RegExp);
throw(fn:Function, msg?:string):void;
throw(fn:Function, regExp:RegExp):void;
throw(fn:Function, errType:Function, msg?:string):void;
throw(fn:Function, errType:Function, regExp:RegExp):void;
throws(fn:Function, msg?:string);
throws(fn:Function, regExp:RegExp);
throws(fn:Function, errType:Function, msg?:string);
throws(fn:Function, errType:Function, regExp:RegExp);
throws(fn:Function, msg?:string):void;
throws(fn:Function, regExp:RegExp):void;
throws(fn:Function, errType:Function, msg?:string):void;
throws(fn:Function, errType:Function, regExp:RegExp):void;
Throw(fn:Function, msg?:string);
Throw(fn:Function, regExp:RegExp);
Throw(fn:Function, errType:Function, msg?:string);
Throw(fn:Function, errType:Function, regExp:RegExp);
Throw(fn:Function, msg?:string):void;
Throw(fn:Function, regExp:RegExp):void;
Throw(fn:Function, errType:Function, msg?:string):void;
Throw(fn:Function, errType:Function, regExp:RegExp):void;
doesNotThrow(fn:Function, msg?:string);
doesNotThrow(fn:Function, regExp:RegExp);
doesNotThrow(fn:Function, errType:Function, msg?:string);
doesNotThrow(fn:Function, errType:Function, regExp:RegExp);
doesNotThrow(fn:Function, msg?:string):void;
doesNotThrow(fn:Function, regExp:RegExp):void;
doesNotThrow(fn:Function, errType:Function, msg?:string):void;
doesNotThrow(fn:Function, errType:Function, regExp:RegExp):void;
operator(val:any, operator:string, val2:any, msg?:string);
closeTo(act:number, exp:number, delta:number, msg?:string);
operator(val:any, operator:string, val2:any, msg?:string):void;
closeTo(act:number, exp:number, delta:number, msg?:string):void;
sameMembers(set1:any[], set2:any[], msg?:string);
includeMembers(set1:any[], set2:any[], msg?:string);
sameMembers(set1:any[], set2:any[], msg?:string):void;
includeMembers(set1:any[], set2:any[], msg?:string):void;
ifError(val:any, msg?:string);
ifError(val:any, msg?:string):void;
}
//node module
var assert:Assert;
}
//browser global
declare var assert:chai.Assert;
declare var assert:chai.Assert;

View File

@@ -688,6 +688,12 @@ function _throw() {
}, "blah: expected [Function] to throw error including 'hello' but got 'testing'");
}
function use(){
chai.use(function (_chai, utils) {
_chai.can.use.any();
});
}
function respondTo() {
function Foo() {};
var bar = {};

View File

@@ -0,0 +1 @@
""

3
chai/chai.d.ts vendored
View File

@@ -8,6 +8,9 @@ declare module chai {
function expect(target: any): Expect;
// Provides a way to extend the internals of Chai
function use(fn: (chai: any, utils: any) => void);
interface ExpectStatic {
(target: any): Expect;
}

1
chai/chai.d.ts.tscparams Normal file
View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1,27 @@
/// <reference path="chrome-app.d.ts" />
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
var createOptions: cwindow.CreateOptions = {
id: "My Window",
bounds: {
left: 0,
top: 0,
width: 640,
height: 480
},
resizable: true
};
//Create new window on app launch
chrome.app.runtime.onLaunched.addListener(function (launchData: runtime.LaunchData) {
chrome.app.window.create('app/url', createOptions, function (created_window: cwindow.AppWindow) {
return;
});
});
chrome.app.runtime.onRestarted.addListener(function () { return; });
// Get Current Window
var currentWindow: cwindow.AppWindow = chrome.app.window.current();

View File

@@ -0,0 +1 @@
""

95
chrome/chrome-app.d.ts vendored Normal file
View File

@@ -0,0 +1,95 @@
// Type definitions for Chrome packaged application development.
// Project: http://developer.chrome.com/apps/
// Definitions by: Adam Lay <https://github.com/AdamLay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
////////////////////
// App Runtime
////////////////////
declare module chrome.app.runtime {
interface LaunchData {
id?: string;
items?: LaunchDataItem[];
url?: string;
referrerUrl?: string;
isKioskSession?: boolean;
}
interface LaunchDataItem {
entry: File;
type: string;
}
interface LaunchedEvent {
addListener(callback: (launchData: LaunchData) => void);
}
interface RestartedEvent {
addListener(callback: () => void);
}
var onLaunched: LaunchedEvent;
var onRestarted: RestartedEvent;
}
////////////////////
// App Window
////////////////////
declare module chrome.app.window {
interface Bounds {
left?: number;
top?: number;
width?: number;
height?: number;
}
interface AppWindow {
focus: () => void;
fullscreen: () => void;
isFullscreen: () => boolean;
minimize: () => void;
isMinimized: () => boolean;
maximize: () => void;
isMaximized: () => boolean;
restore: () => void;
moveTo: (left: number, top: number) => void;
resizeTo: (width: number, height: number) => void;
drawAttention: () => void;
clearAttention: () => void;
close: () => void;
show: () => void;
hide: () => void;
getBounds: () => Bounds;
setBounds: (bounds: Bounds) => void;
contentWindow: Window;
}
interface CreateOptions {
id?: string;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
frame?: string; // "none", "chrome"
bounds?: Bounds;
transparentBackground?: boolean;
state?: string; // "normal", "fullscreen", "maximized", "minimized"
hidden?: boolean;
resizable?: boolean;
singleton?: boolean;
}
export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void;
export function current(): AppWindow;
interface WindowEvent {
addListener(callback: () => void): void;
}
var onBoundsChanged: WindowEvent;
var onClosed: WindowEvent;
var onFullscreened: WindowEvent;
var onMaximized: WindowEvent;
var onMinimized: WindowEvent;
var onRestored: WindowEvent;
}

View File

@@ -0,0 +1 @@
""

Some files were not shown because too many files have changed in this diff Show More