@@ -15,57 +15,57 @@ import { DashboardCoreModule } from '../../module/dashboard-core.module';
1515import { DashboardEditorModule } from '../dashboard-editor.module' ;
1616import { EDITOR_API } from '../editor-api-injection-token' ;
1717
18+ const TEST_PROP_TYPE : ModelPropertyTypeRegistrationInformation = {
19+ type : 'test-prop-type'
20+ } ;
21+
22+ @Model ( {
23+ type : 'test-model'
24+ } )
25+ class TestModel {
26+ @ModelProperty ( {
27+ type : TEST_PROP_TYPE . type ,
28+ key : 'prop'
29+ } )
30+ public property : string = 'default' ;
31+ }
32+
33+ @ModelPropertyEditor ( { propertyType : TEST_PROP_TYPE . type } )
34+ @Component ( {
35+ selector : 'hda-prop-editor' ,
36+ template : 'property editor' ,
37+ standalone : false
38+ } )
39+ class PropEditorComponent {
40+ public constructor ( @Inject ( EDITOR_API ) public editorApi : EditorApi < string > ) { }
41+ }
42+
43+ @NgModule ( {
44+ declarations : [ PropEditorComponent ] ,
45+ imports : [
46+ DashboardCoreModule . with ( {
47+ models : [ TestModel ] ,
48+ propertyTypes : [ TEST_PROP_TYPE ]
49+ } )
50+ ]
51+ } )
52+ class TestDashboardModule { }
53+
54+ @Component ( {
55+ selector : 'hda-host' ,
56+ template : ' <hda-model-json-editor [(modelJson)]="modelJson"> </hda-model-json-editor> ' ,
57+ standalone : true ,
58+ imports : [ DashboardEditorModule ] ,
59+ schemas : [ NO_ERRORS_SCHEMA ]
60+ } )
61+ class HostComponent {
62+ public modelJson ?: object ;
63+ }
64+
1865// Large test - testing all machinery, no mocks
1966describe ( 'Model JSON editor component' , ( ) => {
2067 let host : ComponentFixture < HostComponent > ;
2168
22- const TEST_PROP_TYPE : ModelPropertyTypeRegistrationInformation = {
23- type : 'test-prop-type'
24- } ;
25-
26- @Model ( {
27- type : 'test-model'
28- } )
29- class TestModel {
30- @ModelProperty ( {
31- type : TEST_PROP_TYPE . type ,
32- key : 'prop'
33- } )
34- public property : string = 'default' ;
35- }
36-
37- @ModelPropertyEditor ( { propertyType : TEST_PROP_TYPE . type } )
38- @Component ( {
39- selector : 'hda-prop-editor' ,
40- template : 'property editor' ,
41- standalone : false
42- } )
43- class PropEditorComponent {
44- public constructor ( @Inject ( EDITOR_API ) public editorApi : EditorApi < string > ) { }
45- }
46-
47- @NgModule ( {
48- declarations : [ PropEditorComponent ] ,
49- imports : [
50- DashboardCoreModule . with ( {
51- models : [ TestModel ] ,
52- propertyTypes : [ TEST_PROP_TYPE ]
53- } )
54- ]
55- } )
56- class TestDashboardModule { }
57-
58- @Component ( {
59- selector : 'hda-host' ,
60- template : ' <hda-model-json-editor [(modelJson)]="modelJson"> </hda-model-json-editor> ' ,
61- standalone : true ,
62- imports : [ DashboardEditorModule ] ,
63- schemas : [ NO_ERRORS_SCHEMA ]
64- } )
65- class HostComponent {
66- public modelJson ?: object ;
67- }
68-
6969 beforeEach ( ( ) => {
7070 TestBed . configureTestingModule ( {
7171 imports : [ HostComponent , DashboardEditorModule , TestDashboardModule ]
0 commit comments