summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-object-type/formly-object-type.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-object-type/formly-object-type.component.spec.ts46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-object-type/formly-object-type.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-object-type/formly-object-type.component.spec.ts
new file mode 100644
index 000000000..37756ad52
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/crud-form/formly-object-type/formly-object-type.component.spec.ts
@@ -0,0 +1,46 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { FormlyObjectTypeComponent } from './formly-object-type.component';
+import { FormlyFieldConfig, FormlyModule } from '@ngx-formly/core';
+import { Component } from '@angular/core';
+import { FormGroup } from '@angular/forms';
+import { configureTestBed } from '~/testing/unit-test-helper';
+
+@Component({
+ template: ` <form [formGroup]="form">
+ <formly-form [model]="{}" [fields]="fields" [options]="{}" [form]="form"></formly-form>
+ </form>`
+})
+class MockFormComponent {
+ form = new FormGroup({});
+ fields: FormlyFieldConfig[] = [
+ {
+ wrappers: ['object'],
+ defaultValue: {}
+ }
+ ];
+}
+
+describe('FormlyObjectTypeComponent', () => {
+ let fixture: ComponentFixture<MockFormComponent>;
+ let mockComponent: MockFormComponent;
+
+ configureTestBed({
+ declarations: [FormlyObjectTypeComponent],
+ imports: [
+ FormlyModule.forRoot({
+ types: [{ name: 'object', component: FormlyObjectTypeComponent }]
+ })
+ ]
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MockFormComponent);
+ mockComponent = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(mockComponent).toBeTruthy();
+ });
+});