Skip to content

Commit f10fdfc

Browse files
devversionjelbourn
authored andcommitted
refactor(schematics): add test case for overlay property name change (#13140)
* Moves the breaking change for `flexibleDimension` into the V7 target data. This is currently in V6 because at the time of the PR, this data distinction didn't exist. * Adds a test-case for that breaking change
1 parent 0988db9 commit f10fdfc

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

src/lib/schematics/update/material/data/property-names.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ export const propertyNames: VersionChanges<MaterialPropertyNameData> = {
3434
}
3535
}
3636
]
37+
},
38+
39+
{
40+
pr: 'https://github.com/angular/material2/pull/12927',
41+
changes: [
42+
{
43+
replace: 'flexibleDiemsions',
44+
replaceWith: 'flexibleDimensions',
45+
whitelist: {
46+
classes: ['CdkConnectedOverlay']
47+
}
48+
}
49+
]
3750
}
3851
],
3952

@@ -353,19 +366,5 @@ export const propertyNames: VersionChanges<MaterialPropertyNameData> = {
353366
}
354367
]
355368
},
356-
357-
// TODO(devversion): this should be part of the V6 to V7 upgrade
358-
{
359-
pr: 'https://github.com/angular/material2/pull/12927',
360-
changes: [
361-
{
362-
replace: 'flexibleDiemsions',
363-
replaceWith: 'flexibleDimensions',
364-
whitelist: {
365-
classes: ['CdkConnectedOverlay']
366-
}
367-
}
368-
]
369-
}
370369
]
371370
};

src/lib/schematics/update/test-cases/v7/property-names_expected_output.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ class SelectionModel {
44
onChange = new EventEmitter<void>();
55
}
66

7+
class CdkConnectedOverlay {
8+
flexibleDiemsions: boolean;
9+
}
10+
711
/* Actual test case using the previously defined definitions. */
812

913
class A implements OnInit {
1014
self = {me: this};
1115

12-
constructor(private a: SelectionModel) {}
16+
constructor(private a: SelectionModel, private b: CdkConnectedOverlay) {}
1317

1418
ngOnInit() {
1519
this.a.changed.subscribe(() => console.log('Changed'));
1620
this.self.me.a.changed.subscribe(() => console.log('Changed 2'));
21+
22+
if (this.b.flexibleDimensions) {
23+
console.log(this.b.flexibleDimensions ? 'true' : 'false');
24+
}
25+
26+
const _state = this.self.me.b.flexibleDimensions.toString() || 'not-defined';
1727
}
1828
}

src/lib/schematics/update/test-cases/v7/property-names_input.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ class SelectionModel {
44
onChange = new EventEmitter<void>();
55
}
66

7+
class CdkConnectedOverlay {
8+
flexibleDiemsions: boolean;
9+
}
10+
711
/* Actual test case using the previously defined definitions. */
812

913
class A implements OnInit {
1014
self = {me: this};
1115

12-
constructor(private a: SelectionModel) {}
16+
constructor(private a: SelectionModel, private b: CdkConnectedOverlay) {}
1317

1418
ngOnInit() {
1519
this.a.onChange.subscribe(() => console.log('Changed'));
1620
this.self.me.a.onChange.subscribe(() => console.log('Changed 2'));
21+
22+
if (this.b.flexibleDiemsions) {
23+
console.log(this.b.flexibleDiemsions ? 'true' : 'false');
24+
}
25+
26+
const _state = this.self.me.b.flexibleDiemsions.toString() || 'not-defined';
1727
}
1828
}

0 commit comments

Comments
 (0)