X Tutup
Skip to content

Commit 80a5e47

Browse files
committed
docs(*): Document a lot more symbols that are missing comments in our generated docs.
1 parent 5a04ffe commit 80a5e47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+793
-22
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {Component} from 'angular2/core';
2+
import {MinLengthValidator, MaxLengthValidator} from 'angular2/common';
3+
4+
// #docregion min
5+
@Component({
6+
selector: 'min-cmp',
7+
directives: [MinLengthValidator],
8+
template: `
9+
<form>
10+
<p>Year: <input ngControl="year" minlength="2"></p>
11+
</form>
12+
`
13+
})
14+
class MinLengthTestComponent {
15+
}
16+
// #enddocregion
17+
18+
// #docregion max
19+
@Component({
20+
selector: 'max-cmp',
21+
directives: [MaxLengthValidator],
22+
template: `
23+
<form>
24+
<p>Year: <input ngControl="year" maxlength="4"></p>
25+
</form>
26+
`
27+
})
28+
class MaxLengthTestComponent {
29+
}
30+
// #enddocregion
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {provide} from 'angular2/core';
2+
import {bootstrap} from 'angular2/bootstrap';
3+
import {UrlResolver} from 'angular2/compiler';
4+
5+
var MyApp;
6+
7+
// #docregion url_resolver
8+
class MyUrlResolver extends UrlResolver {
9+
resolve(baseUrl: string, url: string): string {
10+
// Serve CSS files from a special CDN.
11+
if (url.substr(-4) === '.css') {
12+
return super.resolve('http://cdn.myapp.com/css/', url);
13+
}
14+
return super.resolve(baseUrl, url);
15+
}
16+
}
17+
18+
bootstrap(MyApp, [provide(UrlResolver, {useClass: MyUrlResolver})]);
19+
// #enddocregion
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {DebugElement, Scope} from 'angular2/core';
2+
3+
var debugElement: DebugElement;
4+
var predicate;
5+
6+
// #docregion scope_all
7+
debugElement.query(predicate, Scope.all);
8+
// #enddocregion
9+
10+
// #docregion scope_light
11+
debugElement.query(predicate, Scope.light);
12+
// #enddocregion
13+
14+
// #docregion scope_view
15+
debugElement.query(predicate, Scope.view);
16+
// #enddocregion
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {By} from 'angular2/platform/browser';
2+
import {DebugElement, Scope} from 'angular2/core';
3+
4+
var debugElement: DebugElement;
5+
class MyDirective {}
6+
7+
// #docregion by_all
8+
debugElement.query(By.all(), Scope.all);
9+
// #enddocregion
10+
11+
// #docregion by_css
12+
debugElement.query(By.css('[attribute]'), Scope.all);
13+
// #enddocregion
14+
15+
// #docregion by_directive
16+
debugElement.query(By.directive(MyDirective), Scope.all);
17+
// #enddocregion
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from 'angular2/core';
2+
import {bootstrap, ELEMENT_PROBE_PROVIDERS} from 'angular2/platform/browser';
3+
4+
@Component({selector: 'my-component'})
5+
class MyAppComponent {
6+
}
7+
8+
// #docregion providers
9+
bootstrap(MyAppComponent, [ELEMENT_PROBE_PROVIDERS]);
10+
// #enddocregion
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {describe, it, fakeAsync, expect, tick, clearPendingTimers} from 'angular2/testing';
2+
3+
// #docregion basic
4+
describe('this test', () => {
5+
it('looks async but is synchronous', <any>fakeAsync((): void => {
6+
var flag = false;
7+
setTimeout(() => { flag = true; }, 100);
8+
expect(flag).toBe(false);
9+
tick(50);
10+
expect(flag).toBe(false);
11+
tick(50);
12+
expect(flag).toBe(true);
13+
}));
14+
});
15+
// #enddocregion
16+
17+
// #docregion pending
18+
describe('this test', () => {
19+
it('aborts a timer', <any>fakeAsync((): void => {
20+
// This timer is scheduled but doesn't need to complete for the
21+
// test to pass (maybe it's a timeout for some operation).
22+
// Leaving it will cause the test to fail...
23+
setTimeout(() => {}, 100);
24+
25+
// Unless we clean it up first.
26+
clearPendingTimers();
27+
}));
28+
});
29+
// #enddocregion
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {expect} from 'angular2/testing';
2+
3+
var value: any;
4+
var element: any;
5+
var exception: any;
6+
7+
abstract class OtherClass {}
8+
class SomeClass {}
9+
10+
// #docregion toBePromise
11+
expect(value).toBePromise();
12+
// #enddocregion
13+
14+
// #docregion toBeAnInstanceOf
15+
expect(value).toBeAnInstanceOf(SomeClass);
16+
// #enddocregion
17+
18+
// #docregion toHaveText
19+
expect(element).toHaveText('Hello world!');
20+
// #enddocregion
21+
22+
// #docregion toHaveCssClass
23+
expect(element).toHaveCssClass('current');
24+
// #enddocregion
25+
26+
// #docregion toHaveCssStyle
27+
expect(element).toHaveCssStyle({width: '100px', height: 'auto'});
28+
// #enddocregion
29+
30+
// #docregion toContainError
31+
expect(exception).toContainError('Failed to load');
32+
// #enddocregion
33+
34+
// #docregion toThrowErrorWith
35+
expect(() => { throw 'Failed to load'; }).toThrowErrorWith('Failed to load');
36+
// #enddocregion
37+
38+
// #docregion toImplement
39+
expect(SomeClass).toImplement(OtherClass);
40+
// #enddocregion

modules/angular2/http.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ export const HTTP_PROVIDERS: any[] = [
166166
];
167167

168168
/**
169+
* See {@link HTTP_PROVIDERS} instead.
170+
*
169171
* @deprecated
170172
*/
171173
export const HTTP_BINDINGS = HTTP_PROVIDERS;
@@ -291,6 +293,8 @@ export const JSONP_PROVIDERS: any[] = [
291293
];
292294

293295
/**
296+
* See {@link JSONP_PROVIDERS} instead.
297+
*
294298
* @deprecated
295299
*/
296300
export const JSON_BINDINGS = JSONP_PROVIDERS;

modules/angular2/router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ export const ROUTER_PROVIDERS: any[] = CONST_EXPR([
9898
]);
9999

100100
/**
101+
* Use {@link ROUTER_PROVIDERS} instead.
102+
*
101103
* @deprecated
102104
*/
103105
export const ROUTER_BINDINGS = ROUTER_PROVIDERS;

modules/angular2/src/common/directives/observable_list_diff.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
// I need to be here to make TypeScript think this is a module.
44
import {} from 'angular2/src/facade/lang';
5+
6+
/**
7+
* This module exists in Dart, but not in Typescript. This exported symbol
8+
* is only here to help Typescript think this is a module.
9+
*/
510
export var workaround_empty_observable_list_diff: any;

0 commit comments

Comments
 (0)
X Tutup