22
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
THE SOFTWARE.
24
24
*/
25
- import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing' ;
26
25
import { NgRedux , NgReduxModule } from '@angular-redux/store' ;
26
+ import { MockNgRedux } from '@angular-redux/store/lib/testing' ;
27
27
import { CommonModule } from '@angular/common' ;
28
28
import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
29
+ import { FlexLayoutModule } from '@angular/flex-layout' ;
29
30
import { ReactiveFormsModule } from '@angular/forms' ;
30
31
import {
31
32
MatCardModule ,
32
33
MatFormFieldModule ,
33
34
MatInputModule
34
35
} from '@angular/material' ;
35
- import { MockNgRedux } from '@angular-redux/store/lib /testing' ;
36
+ import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic /testing' ;
36
37
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
37
38
import { JsonFormsModule } from '@jsonforms/angular' ;
38
39
import { ControlElement } from '@jsonforms/core' ;
@@ -48,7 +49,6 @@ import {
48
49
ObjectControlRenderer ,
49
50
ObjectControlRendererTester
50
51
} from '../src/other/object.renderer' ;
51
- import { FlexLayoutModule } from '@angular/flex-layout' ;
52
52
53
53
const uischema1 : ControlElement = { type : 'Control' , scope : '#' } ;
54
54
const uischema2 : ControlElement = {
@@ -131,6 +131,32 @@ describe('Object Control', () => {
131
131
component = fixture . componentInstance ;
132
132
} ) ) ;
133
133
134
+ it ( 'object control creates group' , async ( ( ) => {
135
+ const mockSubStore = MockNgRedux . getSelectorStub ( ) ;
136
+ component . uischema = uischema2 ;
137
+ component . schema = schema2 ;
138
+
139
+ mockSubStore . next ( {
140
+ jsonforms : {
141
+ renderers : renderers ,
142
+ core : {
143
+ data : { } ,
144
+ schema : schema2
145
+ }
146
+ }
147
+ } ) ;
148
+ mockSubStore . complete ( ) ;
149
+ fixture . detectChanges ( ) ;
150
+ component . ngOnInit ( ) ;
151
+ fixture . whenStable ( ) . then ( ( ) => {
152
+ // one for the object renderer and one for the group
153
+ expect ( fixture . nativeElement . querySelectorAll ( 'mat-card' ) . length ) . toBe ( 2 ) ;
154
+ expect (
155
+ fixture . nativeElement . querySelectorAll ( 'mat-card-title' ) [ 0 ] . textContent
156
+ ) . toBe ( 'Foo' ) ;
157
+ } ) ;
158
+ } ) ) ;
159
+
134
160
it ( 'render all elements' , async ( ( ) => {
135
161
const mockSubStore = MockNgRedux . getSelectorStub ( ) ;
136
162
component . uischema = uischema1 ;
0 commit comments