Skip to content

Commit b1cd3fb

Browse files
committed
fix(dyn-forms): adjust default args of control schematics
1 parent 2220268 commit b1cd3fb

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

libs/forms/lib/schematics/control/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { ReactiveFormsModule } from '@angular/forms';
2+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
33
import { DynFormsModule } from '@myndpm/dyn-forms';
4-
import { DynFormTreeNode } from '@myndpm/dyn-forms/core';
4+
import { DYN_CONTROLS_TOKEN, DynFormTreeNode } from '@myndpm/dyn-forms/core';
55
import { DynLogger } from '@myndpm/dyn-forms/logger';
66

77
import { <%= classify(prefix) %><%= classify(name) %><%= classify(type) %> } from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';
@@ -21,7 +21,24 @@ describe('<%= classify(prefix) %><%= classify(name) %><%= classify(type) %>', ()
2121
],
2222
providers: [
2323
DynLogger,
24-
DynFormTreeNode,
24+
{
25+
provide: DYN_CONTROLS_TOKEN,
26+
useValue: {},
27+
multi: true,
28+
},
29+
{
30+
provide: DynFormTreeNode,
31+
useValue: {
32+
_name: 'test',
33+
_control: 'CONTROL',
34+
hook$: of(),
35+
path: [],
36+
parent: {
37+
control: new FormGroup({ test: new FormControl() }),
38+
},
39+
onInit: () => {},
40+
},
41+
},
2542
],
2643
})
2744
.compileComponents();
@@ -30,6 +47,10 @@ describe('<%= classify(prefix) %><%= classify(name) %><%= classify(type) %>', ()
3047
beforeEach(() => {
3148
fixture = TestBed.createComponent(<%= classify(prefix) %><%= classify(name) %><%= classify(type) %>);
3249
component = fixture.componentInstance;
50+
component.config = {
51+
control: <%= classify(prefix) %><%= classify(name) %><%= classify(type) %>.dynControl,
52+
name: 'test',
53+
};
3354
fixture.detectChanges();
3455
});
3556

libs/forms/lib/schematics/control/schema.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,12 @@
2626
"name": {
2727
"type": "string",
2828
"description": "The name of the control.",
29-
"$default": {
30-
"$source": "argv",
31-
"index": 0
32-
},
29+
"alias": "n",
3330
"x-prompt": "What name would you like to use for the control?"
3431
},
3532
"id": {
3633
"type": "string",
3734
"description": "The ID of the control.",
38-
"$default": {
39-
"$source": "argv",
40-
"index": 1
41-
},
4235
"alias": "id",
4336
"x-prompt": "Which ID would you like to identify the control?"
4437
},

0 commit comments

Comments
 (0)