Skip to content

Commit f3765a3

Browse files
committed
feat: move coercing to cdk package
* Moves the coercing to the CDK package * Fixes linking between Material and CDK package for tests (creating the index.ts file - similar as in angular/angular) *
1 parent a555108 commit f3765a3

26 files changed

+62
-23
lines changed

src/lib/core/coercion/boolean-property.spec.ts renamed to src/cdk/coercion/boolean-property.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {coerceBooleanProperty} from './boolean-property';
22

3-
43
describe('coerceBooleanProperty', () => {
4+
55
it('should coerce undefined to false', () => {
66
expect(coerceBooleanProperty(undefined)).toBe(false);
77
});
@@ -45,4 +45,5 @@ describe('coerceBooleanProperty', () => {
4545
it('should coerce an array to true', () => {
4646
expect(coerceBooleanProperty([])).toBe(true);
4747
});
48+
4849
});

src/cdk/coercion/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './boolean-property';
10+
export * from './number-property';

src/lib/core/coercion/number-property.spec.ts renamed to src/cdk/coercion/number-property.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {coerceNumberProperty} from './number-property';
22

3-
43
describe('coerceNumberProperty', () => {
4+
55
it('should coerce undefined to 0 or default', () => {
66
expect(coerceNumberProperty(undefined)).toBe(0);
77
expect(coerceNumberProperty(undefined, 111)).toBe(111);
@@ -78,4 +78,5 @@ describe('coerceNumberProperty', () => {
7878
expect(coerceNumberProperty([])).toBe(0);
7979
expect(coerceNumberProperty([], 111)).toBe(111);
8080
});
81+
8182
});

src/cdk/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/*
10+
* This file is not used to build this module. The real "index.js" file will be generated by the
11+
* Angular Compiler CLI. This file is necessary for running the tests.
12+
*/
13+
export * from './public_api';

src/cdk/public_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export const __TEMP__ = -1;
9+
export * from './coercion/index';

src/cdk/tsconfig-tests.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"experimentalDecorators": true
1212
},
1313
"include": [
14-
"**/*.spec.ts"
14+
"**/*.spec.ts",
15+
"index.ts"
1516
]
1617
}

src/lib/checkbox/checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
ViewEncapsulation,
2323
} from '@angular/core';
2424
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
25-
import {coerceBooleanProperty} from '../core/coercion/boolean-property';
25+
import {coerceBooleanProperty} from '@angular/cdk';
2626
import {FocusOrigin, FocusOriginMonitor, MdRipple, RippleRef} from '../core';
2727
import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';
2828
import {CanColor, mixinColor} from '../core/common-behaviors/color';

src/lib/chips/chip-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import {
1919

2020
import {MdChip} from './chip';
2121
import {FocusKeyManager} from '../core/a11y/focus-key-manager';
22-
import {coerceBooleanProperty} from '../core/coercion/boolean-property';
2322
import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes';
23+
import {coerceBooleanProperty} from '@angular/cdk';
2424
import {Subscription} from 'rxjs/Subscription';
2525

2626
/**

0 commit comments

Comments
 (0)