Browse Source
Fix validation in image name input form
Fix validation in image name input form
Signed-off-by: 陈德 <chende@caicloud.io>pull/5995/head
16 changed files with 247 additions and 132 deletions
-
20src/portal/lib/src/image-name-input/image-name-input.component.html
-
50src/portal/lib/src/image-name-input/image-name-input.component.scss
-
63src/portal/lib/src/image-name-input/image-name-input.component.spec.ts
-
47src/portal/lib/src/image-name-input/image-name-input.component.ts
-
9src/portal/lib/src/repository-gridview/repository-gridview.component.spec.ts
-
13src/portal/lib/src/repository/repository.component.spec.ts
-
30src/portal/lib/src/service/index.ts
-
18src/portal/lib/src/service/retag.service.ts
-
8src/portal/lib/src/tag/tag.component.html
-
10src/portal/lib/src/tag/tag.component.scss
-
76src/portal/lib/src/tag/tag.component.spec.ts
-
18src/portal/lib/src/tag/tag.component.ts
-
6src/portal/src/i18n/lang/en-us-lang.json
-
3src/portal/src/i18n/lang/es-es-lang.json
-
3src/portal/src/i18n/lang/fr-fr-lang.json
-
5src/portal/src/i18n/lang/zh-cn-lang.json
@ -0,0 +1,63 @@ |
|||
import { async, ComponentFixture, TestBed } from "@angular/core/testing"; |
|||
|
|||
import { SharedModule } from "../shared/shared.module"; |
|||
import { ImageNameInputComponent } from "../image-name-input/image-name-input.component"; |
|||
|
|||
import { ErrorHandler } from "../error-handler/error-handler"; |
|||
import { ProjectDefaultService, ProjectService } from "../service/index"; |
|||
import { ChannelService } from "../channel/index"; |
|||
import { Project } from "../project-policy-config/project"; |
|||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config"; |
|||
|
|||
describe("ImageNameInputComponent (inline template)", () => { |
|||
let comp: ImageNameInputComponent; |
|||
let fixture: ComponentFixture<ImageNameInputComponent>; |
|||
let spy: jasmine.Spy; |
|||
|
|||
let mockProjects: Project[] = [ |
|||
{ |
|||
"project_id": 1, |
|||
"name": "project_01", |
|||
"creation_time": "", |
|||
}, |
|||
{ |
|||
"project_id": 2, |
|||
"name": "project_02", |
|||
"creation_time": "", |
|||
} |
|||
]; |
|||
|
|||
let config: IServiceConfig = { |
|||
projectBaseEndpoint: "/api/projects/testing" |
|||
}; |
|||
|
|||
beforeEach(async(() => { |
|||
TestBed.configureTestingModule({ |
|||
imports: [ |
|||
SharedModule |
|||
], |
|||
declarations: [ |
|||
ImageNameInputComponent |
|||
], |
|||
providers: [ |
|||
ErrorHandler, |
|||
ChannelService, |
|||
{ provide: SERVICE_CONFIG, useValue: config }, |
|||
{ provide: ProjectService, useClass: ProjectDefaultService } |
|||
] |
|||
}); |
|||
})); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(ImageNameInputComponent); |
|||
comp = fixture.componentInstance; |
|||
|
|||
let projectService: ProjectService; |
|||
projectService = fixture.debugElement.injector.get(ProjectService); |
|||
spy = spyOn(projectService, "listProjects").and.returnValues(Promise.resolve(mockProjects)); |
|||
}); |
|||
|
|||
it("should load data", async(() => { |
|||
expect(spy.calls.any).toBeTruthy(); |
|||
})); |
|||
}); |
|||
@ -1,15 +1,15 @@ |
|||
export * from './interface'; |
|||
export * from './system-info.service'; |
|||
export * from './access-log.service'; |
|||
export * from './endpoint.service'; |
|||
export * from './replication.service'; |
|||
export * from './repository.service'; |
|||
export * from './tag.service'; |
|||
export * from './RequestQueryParams'; |
|||
export * from './scanning.service'; |
|||
export * from './configuration.service'; |
|||
export * from './job-log.service'; |
|||
export * from './project.service'; |
|||
export * from './label.service'; |
|||
export * from './helm-chart.service'; |
|||
export * from './retag.service'; |
|||
export * from "./interface"; |
|||
export * from "./system-info.service"; |
|||
export * from "./access-log.service"; |
|||
export * from "./endpoint.service"; |
|||
export * from "./replication.service"; |
|||
export * from "./repository.service"; |
|||
export * from "./tag.service"; |
|||
export * from "./RequestQueryParams"; |
|||
export * from "./scanning.service"; |
|||
export * from "./configuration.service"; |
|||
export * from "./job-log.service"; |
|||
export * from "./project.service"; |
|||
export * from "./label.service"; |
|||
export * from "./helm-chart.service"; |
|||
export * from "./retag.service"; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue