mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: update jasmine for improved type safety (#8350)
* Bumps the version of Jasmine to allow for better type safety in the assertions. * Fixes a few new compilation errors.
This commit is contained in:
committed by
Jeremy Elbourn
parent
8dfe470c30
commit
33edff5f14
@@ -66,7 +66,7 @@ describe('CdkTable', () => {
|
||||
it('with a rendered header with the right number of header cells', () => {
|
||||
const header = getHeaderRow(tableElement);
|
||||
|
||||
expect(header).not.toBe(undefined);
|
||||
expect(header).toBeTruthy();
|
||||
expect(header.classList).toContain('customHeaderRowClass');
|
||||
expect(getHeaderCells(tableElement).length).toBe(component.columnsToRender.length);
|
||||
});
|
||||
@@ -488,7 +488,7 @@ describe('CdkTable', () => {
|
||||
]);
|
||||
|
||||
// Remove the data source and check to make sure the table is empty again.
|
||||
component.dataSource = null;
|
||||
component.dataSource = undefined;
|
||||
dynamicDataSourceFixture.detectChanges();
|
||||
|
||||
// Expect that the old data source has been disconnected.
|
||||
@@ -696,7 +696,7 @@ class BooleanDataSource extends DataSource<boolean> {
|
||||
`
|
||||
})
|
||||
class SimpleCdkTableApp {
|
||||
dataSource: FakeDataSource | null = new FakeDataSource();
|
||||
dataSource: FakeDataSource | undefined = new FakeDataSource();
|
||||
columnsToRender = ['column_a', 'column_b', 'column_c'];
|
||||
|
||||
@ViewChild(CdkTable) table: CdkTable<TestData>;
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('MatInput without forms', function () {
|
||||
fixture.debugElement.query(By.css('label')).nativeElement;
|
||||
|
||||
expect(inputElement.id).toBeTruthy();
|
||||
expect(inputElement.id).toEqual(labelElement.getAttribute('for'));
|
||||
expect(inputElement.id).toEqual(labelElement.getAttribute('for')!);
|
||||
});
|
||||
|
||||
it('should add aria-owns to the label for the associated control', () => {
|
||||
|
||||
@@ -75,6 +75,7 @@ export class MatInput implements MatFormFieldControl<any>, OnChanges, OnDestroy,
|
||||
protected _uid = `mat-input-${nextUniqueId++}`;
|
||||
protected _previousNativeValue: any;
|
||||
private _readonly = false;
|
||||
private _inputValueAccessor: {value: any};
|
||||
|
||||
/** Whether the input is focused. */
|
||||
focused = false;
|
||||
@@ -161,11 +162,10 @@ export class MatInput implements MatFormFieldControl<any>, OnChanges, OnDestroy,
|
||||
@Optional() protected _parentForm: NgForm,
|
||||
@Optional() protected _parentFormGroup: FormGroupDirective,
|
||||
private _defaultErrorStateMatcher: ErrorStateMatcher,
|
||||
@Optional() @Self() @Inject(MAT_INPUT_VALUE_ACCESSOR)
|
||||
private _inputValueAccessor: {value: any}) {
|
||||
@Optional() @Self() @Inject(MAT_INPUT_VALUE_ACCESSOR) inputValueAccessor: any) {
|
||||
// If no input value accessor was explicitly specified, use the element as the input value
|
||||
// accessor.
|
||||
this._inputValueAccessor = this._inputValueAccessor || this._elementRef.nativeElement;
|
||||
this._inputValueAccessor = inputValueAccessor || this._elementRef.nativeElement;
|
||||
|
||||
this._previousNativeValue = this.value;
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ describe('MatMenu', () => {
|
||||
triggerEl.click();
|
||||
fixture.detectChanges();
|
||||
|
||||
const panel = overlayContainerElement.querySelector('.mat-menu-panel');
|
||||
const panel = overlayContainerElement.querySelector('.mat-menu-panel')!;
|
||||
|
||||
expect(panel).toBeTruthy('Expected the panel to be rendered.');
|
||||
expect(document.activeElement).toBe(panel, 'Expected the panel to be focused.');
|
||||
|
||||
@@ -1032,7 +1032,7 @@ describe('MatSelect', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(fixture.componentInstance.customAccessor.select.ngControl)
|
||||
.toBe(null, 'Expected mat-select NOT to inherit control from parent value accessor.');
|
||||
.toBeFalsy('Expected mat-select NOT to inherit control from parent value accessor.');
|
||||
expect(fixture.componentInstance.customAccessor.writeValue).toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user