Skip to content

Commit 2b4d30d

Browse files
committed
chore(analysis): analyze everything in lib folders recursively; fix existing warnings
1 parent 3dc4df2 commit 2b4d30d

File tree

10 files changed

+35
-35
lines changed

10 files changed

+35
-35
lines changed

modules/angular2/src/facade/browser.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export 'dart:html' show
1111
location,
1212
window,
1313
Element,
14-
Node;
14+
Node,
15+
KeyboardEvent,
16+
Event;
1517

1618
final _gc = context['gc'];
1719

modules/angular2_material/src/components/checkbox/checkbox.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Component, View, Attribute, PropertySetter} from 'angular2/angular2';
22
import {isPresent} from 'angular2/src/facade/lang';
3-
import {KeyCodes} from 'angular2_material/src/core/constants'
3+
import {KEY_SPACE} from 'angular2_material/src/core/constants'
4+
import {KeyboardEvent} from 'angular2/src/facade/browser';
45

56
@Component({
67
selector: 'md-checkbox',
@@ -20,6 +21,9 @@ export class MdCheckbox {
2021
/** Whether this checkbox is checked. */
2122
checked_: boolean;
2223

24+
/** Whether this checkbox is disabled. */
25+
disabled_: boolean;
26+
2327
/** Setter for `aria-checked` attribute. */
2428
ariaCheckedSetter: Function;
2529

@@ -59,7 +63,7 @@ export class MdCheckbox {
5963
}
6064

6165
onKeydown(event: KeyboardEvent) {
62-
if (event.keyCode == KeyCodes.SPACE) {
66+
if (event.keyCode == KEY_SPACE) {
6367
event.preventDefault();
6468
this.toggle(event);
6569
}

modules/angular2_material/src/components/grid_list/grid_list.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {Component, View, onAllChangesDone, Parent} from 'angular2/angular2';
22
import {onDestroy, onChange} from 'angular2/src/core/annotations/annotations';
33
import {ListWrapper} from 'angular2/src/facade/collection';
4-
import {CONST} from 'angular2/src/facade/lang';
5-
import {isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
4+
import {isPresent, isString, NumberWrapper, stringify} from 'angular2/src/facade/lang';
65
import {PropertySetter} from 'angular2/src/core/annotations/di';
76

87
// TODO(jelbourn): Set appropriate aria attributes for grid list elements.
@@ -20,7 +19,7 @@ import {PropertySetter} from 'angular2/src/core/annotations/di';
2019
})
2120
export class MdGridList {
2221
/** List of tiles that are being rendered. */
23-
tiles: Array<MdGridTile>;
22+
tiles: List<MdGridTile>;
2423

2524
/** Number of columns being rendered. Can be either string or number */
2625
cols;
@@ -37,8 +36,8 @@ export class MdGridList {
3736
/** The amount of space between tiles. This will be something like '5px' or '2em'. */
3837
gutterSize: string;
3938

40-
/** Array used to track the amount of space available. */
41-
spaceTracker: Array<number>;
39+
/** List used to track the amount of space available. */
40+
spaceTracker: List<number>;
4241

4342
constructor() {
4443
this.tiles = [];
@@ -144,8 +143,8 @@ export class MdGridList {
144143
switch (this.rowHeightMode) {
145144
case 'fixed':
146145
// In fixed mode, simply use the given row height.
147-
tileStyle.top = getTilePosition(this.fixedRowHeight, rowIndex);
148-
tileStyle.height = getTileSize(this.fixedRowHeight, tile.rowspan);
146+
tileStyle.top = getTilePosition(stringify(this.fixedRowHeight), rowIndex);
147+
tileStyle.height = getTileSize(stringify(this.fixedRowHeight), tile.rowspan);
149148
break;
150149

151150
case 'ratio':
@@ -160,8 +159,6 @@ export class MdGridList {
160159
break;
161160

162161
case 'fit':
163-
var percentHeightPerTile;
164-
165162
break;
166163
}
167164

modules/angular2_material/src/components/input/input.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {Decorator} from 'angular2/angular2';
2-
import {PropertySetter} from 'angular2/src/core/annotations/di';
32

43
@Decorator({
54
selector: 'md-input-container input'

modules/angular2_material/src/components/progress-circular/progress_circular.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {Component, View} from 'angular2/angular2';
2-
import {isPresent} from 'angular2/src/facade/lang';
3-
42

53
@Component({
64
selector: 'md-progress-circular'

modules/angular2_material/src/components/radio/radio_button.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {Component, View, Parent, Ancestor, Attribute, PropertySetter} from 'angular2/angular2';
22
import {Optional} from 'angular2/src/di/annotations';
33
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher'
4-
import {MdTheme} from 'angular2_material/src/core/theme'
54
import {onChange} from 'angular2/src/core/annotations/annotations';
65
import {isPresent, StringWrapper} from 'angular2/src/facade/lang';
76
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
8-
import {Math} from 'angular2/src/facade/math';
97
import {ListWrapper} from 'angular2/src/facade/collection';
8+
import {KEY_UP, KEY_DOWN, KEY_SPACE} from 'angular2_material/src/core/constants'
9+
import {Event, KeyboardEvent} from 'angular2/src/facade/browser';
1010

1111
// TODO(jelbourn): Behaviors to test
1212
// Disabled radio don't select
@@ -159,14 +159,14 @@ export class MdRadioButton {
159159

160160
this.checked = true;
161161

162-
if (this.radioGroup) {
162+
if (isPresent(this.radioGroup)) {
163163
this.radioGroup.updateValue(this.value, this.id);
164164
}
165165
}
166166

167167
/** Handles pressing the space key to select this focused radio button. */
168168
onKeydown(event: KeyboardEvent) {
169-
if (event.keyCode == KeyCodes.SPACE) {
169+
if (event.keyCode == KEY_SPACE) {
170170
event.preventDefault();
171171
this.select(event);
172172
}
@@ -293,13 +293,11 @@ export class MdRadioGroup {
293293
}
294294

295295
switch (event.keyCode) {
296-
//case KeyCodes.UP:
297-
case 38:
296+
case KEY_UP:
298297
this.stepSelectedRadio(-1);
299298
event.preventDefault();
300299
break;
301-
//case KeyCodes.DOWN:
302-
case 40:
300+
case KEY_DOWN:
303301
this.stepSelectedRadio(1);
304302
event.preventDefault();
305303
break;

modules/angular2_material/src/components/radio/radio_dispatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import {ListWrapper} from 'angular2/src/facade/collection';
1+
import {List, ListWrapper} from 'angular2/src/facade/collection';
22

33
/**
44
* Class for radio buttons to coordinate unique selection based on name.
55
* Indended to be consumed as an Angular service.
66
*/
77
export class MdRadioDispatcher {
88
// TODO(jelbourn): Change this to TypeScript syntax when supported.
9-
listeners_: Array<Function>;
9+
listeners_: List<Function>;
1010

1111
constructor() {
1212
this.listeners_ = [];

modules/angular2_material/src/components/switcher/switch.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Component, View, Attribute, PropertySetter} from 'angular2/angular2';
22
import {isPresent} from 'angular2/src/facade/lang';
3-
import {KeyCodes} from 'angular2_material/src/core/constants'
3+
import {KEY_SPACE} from 'angular2_material/src/core/constants'
4+
import {KeyboardEvent} from 'angular2/src/facade/browser';
45

56
// TODO(jelbourn): without gesture support, this is identical to MdCheckbox.
67

@@ -22,6 +23,9 @@ export class MdSwitch {
2223
/** Whether this switch is checked. */
2324
checked_: boolean;
2425

26+
/** Whether this switch is disabled. */
27+
disabled_: boolean;
28+
2529
/** Setter for `aria-checked` attribute. */
2630
ariaCheckedSetter: Function;
2731

@@ -61,7 +65,7 @@ export class MdSwitch {
6165
}
6266

6367
onKeydown(event: KeyboardEvent) {
64-
if (event.keyCode == KeyCodes.SPACE) {
68+
if (event.keyCode == KEY_SPACE) {
6569
event.preventDefault();
6670
this.toggle(event);
6771
}
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// TODO: switch to proper enums when we support them.
12

2-
// TODO: this is not how TS&Dart enums are defined and it definitely won't
3-
// work in Dart. Switch to proper enums when we support them.
4-
//export var KeyCodes = {
5-
// SPACE: 32,
6-
// UP: 38,
7-
// DOWN: 40
8-
//};
3+
// Key codes
4+
export const KEY_SPACE = 32;
5+
export const KEY_UP = 38;
6+
export const KEY_DOWN = 40;

tools/build/dartanalyzer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = function(gulp, plugins, config) {
3434

3535
function analyze(dirName, done) {
3636
// analyze files in lib directly – or you mess up package: urls
37-
var sources = [].slice.call(glob.sync('lib/*.dart', {
37+
var sources = [].slice.call(glob.sync('lib/**/*.dart', {
3838
cwd: dirName
3939
}));
4040

0 commit comments

Comments
 (0)