Skip to content

Commit 4cfe612

Browse files
committed
refactor(cdk/testing): fix strict property initialization errors
Updates the code to be compatible with strict property initialization.
1 parent 4cb1d68 commit 4cfe612

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/cdk/testing/component-harness.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,16 @@ export class HarnessPredicate<T extends ComponentHarness> {
609609
public harnessType: ComponentHarnessConstructor<T>,
610610
options: BaseHarnessFilters,
611611
) {
612-
this._addBaseOptions(options);
612+
this._ancestor = options.ancestor || '';
613+
if (this._ancestor) {
614+
this._descriptions.push(`has ancestor matching selector "${this._ancestor}"`);
615+
}
616+
const selector = options.selector;
617+
if (selector !== undefined) {
618+
this.add(`host matches selector "${selector}"`, async item => {
619+
return (await item.host()).matchesSelector(selector);
620+
});
621+
}
613622
}
614623

615624
/**
@@ -714,20 +723,6 @@ export class HarnessPredicate<T extends ComponentHarness> {
714723

715724
return result.join(', ');
716725
}
717-
718-
/** Adds base options common to all harness types. */
719-
private _addBaseOptions(options: BaseHarnessFilters) {
720-
this._ancestor = options.ancestor || '';
721-
if (this._ancestor) {
722-
this._descriptions.push(`has ancestor matching selector "${this._ancestor}"`);
723-
}
724-
const selector = options.selector;
725-
if (selector !== undefined) {
726-
this.add(`host matches selector "${selector}"`, async item => {
727-
return (await item.host()).matchesSelector(selector);
728-
});
729-
}
730-
}
731726
}
732727

733728
/** Represent a value as a string for the purpose of logging. */

0 commit comments

Comments
 (0)