├── .gitignore ├── README.md ├── directives ├── googlerecaptcha.directive.js └── googlerecaptcha.directive.ts ├── example ├── app.component.js ├── app.component.js.map ├── app.component.ts ├── main.js ├── main.js.map └── main.ts ├── index.html ├── package.json ├── systemjs.config.js ├── tsconfig.json ├── typings.json └── typings ├── browser.d.ts ├── browser └── ambient │ ├── es6-shim │ └── index.d.ts │ └── jasmine │ └── index.d.ts ├── index.d.ts ├── main.d.ts └── main └── ambient ├── es6-shim └── index.d.ts └── jasmine └── index.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject/private/ 2 | /node_modules/* 3 | /nbproject/ 4 | /npm-debug.log -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Angular2 Google Recaptcha 2 | ========= 3 | 4 | The sources for this package are in (https://github.com/rajan-g/angular2-google-recaptcha) repo. Please file issues and pull requests against that repo. 5 | 6 | ### Live Demo 7 | [Live Demo Site](http://www.angular2modules.com/captcha "Live Demo Site For Letter Recaptcha ") 8 | OR 9 | [Live Demo Site](http://www.angular2modules.com "Live Demo Site For Letter Recaptcha ") 10 | ## Usage 11 | npm install angular2-google-recaptcha 12 | ### 1. Index.html page include following script 13 | 14 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | Loading... 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular2-google-recaptcha", 3 | "version": "1.0.3", 4 | "description": "angular2-google-recaptcha is a simple congigurable angular2 directive", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", 8 | "tsc": "tsc", 9 | "tsc:w": "tsc -w", 10 | "lite": "lite-server", 11 | "typings": "typings", 12 | "postinstall": "typings install" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/rajan-g/angular2-google-recaptcha.git" 17 | }, 18 | "keywords": [ 19 | "angular2-google-recaptcha", 20 | "google-recaptcha", 21 | "ng2-google-recaptcha", 22 | "ng2-recaptcha", 23 | "ng2-captcha", 24 | "angular2-captcha" 25 | ], 26 | "dependencies": { 27 | "@angular/common": "^2.0.0-rc.4", 28 | "@angular/compiler": "^2.0.0-rc.4", 29 | "@angular/core": "^2.0.0-rc.4", 30 | "@angular/platform-browser": "^2.0.0-rc.4", 31 | "@angular/platform-browser-dynamic": "^2.0.0-rc.4", 32 | "@angular/upgrade": "^2.0.0-rc.4" 33 | }, 34 | "devDependencies": { 35 | "systemjs": "0.19.27", 36 | "core-js": "^2.4.0", 37 | "reflect-metadata": "^0.1.3", 38 | "rxjs": "5.0.0-beta.6", 39 | "zone.js": "^0.6.12", 40 | "concurrently": "^2.0.0", 41 | "lite-server": "^2.2.0", 42 | "typescript": "^1.8.10", 43 | "typings": "^1.0.4" 44 | }, 45 | "author": "Rajan G", 46 | "license": "ISC", 47 | "bugs": { 48 | "url": "https://github.com/rajan-g/angular2-google-recaptcha/issues" 49 | }, 50 | "homepage": "https://github.com/rajan-g/angular2-google-recaptcha#readme" 51 | } 52 | -------------------------------------------------------------------------------- /systemjs.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * System configuration for Angular 2 samples 3 | * Adjust as necessary for your application needs. 4 | */ 5 | (function(global) { 6 | // map tells the System loader where to look for things 7 | var map = { 8 | 'app': 'example', // 'dist', 9 | 'directive': 'directives', 10 | '@angular': 'node_modules/@angular', 11 | 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', 12 | 'rxjs': 'node_modules/rxjs' 13 | }; 14 | // packages tells the System loader how to load when no filename and/or no extension 15 | var packages = { 16 | 'app': { main: 'main.js', defaultExtension: 'js' }, 17 | 'rxjs': { defaultExtension: 'js' }, 18 | 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, 19 | 'directive' : {defaultExtension:'js'} 20 | }; 21 | var ngPackageNames = [ 22 | 'common', 23 | 'compiler', 24 | 'core', 25 | 'forms', 26 | 'http', 27 | 'platform-browser', 28 | 'platform-browser-dynamic', 29 | 'router', 30 | 'router-deprecated', 31 | 'upgrade', 32 | ]; 33 | // Individual files (~300 requests): 34 | function packIndex(pkgName) { 35 | packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' }; 36 | } 37 | // Bundled (~40 requests): 38 | function packUmd(pkgName) { 39 | packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' }; 40 | } 41 | // Most environments should use UMD; some (Karma) need the individual index files 42 | var setPackageConfig = System.packageWithIndex ? packIndex : packUmd; 43 | // Add package entries for angular packages 44 | ngPackageNames.forEach(setPackageConfig); 45 | var config = { 46 | map: map, 47 | packages: packages 48 | }; 49 | System.config(config); 50 | })(this); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "system", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false 11 | }, 12 | "exclude": [ 13 | "node_modules", 14 | "typings/main", 15 | "typings/main.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd", 4 | "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /typings/browser.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /typings/browser/ambient/es6-shim/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6-shim/es6-shim.d.ts 3 | // Type definitions for es6-shim v0.31.2 4 | // Project: https://github.com/paulmillr/es6-shim 5 | // Definitions by: Ron Buckton 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | declare type PropertyKey = string | number | symbol; 9 | 10 | interface IteratorResult { 11 | done: boolean; 12 | value?: T; 13 | } 14 | 15 | interface IterableShim { 16 | /** 17 | * Shim for an ES6 iterable. Not intended for direct use by user code. 18 | */ 19 | "_es6-shim iterator_"(): Iterator; 20 | } 21 | 22 | interface Iterator { 23 | next(value?: any): IteratorResult; 24 | return?(value?: any): IteratorResult; 25 | throw?(e?: any): IteratorResult; 26 | } 27 | 28 | interface IterableIteratorShim extends IterableShim, Iterator { 29 | /** 30 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 31 | */ 32 | "_es6-shim iterator_"(): IterableIteratorShim; 33 | } 34 | 35 | interface StringConstructor { 36 | /** 37 | * Return the String value whose elements are, in order, the elements in the List elements. 38 | * If length is 0, the empty string is returned. 39 | */ 40 | fromCodePoint(...codePoints: number[]): string; 41 | 42 | /** 43 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 44 | * as such the first argument will be a well formed template call site object and the rest 45 | * parameter will contain the substitution values. 46 | * @param template A well-formed template string call site representation. 47 | * @param substitutions A set of substitution values. 48 | */ 49 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 50 | } 51 | 52 | interface String { 53 | /** 54 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 55 | * value of the UTF-16 encoded code point starting at the string element at position pos in 56 | * the String resulting from converting this object to a String. 57 | * If there is no element at that position, the result is undefined. 58 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 59 | */ 60 | codePointAt(pos: number): number; 61 | 62 | /** 63 | * Returns true if searchString appears as a substring of the result of converting this 64 | * object to a String, at one or more positions that are 65 | * greater than or equal to position; otherwise, returns false. 66 | * @param searchString search string 67 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 68 | */ 69 | includes(searchString: string, position?: number): boolean; 70 | 71 | /** 72 | * Returns true if the sequence of elements of searchString converted to a String is the 73 | * same as the corresponding elements of this object (converted to a String) starting at 74 | * endPosition – length(this). Otherwise returns false. 75 | */ 76 | endsWith(searchString: string, endPosition?: number): boolean; 77 | 78 | /** 79 | * Returns a String value that is made from count copies appended together. If count is 0, 80 | * T is the empty String is returned. 81 | * @param count number of copies to append 82 | */ 83 | repeat(count: number): string; 84 | 85 | /** 86 | * Returns true if the sequence of elements of searchString converted to a String is the 87 | * same as the corresponding elements of this object (converted to a String) starting at 88 | * position. Otherwise returns false. 89 | */ 90 | startsWith(searchString: string, position?: number): boolean; 91 | 92 | /** 93 | * Returns an HTML anchor element and sets the name attribute to the text value 94 | * @param name 95 | */ 96 | anchor(name: string): string; 97 | 98 | /** Returns a HTML element */ 99 | big(): string; 100 | 101 | /** Returns a HTML element */ 102 | blink(): string; 103 | 104 | /** Returns a HTML element */ 105 | bold(): string; 106 | 107 | /** Returns a HTML element */ 108 | fixed(): string 109 | 110 | /** Returns a HTML element and sets the color attribute value */ 111 | fontcolor(color: string): string 112 | 113 | /** Returns a HTML element and sets the size attribute value */ 114 | fontsize(size: number): string; 115 | 116 | /** Returns a HTML element and sets the size attribute value */ 117 | fontsize(size: string): string; 118 | 119 | /** Returns an HTML element */ 120 | italics(): string; 121 | 122 | /** Returns an HTML element and sets the href attribute value */ 123 | link(url: string): string; 124 | 125 | /** Returns a HTML element */ 126 | small(): string; 127 | 128 | /** Returns a HTML element */ 129 | strike(): string; 130 | 131 | /** Returns a HTML element */ 132 | sub(): string; 133 | 134 | /** Returns a HTML element */ 135 | sup(): string; 136 | 137 | /** 138 | * Shim for an ES6 iterable. Not intended for direct use by user code. 139 | */ 140 | "_es6-shim iterator_"(): IterableIteratorShim; 141 | } 142 | 143 | interface ArrayConstructor { 144 | /** 145 | * Creates an array from an array-like object. 146 | * @param arrayLike An array-like object to convert to an array. 147 | * @param mapfn A mapping function to call on every element of the array. 148 | * @param thisArg Value of 'this' used to invoke the mapfn. 149 | */ 150 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 151 | 152 | /** 153 | * Creates an array from an iterable object. 154 | * @param iterable An iterable object to convert to an array. 155 | * @param mapfn A mapping function to call on every element of the array. 156 | * @param thisArg Value of 'this' used to invoke the mapfn. 157 | */ 158 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 159 | 160 | /** 161 | * Creates an array from an array-like object. 162 | * @param arrayLike An array-like object to convert to an array. 163 | */ 164 | from(arrayLike: ArrayLike): Array; 165 | 166 | /** 167 | * Creates an array from an iterable object. 168 | * @param iterable An iterable object to convert to an array. 169 | */ 170 | from(iterable: IterableShim): Array; 171 | 172 | /** 173 | * Returns a new array from a set of elements. 174 | * @param items A set of elements to include in the new array object. 175 | */ 176 | of(...items: T[]): Array; 177 | } 178 | 179 | interface Array { 180 | /** 181 | * Returns the value of the first element in the array where predicate is true, and undefined 182 | * otherwise. 183 | * @param predicate find calls predicate once for each element of the array, in ascending 184 | * order, until it finds one where predicate returns true. If such an element is found, find 185 | * immediately returns that element value. Otherwise, find returns undefined. 186 | * @param thisArg If provided, it will be used as the this value for each invocation of 187 | * predicate. If it is not provided, undefined is used instead. 188 | */ 189 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 190 | 191 | /** 192 | * Returns the index of the first element in the array where predicate is true, and undefined 193 | * otherwise. 194 | * @param predicate find calls predicate once for each element of the array, in ascending 195 | * order, until it finds one where predicate returns true. If such an element is found, find 196 | * immediately returns that element value. Otherwise, find returns undefined. 197 | * @param thisArg If provided, it will be used as the this value for each invocation of 198 | * predicate. If it is not provided, undefined is used instead. 199 | */ 200 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 201 | 202 | /** 203 | * Returns the this object after filling the section identified by start and end with value 204 | * @param value value to fill array section with 205 | * @param start index to start filling the array at. If start is negative, it is treated as 206 | * length+start where length is the length of the array. 207 | * @param end index to stop filling the array at. If end is negative, it is treated as 208 | * length+end. 209 | */ 210 | fill(value: T, start?: number, end?: number): T[]; 211 | 212 | /** 213 | * Returns the this object after copying a section of the array identified by start and end 214 | * to the same array starting at position target 215 | * @param target If target is negative, it is treated as length+target where length is the 216 | * length of the array. 217 | * @param start If start is negative, it is treated as length+start. If end is negative, it 218 | * is treated as length+end. 219 | * @param end If not specified, length of the this object is used as its default value. 220 | */ 221 | copyWithin(target: number, start: number, end?: number): T[]; 222 | 223 | /** 224 | * Returns an array of key, value pairs for every entry in the array 225 | */ 226 | entries(): IterableIteratorShim<[number, T]>; 227 | 228 | /** 229 | * Returns an list of keys in the array 230 | */ 231 | keys(): IterableIteratorShim; 232 | 233 | /** 234 | * Returns an list of values in the array 235 | */ 236 | values(): IterableIteratorShim; 237 | 238 | /** 239 | * Shim for an ES6 iterable. Not intended for direct use by user code. 240 | */ 241 | "_es6-shim iterator_"(): IterableIteratorShim; 242 | } 243 | 244 | interface NumberConstructor { 245 | /** 246 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 247 | * that is representable as a Number value, which is approximately: 248 | * 2.2204460492503130808472633361816 x 10‍−‍16. 249 | */ 250 | EPSILON: number; 251 | 252 | /** 253 | * Returns true if passed value is finite. 254 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 255 | * number. Only finite values of the type number, result in true. 256 | * @param number A numeric value. 257 | */ 258 | isFinite(number: number): boolean; 259 | 260 | /** 261 | * Returns true if the value passed is an integer, false otherwise. 262 | * @param number A numeric value. 263 | */ 264 | isInteger(number: number): boolean; 265 | 266 | /** 267 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 268 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 269 | * to a number. Only values of the type number, that are also NaN, result in true. 270 | * @param number A numeric value. 271 | */ 272 | isNaN(number: number): boolean; 273 | 274 | /** 275 | * Returns true if the value passed is a safe integer. 276 | * @param number A numeric value. 277 | */ 278 | isSafeInteger(number: number): boolean; 279 | 280 | /** 281 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 282 | * a Number value. 283 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 284 | */ 285 | MAX_SAFE_INTEGER: number; 286 | 287 | /** 288 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 289 | * a Number value. 290 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 291 | */ 292 | MIN_SAFE_INTEGER: number; 293 | 294 | /** 295 | * Converts a string to a floating-point number. 296 | * @param string A string that contains a floating-point number. 297 | */ 298 | parseFloat(string: string): number; 299 | 300 | /** 301 | * Converts A string to an integer. 302 | * @param s A string to convert into a number. 303 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 304 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 305 | * All other strings are considered decimal. 306 | */ 307 | parseInt(string: string, radix?: number): number; 308 | } 309 | 310 | interface ObjectConstructor { 311 | /** 312 | * Copy the values of all of the enumerable own properties from one or more source objects to a 313 | * target object. Returns the target object. 314 | * @param target The target object to copy to. 315 | * @param sources One or more source objects to copy properties from. 316 | */ 317 | assign(target: any, ...sources: any[]): any; 318 | 319 | /** 320 | * Returns true if the values are the same value, false otherwise. 321 | * @param value1 The first value. 322 | * @param value2 The second value. 323 | */ 324 | is(value1: any, value2: any): boolean; 325 | 326 | /** 327 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 328 | * @param o The object to change its prototype. 329 | * @param proto The value of the new prototype or null. 330 | * @remarks Requires `__proto__` support. 331 | */ 332 | setPrototypeOf(o: any, proto: any): any; 333 | } 334 | 335 | interface RegExp { 336 | /** 337 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 338 | * The characters in this string are sequenced and concatenated in the following order: 339 | * 340 | * - "g" for global 341 | * - "i" for ignoreCase 342 | * - "m" for multiline 343 | * - "u" for unicode 344 | * - "y" for sticky 345 | * 346 | * If no flags are set, the value is the empty string. 347 | */ 348 | flags: string; 349 | } 350 | 351 | interface Math { 352 | /** 353 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 354 | * @param x A numeric expression. 355 | */ 356 | clz32(x: number): number; 357 | 358 | /** 359 | * Returns the result of 32-bit multiplication of two numbers. 360 | * @param x First number 361 | * @param y Second number 362 | */ 363 | imul(x: number, y: number): number; 364 | 365 | /** 366 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 367 | * @param x The numeric expression to test 368 | */ 369 | sign(x: number): number; 370 | 371 | /** 372 | * Returns the base 10 logarithm of a number. 373 | * @param x A numeric expression. 374 | */ 375 | log10(x: number): number; 376 | 377 | /** 378 | * Returns the base 2 logarithm of a number. 379 | * @param x A numeric expression. 380 | */ 381 | log2(x: number): number; 382 | 383 | /** 384 | * Returns the natural logarithm of 1 + x. 385 | * @param x A numeric expression. 386 | */ 387 | log1p(x: number): number; 388 | 389 | /** 390 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 391 | * the natural logarithms). 392 | * @param x A numeric expression. 393 | */ 394 | expm1(x: number): number; 395 | 396 | /** 397 | * Returns the hyperbolic cosine of a number. 398 | * @param x A numeric expression that contains an angle measured in radians. 399 | */ 400 | cosh(x: number): number; 401 | 402 | /** 403 | * Returns the hyperbolic sine of a number. 404 | * @param x A numeric expression that contains an angle measured in radians. 405 | */ 406 | sinh(x: number): number; 407 | 408 | /** 409 | * Returns the hyperbolic tangent of a number. 410 | * @param x A numeric expression that contains an angle measured in radians. 411 | */ 412 | tanh(x: number): number; 413 | 414 | /** 415 | * Returns the inverse hyperbolic cosine of a number. 416 | * @param x A numeric expression that contains an angle measured in radians. 417 | */ 418 | acosh(x: number): number; 419 | 420 | /** 421 | * Returns the inverse hyperbolic sine of a number. 422 | * @param x A numeric expression that contains an angle measured in radians. 423 | */ 424 | asinh(x: number): number; 425 | 426 | /** 427 | * Returns the inverse hyperbolic tangent of a number. 428 | * @param x A numeric expression that contains an angle measured in radians. 429 | */ 430 | atanh(x: number): number; 431 | 432 | /** 433 | * Returns the square root of the sum of squares of its arguments. 434 | * @param values Values to compute the square root for. 435 | * If no arguments are passed, the result is +0. 436 | * If there is only one argument, the result is the absolute value. 437 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 438 | * If any argument is NaN, the result is NaN. 439 | * If all arguments are either +0 or −0, the result is +0. 440 | */ 441 | hypot(...values: number[]): number; 442 | 443 | /** 444 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 445 | * If x is already an integer, the result is x. 446 | * @param x A numeric expression. 447 | */ 448 | trunc(x: number): number; 449 | 450 | /** 451 | * Returns the nearest single precision float representation of a number. 452 | * @param x A numeric expression. 453 | */ 454 | fround(x: number): number; 455 | 456 | /** 457 | * Returns an implementation-dependent approximation to the cube root of number. 458 | * @param x A numeric expression. 459 | */ 460 | cbrt(x: number): number; 461 | } 462 | 463 | interface PromiseLike { 464 | /** 465 | * Attaches callbacks for the resolution and/or rejection of the Promise. 466 | * @param onfulfilled The callback to execute when the Promise is resolved. 467 | * @param onrejected The callback to execute when the Promise is rejected. 468 | * @returns A Promise for the completion of which ever callback is executed. 469 | */ 470 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 471 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 472 | } 473 | 474 | /** 475 | * Represents the completion of an asynchronous operation 476 | */ 477 | interface Promise { 478 | /** 479 | * Attaches callbacks for the resolution and/or rejection of the Promise. 480 | * @param onfulfilled The callback to execute when the Promise is resolved. 481 | * @param onrejected The callback to execute when the Promise is rejected. 482 | * @returns A Promise for the completion of which ever callback is executed. 483 | */ 484 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 485 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 486 | 487 | /** 488 | * Attaches a callback for only the rejection of the Promise. 489 | * @param onrejected The callback to execute when the Promise is rejected. 490 | * @returns A Promise for the completion of the callback. 491 | */ 492 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 493 | catch(onrejected?: (reason: any) => void): Promise; 494 | } 495 | 496 | interface PromiseConstructor { 497 | /** 498 | * A reference to the prototype. 499 | */ 500 | prototype: Promise; 501 | 502 | /** 503 | * Creates a new Promise. 504 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 505 | * a resolve callback used resolve the promise with a value or the result of another promise, 506 | * and a reject callback used to reject the promise with a provided reason or error. 507 | */ 508 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 509 | 510 | /** 511 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 512 | * resolve, or rejected when any Promise is rejected. 513 | * @param values An array of Promises. 514 | * @returns A new Promise. 515 | */ 516 | all(values: IterableShim>): Promise; 517 | 518 | /** 519 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 520 | * or rejected. 521 | * @param values An array of Promises. 522 | * @returns A new Promise. 523 | */ 524 | race(values: IterableShim>): Promise; 525 | 526 | /** 527 | * Creates a new rejected promise for the provided reason. 528 | * @param reason The reason the promise was rejected. 529 | * @returns A new rejected Promise. 530 | */ 531 | reject(reason: any): Promise; 532 | 533 | /** 534 | * Creates a new rejected promise for the provided reason. 535 | * @param reason The reason the promise was rejected. 536 | * @returns A new rejected Promise. 537 | */ 538 | reject(reason: any): Promise; 539 | 540 | /** 541 | * Creates a new resolved promise for the provided value. 542 | * @param value A promise. 543 | * @returns A promise whose internal state matches the provided promise. 544 | */ 545 | resolve(value: T | PromiseLike): Promise; 546 | 547 | /** 548 | * Creates a new resolved promise . 549 | * @returns A resolved promise. 550 | */ 551 | resolve(): Promise; 552 | } 553 | 554 | declare var Promise: PromiseConstructor; 555 | 556 | interface Map { 557 | clear(): void; 558 | delete(key: K): boolean; 559 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 560 | get(key: K): V; 561 | has(key: K): boolean; 562 | set(key: K, value?: V): Map; 563 | size: number; 564 | entries(): IterableIteratorShim<[K, V]>; 565 | keys(): IterableIteratorShim; 566 | values(): IterableIteratorShim; 567 | } 568 | 569 | interface MapConstructor { 570 | new (): Map; 571 | new (iterable: IterableShim<[K, V]>): Map; 572 | prototype: Map; 573 | } 574 | 575 | declare var Map: MapConstructor; 576 | 577 | interface Set { 578 | add(value: T): Set; 579 | clear(): void; 580 | delete(value: T): boolean; 581 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 582 | has(value: T): boolean; 583 | size: number; 584 | entries(): IterableIteratorShim<[T, T]>; 585 | keys(): IterableIteratorShim; 586 | values(): IterableIteratorShim; 587 | } 588 | 589 | interface SetConstructor { 590 | new (): Set; 591 | new (iterable: IterableShim): Set; 592 | prototype: Set; 593 | } 594 | 595 | declare var Set: SetConstructor; 596 | 597 | interface WeakMap { 598 | delete(key: K): boolean; 599 | get(key: K): V; 600 | has(key: K): boolean; 601 | set(key: K, value?: V): WeakMap; 602 | } 603 | 604 | interface WeakMapConstructor { 605 | new (): WeakMap; 606 | new (iterable: IterableShim<[K, V]>): WeakMap; 607 | prototype: WeakMap; 608 | } 609 | 610 | declare var WeakMap: WeakMapConstructor; 611 | 612 | interface WeakSet { 613 | add(value: T): WeakSet; 614 | delete(value: T): boolean; 615 | has(value: T): boolean; 616 | } 617 | 618 | interface WeakSetConstructor { 619 | new (): WeakSet; 620 | new (iterable: IterableShim): WeakSet; 621 | prototype: WeakSet; 622 | } 623 | 624 | declare var WeakSet: WeakSetConstructor; 625 | 626 | declare namespace Reflect { 627 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 628 | function construct(target: Function, argumentsList: ArrayLike): any; 629 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 630 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 631 | function enumerate(target: any): IterableIteratorShim; 632 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 633 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 634 | function getPrototypeOf(target: any): any; 635 | function has(target: any, propertyKey: PropertyKey): boolean; 636 | function isExtensible(target: any): boolean; 637 | function ownKeys(target: any): Array; 638 | function preventExtensions(target: any): boolean; 639 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 640 | function setPrototypeOf(target: any, proto: any): boolean; 641 | } 642 | 643 | declare module "es6-shim" { 644 | var String: StringConstructor; 645 | var Array: ArrayConstructor; 646 | var Number: NumberConstructor; 647 | var Math: Math; 648 | var Object: ObjectConstructor; 649 | var Map: MapConstructor; 650 | var Set: SetConstructor; 651 | var WeakMap: WeakMapConstructor; 652 | var WeakSet: WeakSetConstructor; 653 | var Promise: PromiseConstructor; 654 | namespace Reflect { 655 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 656 | function construct(target: Function, argumentsList: ArrayLike): any; 657 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 658 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 659 | function enumerate(target: any): Iterator; 660 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 661 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 662 | function getPrototypeOf(target: any): any; 663 | function has(target: any, propertyKey: PropertyKey): boolean; 664 | function isExtensible(target: any): boolean; 665 | function ownKeys(target: any): Array; 666 | function preventExtensions(target: any): boolean; 667 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 668 | function setPrototypeOf(target: any, proto: any): boolean; 669 | } 670 | } -------------------------------------------------------------------------------- /typings/browser/ambient/jasmine/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5c182b9af717f73146399c2485f70f1e2ac0ff2b/jasmine/jasmine.d.ts 3 | // Type definitions for Jasmine 2.2 4 | // Project: http://jasmine.github.io/ 5 | // Definitions by: Boris Yankov , Theodore Brown , David Pärsson 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts 10 | 11 | declare function describe(description: string, specDefinitions: () => void): void; 12 | declare function fdescribe(description: string, specDefinitions: () => void): void; 13 | declare function xdescribe(description: string, specDefinitions: () => void): void; 14 | 15 | declare function it(expectation: string, assertion?: () => void, timeout?: number): void; 16 | declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 17 | declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; 18 | declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 19 | declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; 20 | declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 21 | 22 | /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ 23 | declare function pending(reason?: string): void; 24 | 25 | declare function beforeEach(action: () => void, timeout?: number): void; 26 | declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; 27 | declare function afterEach(action: () => void, timeout?: number): void; 28 | declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; 29 | 30 | declare function beforeAll(action: () => void, timeout?: number): void; 31 | declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; 32 | declare function afterAll(action: () => void, timeout?: number): void; 33 | declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; 34 | 35 | declare function expect(spy: Function): jasmine.Matchers; 36 | declare function expect(actual: any): jasmine.Matchers; 37 | 38 | declare function fail(e?: any): void; 39 | /** Action method that should be called when the async work is complete */ 40 | interface DoneFn extends Function { 41 | (): void; 42 | 43 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ 44 | fail: (message?: Error|string) => void; 45 | } 46 | 47 | declare function spyOn(object: any, method: string): jasmine.Spy; 48 | 49 | declare function runs(asyncMethod: Function): void; 50 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; 51 | declare function waits(timeout?: number): void; 52 | 53 | declare namespace jasmine { 54 | 55 | var clock: () => Clock; 56 | 57 | function any(aclass: any): Any; 58 | function anything(): Any; 59 | function arrayContaining(sample: any[]): ArrayContaining; 60 | function objectContaining(sample: any): ObjectContaining; 61 | function createSpy(name: string, originalFn?: Function): Spy; 62 | function createSpyObj(baseName: string, methodNames: any[]): any; 63 | function createSpyObj(baseName: string, methodNames: any[]): T; 64 | function pp(value: any): string; 65 | function getEnv(): Env; 66 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 67 | function addMatchers(matchers: CustomMatcherFactories): void; 68 | function stringMatching(str: string): Any; 69 | function stringMatching(str: RegExp): Any; 70 | 71 | interface Any { 72 | 73 | new (expectedClass: any): any; 74 | 75 | jasmineMatches(other: any): boolean; 76 | jasmineToString(): string; 77 | } 78 | 79 | // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() 80 | interface ArrayLike { 81 | length: number; 82 | [n: number]: T; 83 | } 84 | 85 | interface ArrayContaining { 86 | new (sample: any[]): any; 87 | 88 | asymmetricMatch(other: any): boolean; 89 | jasmineToString(): string; 90 | } 91 | 92 | interface ObjectContaining { 93 | new (sample: any): any; 94 | 95 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; 96 | jasmineToString(): string; 97 | } 98 | 99 | interface Block { 100 | 101 | new (env: Env, func: SpecFunction, spec: Spec): any; 102 | 103 | execute(onComplete: () => void): void; 104 | } 105 | 106 | interface WaitsBlock extends Block { 107 | new (env: Env, timeout: number, spec: Spec): any; 108 | } 109 | 110 | interface WaitsForBlock extends Block { 111 | new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; 112 | } 113 | 114 | interface Clock { 115 | install(): void; 116 | uninstall(): void; 117 | /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ 118 | tick(ms: number): void; 119 | mockDate(date?: Date): void; 120 | } 121 | 122 | interface CustomEqualityTester { 123 | (first: any, second: any): boolean; 124 | } 125 | 126 | interface CustomMatcher { 127 | compare(actual: T, expected: T): CustomMatcherResult; 128 | compare(actual: any, expected: any): CustomMatcherResult; 129 | } 130 | 131 | interface CustomMatcherFactory { 132 | (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; 133 | } 134 | 135 | interface CustomMatcherFactories { 136 | [index: string]: CustomMatcherFactory; 137 | } 138 | 139 | interface CustomMatcherResult { 140 | pass: boolean; 141 | message?: string; 142 | } 143 | 144 | interface MatchersUtil { 145 | equals(a: any, b: any, customTesters?: Array): boolean; 146 | contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; 147 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; 148 | } 149 | 150 | interface Env { 151 | setTimeout: any; 152 | clearTimeout: void; 153 | setInterval: any; 154 | clearInterval: void; 155 | updateInterval: number; 156 | 157 | currentSpec: Spec; 158 | 159 | matchersClass: Matchers; 160 | 161 | version(): any; 162 | versionString(): string; 163 | nextSpecId(): number; 164 | addReporter(reporter: Reporter): void; 165 | execute(): void; 166 | describe(description: string, specDefinitions: () => void): Suite; 167 | // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these 168 | beforeEach(beforeEachFunction: () => void): void; 169 | beforeAll(beforeAllFunction: () => void): void; 170 | currentRunner(): Runner; 171 | afterEach(afterEachFunction: () => void): void; 172 | afterAll(afterAllFunction: () => void): void; 173 | xdescribe(desc: string, specDefinitions: () => void): XSuite; 174 | it(description: string, func: () => void): Spec; 175 | // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these 176 | xit(desc: string, func: () => void): XSpec; 177 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; 178 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 179 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 180 | contains_(haystack: any, needle: any): boolean; 181 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 182 | addMatchers(matchers: CustomMatcherFactories): void; 183 | specFilter(spec: Spec): boolean; 184 | } 185 | 186 | interface FakeTimer { 187 | 188 | new (): any; 189 | 190 | reset(): void; 191 | tick(millis: number): void; 192 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; 193 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; 194 | } 195 | 196 | interface HtmlReporter { 197 | new (): any; 198 | } 199 | 200 | interface HtmlSpecFilter { 201 | new (): any; 202 | } 203 | 204 | interface Result { 205 | type: string; 206 | } 207 | 208 | interface NestedResults extends Result { 209 | description: string; 210 | 211 | totalCount: number; 212 | passedCount: number; 213 | failedCount: number; 214 | 215 | skipped: boolean; 216 | 217 | rollupCounts(result: NestedResults): void; 218 | log(values: any): void; 219 | getItems(): Result[]; 220 | addResult(result: Result): void; 221 | passed(): boolean; 222 | } 223 | 224 | interface MessageResult extends Result { 225 | values: any; 226 | trace: Trace; 227 | } 228 | 229 | interface ExpectationResult extends Result { 230 | matcherName: string; 231 | passed(): boolean; 232 | expected: any; 233 | actual: any; 234 | message: string; 235 | trace: Trace; 236 | } 237 | 238 | interface Trace { 239 | name: string; 240 | message: string; 241 | stack: any; 242 | } 243 | 244 | interface PrettyPrinter { 245 | 246 | new (): any; 247 | 248 | format(value: any): void; 249 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; 250 | emitScalar(value: any): void; 251 | emitString(value: string): void; 252 | emitArray(array: any[]): void; 253 | emitObject(obj: any): void; 254 | append(value: any): void; 255 | } 256 | 257 | interface StringPrettyPrinter extends PrettyPrinter { 258 | } 259 | 260 | interface Queue { 261 | 262 | new (env: any): any; 263 | 264 | env: Env; 265 | ensured: boolean[]; 266 | blocks: Block[]; 267 | running: boolean; 268 | index: number; 269 | offset: number; 270 | abort: boolean; 271 | 272 | addBefore(block: Block, ensure?: boolean): void; 273 | add(block: any, ensure?: boolean): void; 274 | insertNext(block: any, ensure?: boolean): void; 275 | start(onComplete?: () => void): void; 276 | isRunning(): boolean; 277 | next_(): void; 278 | results(): NestedResults; 279 | } 280 | 281 | interface Matchers { 282 | 283 | new (env: Env, actual: any, spec: Env, isNot?: boolean): any; 284 | 285 | env: Env; 286 | actual: any; 287 | spec: Env; 288 | isNot?: boolean; 289 | message(): any; 290 | 291 | toBe(expected: any, expectationFailOutput?: any): boolean; 292 | toEqual(expected: any, expectationFailOutput?: any): boolean; 293 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; 294 | toBeDefined(expectationFailOutput?: any): boolean; 295 | toBeUndefined(expectationFailOutput?: any): boolean; 296 | toBeNull(expectationFailOutput?: any): boolean; 297 | toBeNaN(): boolean; 298 | toBeTruthy(expectationFailOutput?: any): boolean; 299 | toBeFalsy(expectationFailOutput?: any): boolean; 300 | toHaveBeenCalled(): boolean; 301 | toHaveBeenCalledWith(...params: any[]): boolean; 302 | toHaveBeenCalledTimes(expected: number): boolean; 303 | toContain(expected: any, expectationFailOutput?: any): boolean; 304 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean; 305 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; 306 | toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; 307 | toThrow(expected?: any): boolean; 308 | toThrowError(message?: string | RegExp): boolean; 309 | toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; 310 | not: Matchers; 311 | 312 | Any: Any; 313 | } 314 | 315 | interface Reporter { 316 | reportRunnerStarting(runner: Runner): void; 317 | reportRunnerResults(runner: Runner): void; 318 | reportSuiteResults(suite: Suite): void; 319 | reportSpecStarting(spec: Spec): void; 320 | reportSpecResults(spec: Spec): void; 321 | log(str: string): void; 322 | } 323 | 324 | interface MultiReporter extends Reporter { 325 | addReporter(reporter: Reporter): void; 326 | } 327 | 328 | interface Runner { 329 | 330 | new (env: Env): any; 331 | 332 | execute(): void; 333 | beforeEach(beforeEachFunction: SpecFunction): void; 334 | afterEach(afterEachFunction: SpecFunction): void; 335 | beforeAll(beforeAllFunction: SpecFunction): void; 336 | afterAll(afterAllFunction: SpecFunction): void; 337 | finishCallback(): void; 338 | addSuite(suite: Suite): void; 339 | add(block: Block): void; 340 | specs(): Spec[]; 341 | suites(): Suite[]; 342 | topLevelSuites(): Suite[]; 343 | results(): NestedResults; 344 | } 345 | 346 | interface SpecFunction { 347 | (spec?: Spec): void; 348 | } 349 | 350 | interface SuiteOrSpec { 351 | id: number; 352 | env: Env; 353 | description: string; 354 | queue: Queue; 355 | } 356 | 357 | interface Spec extends SuiteOrSpec { 358 | 359 | new (env: Env, suite: Suite, description: string): any; 360 | 361 | suite: Suite; 362 | 363 | afterCallbacks: SpecFunction[]; 364 | spies_: Spy[]; 365 | 366 | results_: NestedResults; 367 | matchersClass: Matchers; 368 | 369 | getFullName(): string; 370 | results(): NestedResults; 371 | log(arguments: any): any; 372 | runs(func: SpecFunction): Spec; 373 | addToQueue(block: Block): void; 374 | addMatcherResult(result: Result): void; 375 | expect(actual: any): any; 376 | waits(timeout: number): Spec; 377 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; 378 | fail(e?: any): void; 379 | getMatchersClass_(): Matchers; 380 | addMatchers(matchersPrototype: CustomMatcherFactories): void; 381 | finishCallback(): void; 382 | finish(onComplete?: () => void): void; 383 | after(doAfter: SpecFunction): void; 384 | execute(onComplete?: () => void): any; 385 | addBeforesAndAftersToQueue(): void; 386 | explodes(): void; 387 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; 388 | removeAllSpies(): void; 389 | } 390 | 391 | interface XSpec { 392 | id: number; 393 | runs(): void; 394 | } 395 | 396 | interface Suite extends SuiteOrSpec { 397 | 398 | new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; 399 | 400 | parentSuite: Suite; 401 | 402 | getFullName(): string; 403 | finish(onComplete?: () => void): void; 404 | beforeEach(beforeEachFunction: SpecFunction): void; 405 | afterEach(afterEachFunction: SpecFunction): void; 406 | beforeAll(beforeAllFunction: SpecFunction): void; 407 | afterAll(afterAllFunction: SpecFunction): void; 408 | results(): NestedResults; 409 | add(suiteOrSpec: SuiteOrSpec): void; 410 | specs(): Spec[]; 411 | suites(): Suite[]; 412 | children(): any[]; 413 | execute(onComplete?: () => void): void; 414 | } 415 | 416 | interface XSuite { 417 | execute(): void; 418 | } 419 | 420 | interface Spy { 421 | (...params: any[]): any; 422 | 423 | identity: string; 424 | and: SpyAnd; 425 | calls: Calls; 426 | mostRecentCall: { args: any[]; }; 427 | argsForCall: any[]; 428 | wasCalled: boolean; 429 | } 430 | 431 | interface SpyAnd { 432 | /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ 433 | callThrough(): Spy; 434 | /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ 435 | returnValue(val: any): Spy; 436 | /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ 437 | callFake(fn: Function): Spy; 438 | /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ 439 | throwError(msg: string): Spy; 440 | /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ 441 | stub(): Spy; 442 | } 443 | 444 | interface Calls { 445 | /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ 446 | any(): boolean; 447 | /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ 448 | count(): number; 449 | /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ 450 | argsFor(index: number): any[]; 451 | /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ 452 | allArgs(): any[]; 453 | /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ 454 | all(): CallInfo[]; 455 | /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ 456 | mostRecent(): CallInfo; 457 | /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ 458 | first(): CallInfo; 459 | /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ 460 | reset(): void; 461 | } 462 | 463 | interface CallInfo { 464 | /** The context (the this) for the call */ 465 | object: any; 466 | /** All arguments passed to the call */ 467 | args: any[]; 468 | /** The return value of the call */ 469 | returnValue: any; 470 | } 471 | 472 | interface Util { 473 | inherit(childClass: Function, parentClass: Function): any; 474 | formatException(e: any): any; 475 | htmlEscape(str: string): string; 476 | argsToArray(args: any): any; 477 | extend(destination: any, source: any): any; 478 | } 479 | 480 | interface JsApiReporter extends Reporter { 481 | 482 | started: boolean; 483 | finished: boolean; 484 | result: any; 485 | messages: any; 486 | 487 | new (): any; 488 | 489 | suites(): Suite[]; 490 | summarize_(suiteOrSpec: SuiteOrSpec): any; 491 | results(): any; 492 | resultsForSpec(specId: any): any; 493 | log(str: any): any; 494 | resultsForSpecs(specIds: any): any; 495 | summarizeResult_(result: any): any; 496 | } 497 | 498 | interface Jasmine { 499 | Spec: Spec; 500 | clock: Clock; 501 | util: Util; 502 | } 503 | 504 | export var HtmlReporter: HtmlReporter; 505 | export var HtmlSpecFilter: HtmlSpecFilter; 506 | export var DEFAULT_TIMEOUT_INTERVAL: number; 507 | } -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajan-g/angular2-google-recaptcha/c655cf518789fe4f0ce9ad77107df4f2243f65ba/typings/index.d.ts -------------------------------------------------------------------------------- /typings/main.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /typings/main/ambient/es6-shim/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/es6-shim/es6-shim.d.ts 3 | // Type definitions for es6-shim v0.31.2 4 | // Project: https://github.com/paulmillr/es6-shim 5 | // Definitions by: Ron Buckton 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | declare type PropertyKey = string | number | symbol; 9 | 10 | interface IteratorResult { 11 | done: boolean; 12 | value?: T; 13 | } 14 | 15 | interface IterableShim { 16 | /** 17 | * Shim for an ES6 iterable. Not intended for direct use by user code. 18 | */ 19 | "_es6-shim iterator_"(): Iterator; 20 | } 21 | 22 | interface Iterator { 23 | next(value?: any): IteratorResult; 24 | return?(value?: any): IteratorResult; 25 | throw?(e?: any): IteratorResult; 26 | } 27 | 28 | interface IterableIteratorShim extends IterableShim, Iterator { 29 | /** 30 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 31 | */ 32 | "_es6-shim iterator_"(): IterableIteratorShim; 33 | } 34 | 35 | interface StringConstructor { 36 | /** 37 | * Return the String value whose elements are, in order, the elements in the List elements. 38 | * If length is 0, the empty string is returned. 39 | */ 40 | fromCodePoint(...codePoints: number[]): string; 41 | 42 | /** 43 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 44 | * as such the first argument will be a well formed template call site object and the rest 45 | * parameter will contain the substitution values. 46 | * @param template A well-formed template string call site representation. 47 | * @param substitutions A set of substitution values. 48 | */ 49 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 50 | } 51 | 52 | interface String { 53 | /** 54 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 55 | * value of the UTF-16 encoded code point starting at the string element at position pos in 56 | * the String resulting from converting this object to a String. 57 | * If there is no element at that position, the result is undefined. 58 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 59 | */ 60 | codePointAt(pos: number): number; 61 | 62 | /** 63 | * Returns true if searchString appears as a substring of the result of converting this 64 | * object to a String, at one or more positions that are 65 | * greater than or equal to position; otherwise, returns false. 66 | * @param searchString search string 67 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 68 | */ 69 | includes(searchString: string, position?: number): boolean; 70 | 71 | /** 72 | * Returns true if the sequence of elements of searchString converted to a String is the 73 | * same as the corresponding elements of this object (converted to a String) starting at 74 | * endPosition – length(this). Otherwise returns false. 75 | */ 76 | endsWith(searchString: string, endPosition?: number): boolean; 77 | 78 | /** 79 | * Returns a String value that is made from count copies appended together. If count is 0, 80 | * T is the empty String is returned. 81 | * @param count number of copies to append 82 | */ 83 | repeat(count: number): string; 84 | 85 | /** 86 | * Returns true if the sequence of elements of searchString converted to a String is the 87 | * same as the corresponding elements of this object (converted to a String) starting at 88 | * position. Otherwise returns false. 89 | */ 90 | startsWith(searchString: string, position?: number): boolean; 91 | 92 | /** 93 | * Returns an HTML anchor element and sets the name attribute to the text value 94 | * @param name 95 | */ 96 | anchor(name: string): string; 97 | 98 | /** Returns a HTML element */ 99 | big(): string; 100 | 101 | /** Returns a HTML element */ 102 | blink(): string; 103 | 104 | /** Returns a HTML element */ 105 | bold(): string; 106 | 107 | /** Returns a HTML element */ 108 | fixed(): string 109 | 110 | /** Returns a HTML element and sets the color attribute value */ 111 | fontcolor(color: string): string 112 | 113 | /** Returns a HTML element and sets the size attribute value */ 114 | fontsize(size: number): string; 115 | 116 | /** Returns a HTML element and sets the size attribute value */ 117 | fontsize(size: string): string; 118 | 119 | /** Returns an HTML element */ 120 | italics(): string; 121 | 122 | /** Returns an HTML element and sets the href attribute value */ 123 | link(url: string): string; 124 | 125 | /** Returns a HTML element */ 126 | small(): string; 127 | 128 | /** Returns a HTML element */ 129 | strike(): string; 130 | 131 | /** Returns a HTML element */ 132 | sub(): string; 133 | 134 | /** Returns a HTML element */ 135 | sup(): string; 136 | 137 | /** 138 | * Shim for an ES6 iterable. Not intended for direct use by user code. 139 | */ 140 | "_es6-shim iterator_"(): IterableIteratorShim; 141 | } 142 | 143 | interface ArrayConstructor { 144 | /** 145 | * Creates an array from an array-like object. 146 | * @param arrayLike An array-like object to convert to an array. 147 | * @param mapfn A mapping function to call on every element of the array. 148 | * @param thisArg Value of 'this' used to invoke the mapfn. 149 | */ 150 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 151 | 152 | /** 153 | * Creates an array from an iterable object. 154 | * @param iterable An iterable object to convert to an array. 155 | * @param mapfn A mapping function to call on every element of the array. 156 | * @param thisArg Value of 'this' used to invoke the mapfn. 157 | */ 158 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 159 | 160 | /** 161 | * Creates an array from an array-like object. 162 | * @param arrayLike An array-like object to convert to an array. 163 | */ 164 | from(arrayLike: ArrayLike): Array; 165 | 166 | /** 167 | * Creates an array from an iterable object. 168 | * @param iterable An iterable object to convert to an array. 169 | */ 170 | from(iterable: IterableShim): Array; 171 | 172 | /** 173 | * Returns a new array from a set of elements. 174 | * @param items A set of elements to include in the new array object. 175 | */ 176 | of(...items: T[]): Array; 177 | } 178 | 179 | interface Array { 180 | /** 181 | * Returns the value of the first element in the array where predicate is true, and undefined 182 | * otherwise. 183 | * @param predicate find calls predicate once for each element of the array, in ascending 184 | * order, until it finds one where predicate returns true. If such an element is found, find 185 | * immediately returns that element value. Otherwise, find returns undefined. 186 | * @param thisArg If provided, it will be used as the this value for each invocation of 187 | * predicate. If it is not provided, undefined is used instead. 188 | */ 189 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 190 | 191 | /** 192 | * Returns the index of the first element in the array where predicate is true, and undefined 193 | * otherwise. 194 | * @param predicate find calls predicate once for each element of the array, in ascending 195 | * order, until it finds one where predicate returns true. If such an element is found, find 196 | * immediately returns that element value. Otherwise, find returns undefined. 197 | * @param thisArg If provided, it will be used as the this value for each invocation of 198 | * predicate. If it is not provided, undefined is used instead. 199 | */ 200 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 201 | 202 | /** 203 | * Returns the this object after filling the section identified by start and end with value 204 | * @param value value to fill array section with 205 | * @param start index to start filling the array at. If start is negative, it is treated as 206 | * length+start where length is the length of the array. 207 | * @param end index to stop filling the array at. If end is negative, it is treated as 208 | * length+end. 209 | */ 210 | fill(value: T, start?: number, end?: number): T[]; 211 | 212 | /** 213 | * Returns the this object after copying a section of the array identified by start and end 214 | * to the same array starting at position target 215 | * @param target If target is negative, it is treated as length+target where length is the 216 | * length of the array. 217 | * @param start If start is negative, it is treated as length+start. If end is negative, it 218 | * is treated as length+end. 219 | * @param end If not specified, length of the this object is used as its default value. 220 | */ 221 | copyWithin(target: number, start: number, end?: number): T[]; 222 | 223 | /** 224 | * Returns an array of key, value pairs for every entry in the array 225 | */ 226 | entries(): IterableIteratorShim<[number, T]>; 227 | 228 | /** 229 | * Returns an list of keys in the array 230 | */ 231 | keys(): IterableIteratorShim; 232 | 233 | /** 234 | * Returns an list of values in the array 235 | */ 236 | values(): IterableIteratorShim; 237 | 238 | /** 239 | * Shim for an ES6 iterable. Not intended for direct use by user code. 240 | */ 241 | "_es6-shim iterator_"(): IterableIteratorShim; 242 | } 243 | 244 | interface NumberConstructor { 245 | /** 246 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 247 | * that is representable as a Number value, which is approximately: 248 | * 2.2204460492503130808472633361816 x 10‍−‍16. 249 | */ 250 | EPSILON: number; 251 | 252 | /** 253 | * Returns true if passed value is finite. 254 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 255 | * number. Only finite values of the type number, result in true. 256 | * @param number A numeric value. 257 | */ 258 | isFinite(number: number): boolean; 259 | 260 | /** 261 | * Returns true if the value passed is an integer, false otherwise. 262 | * @param number A numeric value. 263 | */ 264 | isInteger(number: number): boolean; 265 | 266 | /** 267 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 268 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 269 | * to a number. Only values of the type number, that are also NaN, result in true. 270 | * @param number A numeric value. 271 | */ 272 | isNaN(number: number): boolean; 273 | 274 | /** 275 | * Returns true if the value passed is a safe integer. 276 | * @param number A numeric value. 277 | */ 278 | isSafeInteger(number: number): boolean; 279 | 280 | /** 281 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 282 | * a Number value. 283 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 284 | */ 285 | MAX_SAFE_INTEGER: number; 286 | 287 | /** 288 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 289 | * a Number value. 290 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 291 | */ 292 | MIN_SAFE_INTEGER: number; 293 | 294 | /** 295 | * Converts a string to a floating-point number. 296 | * @param string A string that contains a floating-point number. 297 | */ 298 | parseFloat(string: string): number; 299 | 300 | /** 301 | * Converts A string to an integer. 302 | * @param s A string to convert into a number. 303 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 304 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 305 | * All other strings are considered decimal. 306 | */ 307 | parseInt(string: string, radix?: number): number; 308 | } 309 | 310 | interface ObjectConstructor { 311 | /** 312 | * Copy the values of all of the enumerable own properties from one or more source objects to a 313 | * target object. Returns the target object. 314 | * @param target The target object to copy to. 315 | * @param sources One or more source objects to copy properties from. 316 | */ 317 | assign(target: any, ...sources: any[]): any; 318 | 319 | /** 320 | * Returns true if the values are the same value, false otherwise. 321 | * @param value1 The first value. 322 | * @param value2 The second value. 323 | */ 324 | is(value1: any, value2: any): boolean; 325 | 326 | /** 327 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 328 | * @param o The object to change its prototype. 329 | * @param proto The value of the new prototype or null. 330 | * @remarks Requires `__proto__` support. 331 | */ 332 | setPrototypeOf(o: any, proto: any): any; 333 | } 334 | 335 | interface RegExp { 336 | /** 337 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 338 | * The characters in this string are sequenced and concatenated in the following order: 339 | * 340 | * - "g" for global 341 | * - "i" for ignoreCase 342 | * - "m" for multiline 343 | * - "u" for unicode 344 | * - "y" for sticky 345 | * 346 | * If no flags are set, the value is the empty string. 347 | */ 348 | flags: string; 349 | } 350 | 351 | interface Math { 352 | /** 353 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 354 | * @param x A numeric expression. 355 | */ 356 | clz32(x: number): number; 357 | 358 | /** 359 | * Returns the result of 32-bit multiplication of two numbers. 360 | * @param x First number 361 | * @param y Second number 362 | */ 363 | imul(x: number, y: number): number; 364 | 365 | /** 366 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 367 | * @param x The numeric expression to test 368 | */ 369 | sign(x: number): number; 370 | 371 | /** 372 | * Returns the base 10 logarithm of a number. 373 | * @param x A numeric expression. 374 | */ 375 | log10(x: number): number; 376 | 377 | /** 378 | * Returns the base 2 logarithm of a number. 379 | * @param x A numeric expression. 380 | */ 381 | log2(x: number): number; 382 | 383 | /** 384 | * Returns the natural logarithm of 1 + x. 385 | * @param x A numeric expression. 386 | */ 387 | log1p(x: number): number; 388 | 389 | /** 390 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 391 | * the natural logarithms). 392 | * @param x A numeric expression. 393 | */ 394 | expm1(x: number): number; 395 | 396 | /** 397 | * Returns the hyperbolic cosine of a number. 398 | * @param x A numeric expression that contains an angle measured in radians. 399 | */ 400 | cosh(x: number): number; 401 | 402 | /** 403 | * Returns the hyperbolic sine of a number. 404 | * @param x A numeric expression that contains an angle measured in radians. 405 | */ 406 | sinh(x: number): number; 407 | 408 | /** 409 | * Returns the hyperbolic tangent of a number. 410 | * @param x A numeric expression that contains an angle measured in radians. 411 | */ 412 | tanh(x: number): number; 413 | 414 | /** 415 | * Returns the inverse hyperbolic cosine of a number. 416 | * @param x A numeric expression that contains an angle measured in radians. 417 | */ 418 | acosh(x: number): number; 419 | 420 | /** 421 | * Returns the inverse hyperbolic sine of a number. 422 | * @param x A numeric expression that contains an angle measured in radians. 423 | */ 424 | asinh(x: number): number; 425 | 426 | /** 427 | * Returns the inverse hyperbolic tangent of a number. 428 | * @param x A numeric expression that contains an angle measured in radians. 429 | */ 430 | atanh(x: number): number; 431 | 432 | /** 433 | * Returns the square root of the sum of squares of its arguments. 434 | * @param values Values to compute the square root for. 435 | * If no arguments are passed, the result is +0. 436 | * If there is only one argument, the result is the absolute value. 437 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 438 | * If any argument is NaN, the result is NaN. 439 | * If all arguments are either +0 or −0, the result is +0. 440 | */ 441 | hypot(...values: number[]): number; 442 | 443 | /** 444 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 445 | * If x is already an integer, the result is x. 446 | * @param x A numeric expression. 447 | */ 448 | trunc(x: number): number; 449 | 450 | /** 451 | * Returns the nearest single precision float representation of a number. 452 | * @param x A numeric expression. 453 | */ 454 | fround(x: number): number; 455 | 456 | /** 457 | * Returns an implementation-dependent approximation to the cube root of number. 458 | * @param x A numeric expression. 459 | */ 460 | cbrt(x: number): number; 461 | } 462 | 463 | interface PromiseLike { 464 | /** 465 | * Attaches callbacks for the resolution and/or rejection of the Promise. 466 | * @param onfulfilled The callback to execute when the Promise is resolved. 467 | * @param onrejected The callback to execute when the Promise is rejected. 468 | * @returns A Promise for the completion of which ever callback is executed. 469 | */ 470 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 471 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 472 | } 473 | 474 | /** 475 | * Represents the completion of an asynchronous operation 476 | */ 477 | interface Promise { 478 | /** 479 | * Attaches callbacks for the resolution and/or rejection of the Promise. 480 | * @param onfulfilled The callback to execute when the Promise is resolved. 481 | * @param onrejected The callback to execute when the Promise is rejected. 482 | * @returns A Promise for the completion of which ever callback is executed. 483 | */ 484 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 485 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 486 | 487 | /** 488 | * Attaches a callback for only the rejection of the Promise. 489 | * @param onrejected The callback to execute when the Promise is rejected. 490 | * @returns A Promise for the completion of the callback. 491 | */ 492 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 493 | catch(onrejected?: (reason: any) => void): Promise; 494 | } 495 | 496 | interface PromiseConstructor { 497 | /** 498 | * A reference to the prototype. 499 | */ 500 | prototype: Promise; 501 | 502 | /** 503 | * Creates a new Promise. 504 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 505 | * a resolve callback used resolve the promise with a value or the result of another promise, 506 | * and a reject callback used to reject the promise with a provided reason or error. 507 | */ 508 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 509 | 510 | /** 511 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 512 | * resolve, or rejected when any Promise is rejected. 513 | * @param values An array of Promises. 514 | * @returns A new Promise. 515 | */ 516 | all(values: IterableShim>): Promise; 517 | 518 | /** 519 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 520 | * or rejected. 521 | * @param values An array of Promises. 522 | * @returns A new Promise. 523 | */ 524 | race(values: IterableShim>): Promise; 525 | 526 | /** 527 | * Creates a new rejected promise for the provided reason. 528 | * @param reason The reason the promise was rejected. 529 | * @returns A new rejected Promise. 530 | */ 531 | reject(reason: any): Promise; 532 | 533 | /** 534 | * Creates a new rejected promise for the provided reason. 535 | * @param reason The reason the promise was rejected. 536 | * @returns A new rejected Promise. 537 | */ 538 | reject(reason: any): Promise; 539 | 540 | /** 541 | * Creates a new resolved promise for the provided value. 542 | * @param value A promise. 543 | * @returns A promise whose internal state matches the provided promise. 544 | */ 545 | resolve(value: T | PromiseLike): Promise; 546 | 547 | /** 548 | * Creates a new resolved promise . 549 | * @returns A resolved promise. 550 | */ 551 | resolve(): Promise; 552 | } 553 | 554 | declare var Promise: PromiseConstructor; 555 | 556 | interface Map { 557 | clear(): void; 558 | delete(key: K): boolean; 559 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 560 | get(key: K): V; 561 | has(key: K): boolean; 562 | set(key: K, value?: V): Map; 563 | size: number; 564 | entries(): IterableIteratorShim<[K, V]>; 565 | keys(): IterableIteratorShim; 566 | values(): IterableIteratorShim; 567 | } 568 | 569 | interface MapConstructor { 570 | new (): Map; 571 | new (iterable: IterableShim<[K, V]>): Map; 572 | prototype: Map; 573 | } 574 | 575 | declare var Map: MapConstructor; 576 | 577 | interface Set { 578 | add(value: T): Set; 579 | clear(): void; 580 | delete(value: T): boolean; 581 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 582 | has(value: T): boolean; 583 | size: number; 584 | entries(): IterableIteratorShim<[T, T]>; 585 | keys(): IterableIteratorShim; 586 | values(): IterableIteratorShim; 587 | } 588 | 589 | interface SetConstructor { 590 | new (): Set; 591 | new (iterable: IterableShim): Set; 592 | prototype: Set; 593 | } 594 | 595 | declare var Set: SetConstructor; 596 | 597 | interface WeakMap { 598 | delete(key: K): boolean; 599 | get(key: K): V; 600 | has(key: K): boolean; 601 | set(key: K, value?: V): WeakMap; 602 | } 603 | 604 | interface WeakMapConstructor { 605 | new (): WeakMap; 606 | new (iterable: IterableShim<[K, V]>): WeakMap; 607 | prototype: WeakMap; 608 | } 609 | 610 | declare var WeakMap: WeakMapConstructor; 611 | 612 | interface WeakSet { 613 | add(value: T): WeakSet; 614 | delete(value: T): boolean; 615 | has(value: T): boolean; 616 | } 617 | 618 | interface WeakSetConstructor { 619 | new (): WeakSet; 620 | new (iterable: IterableShim): WeakSet; 621 | prototype: WeakSet; 622 | } 623 | 624 | declare var WeakSet: WeakSetConstructor; 625 | 626 | declare namespace Reflect { 627 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 628 | function construct(target: Function, argumentsList: ArrayLike): any; 629 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 630 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 631 | function enumerate(target: any): IterableIteratorShim; 632 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 633 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 634 | function getPrototypeOf(target: any): any; 635 | function has(target: any, propertyKey: PropertyKey): boolean; 636 | function isExtensible(target: any): boolean; 637 | function ownKeys(target: any): Array; 638 | function preventExtensions(target: any): boolean; 639 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 640 | function setPrototypeOf(target: any, proto: any): boolean; 641 | } 642 | 643 | declare module "es6-shim" { 644 | var String: StringConstructor; 645 | var Array: ArrayConstructor; 646 | var Number: NumberConstructor; 647 | var Math: Math; 648 | var Object: ObjectConstructor; 649 | var Map: MapConstructor; 650 | var Set: SetConstructor; 651 | var WeakMap: WeakMapConstructor; 652 | var WeakSet: WeakSetConstructor; 653 | var Promise: PromiseConstructor; 654 | namespace Reflect { 655 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 656 | function construct(target: Function, argumentsList: ArrayLike): any; 657 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 658 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 659 | function enumerate(target: any): Iterator; 660 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 661 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 662 | function getPrototypeOf(target: any): any; 663 | function has(target: any, propertyKey: PropertyKey): boolean; 664 | function isExtensible(target: any): boolean; 665 | function ownKeys(target: any): Array; 666 | function preventExtensions(target: any): boolean; 667 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 668 | function setPrototypeOf(target: any, proto: any): boolean; 669 | } 670 | } -------------------------------------------------------------------------------- /typings/main/ambient/jasmine/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5c182b9af717f73146399c2485f70f1e2ac0ff2b/jasmine/jasmine.d.ts 3 | // Type definitions for Jasmine 2.2 4 | // Project: http://jasmine.github.io/ 5 | // Definitions by: Boris Yankov , Theodore Brown , David Pärsson 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts 10 | 11 | declare function describe(description: string, specDefinitions: () => void): void; 12 | declare function fdescribe(description: string, specDefinitions: () => void): void; 13 | declare function xdescribe(description: string, specDefinitions: () => void): void; 14 | 15 | declare function it(expectation: string, assertion?: () => void, timeout?: number): void; 16 | declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 17 | declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; 18 | declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 19 | declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; 20 | declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; 21 | 22 | /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ 23 | declare function pending(reason?: string): void; 24 | 25 | declare function beforeEach(action: () => void, timeout?: number): void; 26 | declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; 27 | declare function afterEach(action: () => void, timeout?: number): void; 28 | declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; 29 | 30 | declare function beforeAll(action: () => void, timeout?: number): void; 31 | declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; 32 | declare function afterAll(action: () => void, timeout?: number): void; 33 | declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; 34 | 35 | declare function expect(spy: Function): jasmine.Matchers; 36 | declare function expect(actual: any): jasmine.Matchers; 37 | 38 | declare function fail(e?: any): void; 39 | /** Action method that should be called when the async work is complete */ 40 | interface DoneFn extends Function { 41 | (): void; 42 | 43 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ 44 | fail: (message?: Error|string) => void; 45 | } 46 | 47 | declare function spyOn(object: any, method: string): jasmine.Spy; 48 | 49 | declare function runs(asyncMethod: Function): void; 50 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; 51 | declare function waits(timeout?: number): void; 52 | 53 | declare namespace jasmine { 54 | 55 | var clock: () => Clock; 56 | 57 | function any(aclass: any): Any; 58 | function anything(): Any; 59 | function arrayContaining(sample: any[]): ArrayContaining; 60 | function objectContaining(sample: any): ObjectContaining; 61 | function createSpy(name: string, originalFn?: Function): Spy; 62 | function createSpyObj(baseName: string, methodNames: any[]): any; 63 | function createSpyObj(baseName: string, methodNames: any[]): T; 64 | function pp(value: any): string; 65 | function getEnv(): Env; 66 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 67 | function addMatchers(matchers: CustomMatcherFactories): void; 68 | function stringMatching(str: string): Any; 69 | function stringMatching(str: RegExp): Any; 70 | 71 | interface Any { 72 | 73 | new (expectedClass: any): any; 74 | 75 | jasmineMatches(other: any): boolean; 76 | jasmineToString(): string; 77 | } 78 | 79 | // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() 80 | interface ArrayLike { 81 | length: number; 82 | [n: number]: T; 83 | } 84 | 85 | interface ArrayContaining { 86 | new (sample: any[]): any; 87 | 88 | asymmetricMatch(other: any): boolean; 89 | jasmineToString(): string; 90 | } 91 | 92 | interface ObjectContaining { 93 | new (sample: any): any; 94 | 95 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; 96 | jasmineToString(): string; 97 | } 98 | 99 | interface Block { 100 | 101 | new (env: Env, func: SpecFunction, spec: Spec): any; 102 | 103 | execute(onComplete: () => void): void; 104 | } 105 | 106 | interface WaitsBlock extends Block { 107 | new (env: Env, timeout: number, spec: Spec): any; 108 | } 109 | 110 | interface WaitsForBlock extends Block { 111 | new (env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any; 112 | } 113 | 114 | interface Clock { 115 | install(): void; 116 | uninstall(): void; 117 | /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ 118 | tick(ms: number): void; 119 | mockDate(date?: Date): void; 120 | } 121 | 122 | interface CustomEqualityTester { 123 | (first: any, second: any): boolean; 124 | } 125 | 126 | interface CustomMatcher { 127 | compare(actual: T, expected: T): CustomMatcherResult; 128 | compare(actual: any, expected: any): CustomMatcherResult; 129 | } 130 | 131 | interface CustomMatcherFactory { 132 | (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; 133 | } 134 | 135 | interface CustomMatcherFactories { 136 | [index: string]: CustomMatcherFactory; 137 | } 138 | 139 | interface CustomMatcherResult { 140 | pass: boolean; 141 | message?: string; 142 | } 143 | 144 | interface MatchersUtil { 145 | equals(a: any, b: any, customTesters?: Array): boolean; 146 | contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; 147 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; 148 | } 149 | 150 | interface Env { 151 | setTimeout: any; 152 | clearTimeout: void; 153 | setInterval: any; 154 | clearInterval: void; 155 | updateInterval: number; 156 | 157 | currentSpec: Spec; 158 | 159 | matchersClass: Matchers; 160 | 161 | version(): any; 162 | versionString(): string; 163 | nextSpecId(): number; 164 | addReporter(reporter: Reporter): void; 165 | execute(): void; 166 | describe(description: string, specDefinitions: () => void): Suite; 167 | // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these 168 | beforeEach(beforeEachFunction: () => void): void; 169 | beforeAll(beforeAllFunction: () => void): void; 170 | currentRunner(): Runner; 171 | afterEach(afterEachFunction: () => void): void; 172 | afterAll(afterAllFunction: () => void): void; 173 | xdescribe(desc: string, specDefinitions: () => void): XSuite; 174 | it(description: string, func: () => void): Spec; 175 | // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these 176 | xit(desc: string, func: () => void): XSpec; 177 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean; 178 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 179 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; 180 | contains_(haystack: any, needle: any): boolean; 181 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void; 182 | addMatchers(matchers: CustomMatcherFactories): void; 183 | specFilter(spec: Spec): boolean; 184 | } 185 | 186 | interface FakeTimer { 187 | 188 | new (): any; 189 | 190 | reset(): void; 191 | tick(millis: number): void; 192 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void; 193 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void; 194 | } 195 | 196 | interface HtmlReporter { 197 | new (): any; 198 | } 199 | 200 | interface HtmlSpecFilter { 201 | new (): any; 202 | } 203 | 204 | interface Result { 205 | type: string; 206 | } 207 | 208 | interface NestedResults extends Result { 209 | description: string; 210 | 211 | totalCount: number; 212 | passedCount: number; 213 | failedCount: number; 214 | 215 | skipped: boolean; 216 | 217 | rollupCounts(result: NestedResults): void; 218 | log(values: any): void; 219 | getItems(): Result[]; 220 | addResult(result: Result): void; 221 | passed(): boolean; 222 | } 223 | 224 | interface MessageResult extends Result { 225 | values: any; 226 | trace: Trace; 227 | } 228 | 229 | interface ExpectationResult extends Result { 230 | matcherName: string; 231 | passed(): boolean; 232 | expected: any; 233 | actual: any; 234 | message: string; 235 | trace: Trace; 236 | } 237 | 238 | interface Trace { 239 | name: string; 240 | message: string; 241 | stack: any; 242 | } 243 | 244 | interface PrettyPrinter { 245 | 246 | new (): any; 247 | 248 | format(value: any): void; 249 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void; 250 | emitScalar(value: any): void; 251 | emitString(value: string): void; 252 | emitArray(array: any[]): void; 253 | emitObject(obj: any): void; 254 | append(value: any): void; 255 | } 256 | 257 | interface StringPrettyPrinter extends PrettyPrinter { 258 | } 259 | 260 | interface Queue { 261 | 262 | new (env: any): any; 263 | 264 | env: Env; 265 | ensured: boolean[]; 266 | blocks: Block[]; 267 | running: boolean; 268 | index: number; 269 | offset: number; 270 | abort: boolean; 271 | 272 | addBefore(block: Block, ensure?: boolean): void; 273 | add(block: any, ensure?: boolean): void; 274 | insertNext(block: any, ensure?: boolean): void; 275 | start(onComplete?: () => void): void; 276 | isRunning(): boolean; 277 | next_(): void; 278 | results(): NestedResults; 279 | } 280 | 281 | interface Matchers { 282 | 283 | new (env: Env, actual: any, spec: Env, isNot?: boolean): any; 284 | 285 | env: Env; 286 | actual: any; 287 | spec: Env; 288 | isNot?: boolean; 289 | message(): any; 290 | 291 | toBe(expected: any, expectationFailOutput?: any): boolean; 292 | toEqual(expected: any, expectationFailOutput?: any): boolean; 293 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; 294 | toBeDefined(expectationFailOutput?: any): boolean; 295 | toBeUndefined(expectationFailOutput?: any): boolean; 296 | toBeNull(expectationFailOutput?: any): boolean; 297 | toBeNaN(): boolean; 298 | toBeTruthy(expectationFailOutput?: any): boolean; 299 | toBeFalsy(expectationFailOutput?: any): boolean; 300 | toHaveBeenCalled(): boolean; 301 | toHaveBeenCalledWith(...params: any[]): boolean; 302 | toHaveBeenCalledTimes(expected: number): boolean; 303 | toContain(expected: any, expectationFailOutput?: any): boolean; 304 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean; 305 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; 306 | toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; 307 | toThrow(expected?: any): boolean; 308 | toThrowError(message?: string | RegExp): boolean; 309 | toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; 310 | not: Matchers; 311 | 312 | Any: Any; 313 | } 314 | 315 | interface Reporter { 316 | reportRunnerStarting(runner: Runner): void; 317 | reportRunnerResults(runner: Runner): void; 318 | reportSuiteResults(suite: Suite): void; 319 | reportSpecStarting(spec: Spec): void; 320 | reportSpecResults(spec: Spec): void; 321 | log(str: string): void; 322 | } 323 | 324 | interface MultiReporter extends Reporter { 325 | addReporter(reporter: Reporter): void; 326 | } 327 | 328 | interface Runner { 329 | 330 | new (env: Env): any; 331 | 332 | execute(): void; 333 | beforeEach(beforeEachFunction: SpecFunction): void; 334 | afterEach(afterEachFunction: SpecFunction): void; 335 | beforeAll(beforeAllFunction: SpecFunction): void; 336 | afterAll(afterAllFunction: SpecFunction): void; 337 | finishCallback(): void; 338 | addSuite(suite: Suite): void; 339 | add(block: Block): void; 340 | specs(): Spec[]; 341 | suites(): Suite[]; 342 | topLevelSuites(): Suite[]; 343 | results(): NestedResults; 344 | } 345 | 346 | interface SpecFunction { 347 | (spec?: Spec): void; 348 | } 349 | 350 | interface SuiteOrSpec { 351 | id: number; 352 | env: Env; 353 | description: string; 354 | queue: Queue; 355 | } 356 | 357 | interface Spec extends SuiteOrSpec { 358 | 359 | new (env: Env, suite: Suite, description: string): any; 360 | 361 | suite: Suite; 362 | 363 | afterCallbacks: SpecFunction[]; 364 | spies_: Spy[]; 365 | 366 | results_: NestedResults; 367 | matchersClass: Matchers; 368 | 369 | getFullName(): string; 370 | results(): NestedResults; 371 | log(arguments: any): any; 372 | runs(func: SpecFunction): Spec; 373 | addToQueue(block: Block): void; 374 | addMatcherResult(result: Result): void; 375 | expect(actual: any): any; 376 | waits(timeout: number): Spec; 377 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; 378 | fail(e?: any): void; 379 | getMatchersClass_(): Matchers; 380 | addMatchers(matchersPrototype: CustomMatcherFactories): void; 381 | finishCallback(): void; 382 | finish(onComplete?: () => void): void; 383 | after(doAfter: SpecFunction): void; 384 | execute(onComplete?: () => void): any; 385 | addBeforesAndAftersToQueue(): void; 386 | explodes(): void; 387 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; 388 | removeAllSpies(): void; 389 | } 390 | 391 | interface XSpec { 392 | id: number; 393 | runs(): void; 394 | } 395 | 396 | interface Suite extends SuiteOrSpec { 397 | 398 | new (env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any; 399 | 400 | parentSuite: Suite; 401 | 402 | getFullName(): string; 403 | finish(onComplete?: () => void): void; 404 | beforeEach(beforeEachFunction: SpecFunction): void; 405 | afterEach(afterEachFunction: SpecFunction): void; 406 | beforeAll(beforeAllFunction: SpecFunction): void; 407 | afterAll(afterAllFunction: SpecFunction): void; 408 | results(): NestedResults; 409 | add(suiteOrSpec: SuiteOrSpec): void; 410 | specs(): Spec[]; 411 | suites(): Suite[]; 412 | children(): any[]; 413 | execute(onComplete?: () => void): void; 414 | } 415 | 416 | interface XSuite { 417 | execute(): void; 418 | } 419 | 420 | interface Spy { 421 | (...params: any[]): any; 422 | 423 | identity: string; 424 | and: SpyAnd; 425 | calls: Calls; 426 | mostRecentCall: { args: any[]; }; 427 | argsForCall: any[]; 428 | wasCalled: boolean; 429 | } 430 | 431 | interface SpyAnd { 432 | /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ 433 | callThrough(): Spy; 434 | /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ 435 | returnValue(val: any): Spy; 436 | /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ 437 | callFake(fn: Function): Spy; 438 | /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ 439 | throwError(msg: string): Spy; 440 | /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ 441 | stub(): Spy; 442 | } 443 | 444 | interface Calls { 445 | /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/ 446 | any(): boolean; 447 | /** By chaining the spy with calls.count(), will return the number of times the spy was called **/ 448 | count(): number; 449 | /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/ 450 | argsFor(index: number): any[]; 451 | /** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/ 452 | allArgs(): any[]; 453 | /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/ 454 | all(): CallInfo[]; 455 | /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/ 456 | mostRecent(): CallInfo; 457 | /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/ 458 | first(): CallInfo; 459 | /** By chaining the spy with calls.reset(), will clears all tracking for a spy **/ 460 | reset(): void; 461 | } 462 | 463 | interface CallInfo { 464 | /** The context (the this) for the call */ 465 | object: any; 466 | /** All arguments passed to the call */ 467 | args: any[]; 468 | /** The return value of the call */ 469 | returnValue: any; 470 | } 471 | 472 | interface Util { 473 | inherit(childClass: Function, parentClass: Function): any; 474 | formatException(e: any): any; 475 | htmlEscape(str: string): string; 476 | argsToArray(args: any): any; 477 | extend(destination: any, source: any): any; 478 | } 479 | 480 | interface JsApiReporter extends Reporter { 481 | 482 | started: boolean; 483 | finished: boolean; 484 | result: any; 485 | messages: any; 486 | 487 | new (): any; 488 | 489 | suites(): Suite[]; 490 | summarize_(suiteOrSpec: SuiteOrSpec): any; 491 | results(): any; 492 | resultsForSpec(specId: any): any; 493 | log(str: any): any; 494 | resultsForSpecs(specIds: any): any; 495 | summarizeResult_(result: any): any; 496 | } 497 | 498 | interface Jasmine { 499 | Spec: Spec; 500 | clock: Clock; 501 | util: Util; 502 | } 503 | 504 | export var HtmlReporter: HtmlReporter; 505 | export var HtmlSpecFilter: HtmlSpecFilter; 506 | export var DEFAULT_TIMEOUT_INTERVAL: number; 507 | } --------------------------------------------------------------------------------