[英]ERROR: 'NG0303: Can't bind to 'max' since it isn't a known property of 'mat-progress-bar'.' while angular testing
component.spec file component.spec 文件
trying to test a component nut keep getting these messages in terminal.试图测试组件坚果不断在终端中获取这些消息。 It does not fail the test but gives error like a warning.
它不会通过测试,但会像警告一样给出错误。 Could anyone provide a solution here.
谁能在这里提供解决方案。 I am importing all the required modules here.
我在这里导入所有必需的模块。
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { MatDialogModule } from '@angular/material/dialog';
import { MatProgressBar, MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { AppConfigService } from 'src/app/services/config/app-config.service';
import { SharedModule } from 'src/app/shared/shared.module';
import { MaterialModule } from 'src/material.module';
import { VesselManagementPopupComponent } from '../vessel-management/vessel-management-popup/vessel-management-popup.component';
import { PriceCardComponent } from './components/price-card/price-card.component';
import { RfqPageComponent } from './rfq-page.component';
fdescribe('RfqComponent', () => {
let component: RfqPageComponent;
let fixture: ComponentFixture<RfqPageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [RfqPageComponent ,PriceCardComponent, VesselManagementPopupComponent],
imports: [RouterTestingModule,
ReactiveFormsModule,
MatSnackBarModule,
MatDialogModule,
HttpClientTestingModule,
MaterialModule,
BrowserAnimationsModule,
SharedModule
],
providers: [
{
provide:
MatProgressBar,
AppConfigService,
useValue: {
getConfig: () => ({
baseUrl: 'dummy-url',
serviceBase: 'api-base'
})
}
}
],
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(RfqPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fit('should create', () => {
expect(component).toBeTruthy();
});
it('should call method loadRipCodeErrorMsg', () => {
component.loadRipCodeErrorMsg();
expect(component).toBeTruthy();
});
it is giving message as following but test cases are passed.它给出如下消息,但测试用例已通过。
ERROR: 'NG0303: Can't bind to 'max' since it isn't a known property of 'mat-progress-bar'.'
.html file .html 文件
<mat-progress-bar class="headder-mat-progress" mode="determinate" height="4px" [value]="loadingProgressValue"
[max]="100">
</mat-progress-bar>
You most likely need to add MatProgressBarModule
to the imports
array of TestBed.configureTestingModule({
.您很可能需要将
MatProgressBarModule
添加到imports
TestBed.configureTestingModule({
.
Also, I have never used Angular Material and it seems on the latest version, there is no max
input property (on the API tab here: https://material.angular.io/components/progress-bar/api ).另外,我从未使用过 Angular Material,在最新版本中似乎没有
max
输入属性(在此处的 API 选项卡上: https://material.angular.io/components/progress-bar/api )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.