Skip to content

Commit 9d324e5

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 f89c6db commit 9d324e5

26 files changed

+38
-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
});
File renamed without changes.

src/cdk/coercion/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './boolean-property';
2+
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
});
File renamed without changes.

src/cdk/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
* This file is not used to build this module. The real "index.js" file will be generated by the
3+
* Angular Compiler CLI. This file is necessary for running the tests.
4+
*/
5+
export * from './public_api';

src/cdk/public_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const __TEMP__ = -1;
1+
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
@@ -14,7 +14,7 @@ import {
1414
ViewEncapsulation,
1515
} from '@angular/core';
1616
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
17-
import {coerceBooleanProperty} from '../core/coercion/boolean-property';
17+
import {coerceBooleanProperty} from '@angular/cdk';
1818
import {FocusOrigin, FocusOriginMonitor, MdRipple, RippleRef} from '../core';
1919
import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';
2020
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
@@ -11,8 +11,8 @@ import {
1111

1212
import {MdChip} from './chip';
1313
import {FocusKeyManager} from '../core/a11y/focus-key-manager';
14-
import {coerceBooleanProperty} from '../core/coercion/boolean-property';
1514
import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes';
15+
import {coerceBooleanProperty} from '@angular/cdk';
1616
import {Subscription} from 'rxjs/Subscription';
1717

1818
/**

0 commit comments

Comments
 (0)