@jsonforms/angular-material 3.0.0 → 3.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/lib/cjs/controls/autocomplete.renderer.d.ts +2 -2
  2. package/lib/cjs/controls/autocomplete.renderer.js +1 -1
  3. package/lib/cjs/controls/autocomplete.renderer.js.map +1 -1
  4. package/lib/cjs/controls/autocomplete.renderer.metadata.json +1 -1
  5. package/lib/cjs/controls/date.renderer.js +1 -1
  6. package/lib/cjs/controls/date.renderer.js.map +1 -1
  7. package/lib/cjs/controls/date.renderer.metadata.json +1 -1
  8. package/lib/cjs/controls/number.renderer.js +2 -2
  9. package/lib/cjs/controls/number.renderer.js.map +1 -1
  10. package/lib/cjs/controls/number.renderer.metadata.json +1 -1
  11. package/lib/cjs/controls/text.renderer.js +1 -1
  12. package/lib/cjs/controls/text.renderer.js.map +1 -1
  13. package/lib/cjs/controls/text.renderer.metadata.json +1 -1
  14. package/lib/cjs/controls/textarea.renderer.js +1 -1
  15. package/lib/cjs/controls/textarea.renderer.js.map +1 -1
  16. package/lib/cjs/controls/textarea.renderer.metadata.json +1 -1
  17. package/lib/cjs/layouts/array-layout.renderer.d.ts +8 -0
  18. package/lib/cjs/layouts/array-layout.renderer.js +12 -2
  19. package/lib/cjs/layouts/array-layout.renderer.js.map +1 -1
  20. package/lib/cjs/layouts/array-layout.renderer.metadata.json +1 -1
  21. package/lib/cjs/layouts/categorization-layout.renderer.d.ts +2 -1
  22. package/lib/cjs/layouts/categorization-layout.renderer.js +5 -2
  23. package/lib/cjs/layouts/categorization-layout.renderer.js.map +1 -1
  24. package/lib/cjs/layouts/categorization-layout.renderer.metadata.json +1 -1
  25. package/lib/cjs/layouts/group-layout.renderer.js +1 -1
  26. package/lib/cjs/layouts/group-layout.renderer.js.map +1 -1
  27. package/lib/cjs/layouts/group-layout.renderer.metadata.json +1 -1
  28. package/lib/cjs/layouts/horizontal-layout.renderer.js +1 -1
  29. package/lib/cjs/layouts/horizontal-layout.renderer.js.map +1 -1
  30. package/lib/cjs/layouts/horizontal-layout.renderer.metadata.json +1 -1
  31. package/lib/cjs/layouts/layout.renderer.d.ts +5 -3
  32. package/lib/cjs/layouts/layout.renderer.js +18 -14
  33. package/lib/cjs/layouts/layout.renderer.js.map +1 -1
  34. package/lib/cjs/layouts/layout.renderer.metadata.json +1 -1
  35. package/lib/cjs/layouts/vertical-layout.renderer.js +1 -1
  36. package/lib/cjs/layouts/vertical-layout.renderer.js.map +1 -1
  37. package/lib/cjs/layouts/vertical-layout.renderer.metadata.json +1 -1
  38. package/lib/cjs/module.js +3 -1
  39. package/lib/cjs/module.js.map +1 -1
  40. package/lib/cjs/module.metadata.json +1 -1
  41. package/lib/cjs/other/master-detail/master.js +3 -0
  42. package/lib/cjs/other/master-detail/master.js.map +1 -1
  43. package/lib/cjs/other/master-detail/master.metadata.json +1 -1
  44. package/lib/cjs/other/table.renderer.d.ts +9 -0
  45. package/lib/cjs/other/table.renderer.js +28 -2
  46. package/lib/cjs/other/table.renderer.js.map +1 -1
  47. package/lib/cjs/other/table.renderer.metadata.json +1 -1
  48. package/lib/esm/controls/autocomplete.renderer.d.ts +2 -2
  49. package/lib/esm/controls/autocomplete.renderer.js +1 -1
  50. package/lib/esm/controls/autocomplete.renderer.js.map +1 -1
  51. package/lib/esm/controls/autocomplete.renderer.metadata.json +1 -1
  52. package/lib/esm/controls/date.renderer.js +1 -1
  53. package/lib/esm/controls/date.renderer.js.map +1 -1
  54. package/lib/esm/controls/date.renderer.metadata.json +1 -1
  55. package/lib/esm/controls/number.renderer.js +3 -3
  56. package/lib/esm/controls/number.renderer.js.map +1 -1
  57. package/lib/esm/controls/number.renderer.metadata.json +1 -1
  58. package/lib/esm/controls/text.renderer.js +1 -1
  59. package/lib/esm/controls/text.renderer.js.map +1 -1
  60. package/lib/esm/controls/text.renderer.metadata.json +1 -1
  61. package/lib/esm/controls/textarea.renderer.js +1 -1
  62. package/lib/esm/controls/textarea.renderer.js.map +1 -1
  63. package/lib/esm/controls/textarea.renderer.metadata.json +1 -1
  64. package/lib/esm/layouts/array-layout.renderer.d.ts +8 -0
  65. package/lib/esm/layouts/array-layout.renderer.js +12 -2
  66. package/lib/esm/layouts/array-layout.renderer.js.map +1 -1
  67. package/lib/esm/layouts/array-layout.renderer.metadata.json +1 -1
  68. package/lib/esm/layouts/categorization-layout.renderer.d.ts +2 -1
  69. package/lib/esm/layouts/categorization-layout.renderer.js +6 -3
  70. package/lib/esm/layouts/categorization-layout.renderer.js.map +1 -1
  71. package/lib/esm/layouts/categorization-layout.renderer.metadata.json +1 -1
  72. package/lib/esm/layouts/group-layout.renderer.js +1 -1
  73. package/lib/esm/layouts/group-layout.renderer.js.map +1 -1
  74. package/lib/esm/layouts/group-layout.renderer.metadata.json +1 -1
  75. package/lib/esm/layouts/horizontal-layout.renderer.js +1 -1
  76. package/lib/esm/layouts/horizontal-layout.renderer.js.map +1 -1
  77. package/lib/esm/layouts/horizontal-layout.renderer.metadata.json +1 -1
  78. package/lib/esm/layouts/layout.renderer.d.ts +5 -3
  79. package/lib/esm/layouts/layout.renderer.js +18 -14
  80. package/lib/esm/layouts/layout.renderer.js.map +1 -1
  81. package/lib/esm/layouts/layout.renderer.metadata.json +1 -1
  82. package/lib/esm/layouts/vertical-layout.renderer.js +1 -1
  83. package/lib/esm/layouts/vertical-layout.renderer.js.map +1 -1
  84. package/lib/esm/layouts/vertical-layout.renderer.metadata.json +1 -1
  85. package/lib/esm/module.js +3 -1
  86. package/lib/esm/module.js.map +1 -1
  87. package/lib/esm/module.metadata.json +1 -1
  88. package/lib/esm/other/master-detail/master.js +4 -1
  89. package/lib/esm/other/master-detail/master.js.map +1 -1
  90. package/lib/esm/other/master-detail/master.metadata.json +1 -1
  91. package/lib/esm/other/table.renderer.d.ts +9 -0
  92. package/lib/esm/other/table.renderer.js +29 -3
  93. package/lib/esm/other/table.renderer.js.map +1 -1
  94. package/lib/esm/other/table.renderer.metadata.json +1 -1
  95. package/package.json +23 -8
  96. package/src/controls/autocomplete.renderer.ts +5 -3
  97. package/src/controls/date.renderer.ts +3 -1
  98. package/src/controls/number.renderer.ts +4 -3
  99. package/src/controls/text.renderer.ts +3 -1
  100. package/src/controls/textarea.renderer.ts +3 -1
  101. package/src/layouts/array-layout.renderer.ts +43 -2
  102. package/src/layouts/categorization-layout.renderer.ts +8 -2
  103. package/src/layouts/group-layout.renderer.ts +1 -1
  104. package/src/layouts/horizontal-layout.renderer.ts +1 -1
  105. package/src/layouts/layout.renderer.ts +17 -12
  106. package/src/layouts/vertical-layout.renderer.ts +1 -1
  107. package/src/module.ts +3 -1
  108. package/src/other/master-detail/master.ts +5 -0
  109. package/src/other/table.renderer.ts +80 -3
  110. package/docs/assets/css/main.css +0 -1
  111. package/docs/assets/images/icons.png +0 -0
  112. package/docs/assets/images/icons@2x.png +0 -0
  113. package/docs/assets/images/widgets.png +0 -0
  114. package/docs/assets/images/widgets@2x.png +0 -0
  115. package/docs/assets/js/main.js +0 -51
  116. package/docs/assets/js/search.json +0 -1
  117. package/docs/classes/arraylayoutrenderer.html +0 -1046
  118. package/docs/classes/autocompletecontrolrenderer.html +0 -887
  119. package/docs/classes/booleancontrolrenderer.html +0 -771
  120. package/docs/classes/categorizationtablayoutrenderer.html +0 -370
  121. package/docs/classes/datecontrolrenderer.html +0 -739
  122. package/docs/classes/grouplayoutrenderer.html +0 -426
  123. package/docs/classes/horizontallayoutrenderer.html +0 -426
  124. package/docs/classes/jsonformsangularmaterialmodule.html +0 -133
  125. package/docs/classes/jsonformsdetailcomponent.html +0 -227
  126. package/docs/classes/labelrenderer.html +0 -363
  127. package/docs/classes/layoutrenderer.html +0 -465
  128. package/docs/classes/masterlistcomponent.html +0 -1054
  129. package/docs/classes/numbercontrolrenderer.html +0 -893
  130. package/docs/classes/objectcontrolrenderer.html +0 -761
  131. package/docs/classes/rangecontrolrenderer.html +0 -792
  132. package/docs/classes/tablerenderer.html +0 -920
  133. package/docs/classes/textarearenderer.html +0 -739
  134. package/docs/classes/textcontrolrenderer.html +0 -760
  135. package/docs/classes/togglecontrolrenderer.html +0 -771
  136. package/docs/classes/verticallayoutrenderer.html +0 -426
  137. package/docs/globals.html +0 -606
  138. package/docs/index.html +0 -375
  139. package/docs/interfaces/columndescription.html +0 -192
  140. package/docs/interfaces/ownpropsofautocomplete.html +0 -327
  141. package/example/app/app.component.ts +0 -122
  142. package/example/app/app.module.ts +0 -42
  143. package/example/index.html +0 -25
  144. package/example/main.ts +0 -37
  145. package/test/autocomplete-control.spec.ts +0 -322
  146. package/test/boolean-control.spec.ts +0 -76
  147. package/test/categorization-tab-layout.spec.ts +0 -331
  148. package/test/date-control.spec.ts +0 -280
  149. package/test/group-layout.spec.ts +0 -104
  150. package/test/horizontal-layout.spec.ts +0 -94
  151. package/test/label-renderer.spec.ts +0 -78
  152. package/test/master-detail.spec.ts +0 -408
  153. package/test/number-control.spec.ts +0 -208
  154. package/test/object-control.spec.ts +0 -245
  155. package/test/range-control.spec.ts +0 -104
  156. package/test/table-control.spec.ts +0 -253
  157. package/test/text-area.spec.ts +0 -108
  158. package/test/text-control.spec.ts +0 -89
  159. package/test/toggle-control.spec.ts +0 -77
  160. package/test/tsconfig.test.json +0 -18
  161. package/test/util.ts +0 -28
  162. package/test/vertical-layout.spec.ts +0 -113
  163. package/test-config/karma-test-shim.js +0 -21
  164. package/test-config/karma.conf.js +0 -58
  165. package/test-config/protractor.conf.js +0 -28
  166. package/test-config/webpack.test.js +0 -65
  167. package/tsconfig.cjs.json +0 -9
  168. package/tsconfig.json +0 -16
  169. package/webpack/webpack.build.js +0 -13
  170. package/webpack/webpack.dev.js +0 -37
@@ -1,253 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2017-2019 EclipseSource Munich
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { CommonModule } from '@angular/common';
26
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
27
- import { ReactiveFormsModule } from '@angular/forms';
28
- import { MatCardModule } from '@angular/material/card';
29
- import { MatFormFieldModule } from '@angular/material/form-field';
30
- import { MatInputModule } from '@angular/material/input';
31
- import { MatTableModule } from '@angular/material/table';
32
- import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
33
- import { NoopAnimationsModule } from '@angular/platform-browser/animations';
34
- import { JsonFormsAngularService, JsonFormsModule } from '@jsonforms/angular';
35
- import { ControlElement } from '@jsonforms/core';
36
- import { TextControlRenderer, TextControlRendererTester } from '../src';
37
- import {
38
- TableRenderer,
39
- TableRendererTester
40
- } from '../src/other/table.renderer';
41
- import { FlexLayoutModule } from '@angular/flex-layout';
42
- import { setupMockStore } from '@jsonforms/angular-test';
43
- import { createTesterContext } from './util';
44
-
45
- const uischema1: ControlElement = { type: 'Control', scope: '#' };
46
- const uischema2: ControlElement = {
47
- type: 'Control',
48
- scope: '#/properties/my'
49
- };
50
- const schema_object1 = {
51
- type: 'array',
52
- items: {
53
- type: 'object',
54
- properties: {
55
- foo: { type: 'string' },
56
- bar: { type: 'string' }
57
- }
58
- }
59
- };
60
- const schema_object2 = {
61
- type: 'object',
62
- properties: {
63
- my: {
64
- type: 'array',
65
- items: {
66
- type: 'object',
67
- properties: {
68
- foo: { type: 'string' },
69
- bar: { type: 'string' }
70
- }
71
- }
72
- }
73
- }
74
- };
75
- const schema_simple1 = {
76
- type: 'array',
77
- items: {
78
- type: 'string'
79
- }
80
- };
81
- const schema_simple2 = {
82
- type: 'object',
83
- properties: {
84
- my: {
85
- type: 'array',
86
- items: {
87
- type: 'string'
88
- }
89
- }
90
- }
91
- };
92
- const renderers = [
93
- { tester: TextControlRendererTester, renderer: TextControlRenderer },
94
- { tester: TableRendererTester, renderer: TableRenderer }
95
- ];
96
-
97
- describe('Table tester', () => {
98
- it('should succeed', () => {
99
- expect(TableRendererTester(uischema1, schema_object1, createTesterContext(schema_object1))).toBe(3);
100
- expect(TableRendererTester(uischema1, schema_simple1, createTesterContext(schema_simple1))).toBe(3);
101
- expect(TableRendererTester(uischema2, schema_object2, createTesterContext(schema_object2))).toBe(3);
102
- expect(TableRendererTester(uischema2, schema_simple2, createTesterContext(schema_simple2))).toBe(3);
103
- });
104
- });
105
- describe('Table', () => {
106
- let fixture: ComponentFixture<any>;
107
- let component: any;
108
-
109
- beforeEach(async(() => {
110
- TestBed.configureTestingModule({
111
- declarations: [TableRenderer, TextControlRenderer],
112
- imports: [
113
- CommonModule,
114
- JsonFormsModule,
115
- MatCardModule,
116
- NoopAnimationsModule,
117
- MatFormFieldModule,
118
- MatInputModule,
119
- ReactiveFormsModule,
120
- FlexLayoutModule,
121
- MatTableModule
122
- ],
123
- providers: [JsonFormsAngularService]
124
- })
125
- .overrideModule(BrowserDynamicTestingModule, {
126
- set: {
127
- entryComponents: [TextControlRenderer]
128
- }
129
- })
130
- .compileComponents();
131
-
132
- fixture = TestBed.createComponent(TableRenderer);
133
- component = fixture.componentInstance;
134
- }));
135
-
136
- it('renders object array on root', async(() => {
137
- setupMockStore(fixture, {
138
- uischema: uischema1,
139
- schema: schema_object1,
140
- data: [
141
- { foo: 'foo_1', bar: 'bar_1' },
142
- { foo: 'foo_2', bar: 'bar_2' }
143
- ],
144
- renderers
145
- });
146
- fixture.detectChanges();
147
- component.ngOnInit();
148
- fixture.whenStable().then(() => {
149
- // 2 columns
150
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(2);
151
- // 1 head row and 2 data rows
152
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
153
- // 4 data entries
154
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(4);
155
- });
156
- }));
157
- it('renders object array on path', async(() => {
158
- setupMockStore(fixture, {
159
- uischema: uischema2,
160
- schema: schema_object2,
161
- data: {
162
- my: [
163
- { foo: 'foo_1', bar: 'bar_1' },
164
- { foo: 'foo_2', bar: 'bar_2' }
165
- ]
166
- },
167
- renderers
168
- });
169
-
170
- fixture.detectChanges();
171
- component.ngOnInit();
172
- fixture.whenStable().then(() => {
173
- // 2 columns
174
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(2);
175
- // 1 head row and 2 data rows
176
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
177
- // 4 data entries
178
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(4);
179
- });
180
- }));
181
-
182
- it('renders simple array on root', async(() => {
183
- setupMockStore(fixture, {
184
- uischema: uischema1,
185
- schema: schema_simple1,
186
- data: ['foo', 'bar'],
187
- renderers
188
- });
189
- fixture.detectChanges();
190
- component.ngOnInit();
191
- fixture.whenStable().then(() => {
192
- // 1 column
193
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(1);
194
- // 1 head row and 2 data rows
195
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
196
- // 2 data entries
197
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(2);
198
- });
199
- }));
200
- it('renders simple array on path', async(() => {
201
- setupMockStore(fixture, {
202
- uischema: uischema2,
203
- schema: schema_simple2,
204
- data: { my: ['foo', 'bar'] },
205
- renderers
206
- });
207
- fixture.detectChanges();
208
- component.ngOnInit();
209
- fixture.whenStable().then(() => {
210
- // 1 columns
211
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(1);
212
- // 1 head row and 2 data rows
213
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
214
- // 2 data entries
215
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(2);
216
- });
217
- }));
218
-
219
- it('can be disabled', async(() => {
220
- setupMockStore(fixture, {
221
- uischema: uischema1,
222
- schema: schema_object1,
223
- data: [{ foo: 'foo_1', bar: 'bar_1' }],
224
- renderers
225
- });
226
- component.disabled = true;
227
- fixture.detectChanges();
228
- component.ngOnInit();
229
- fixture.whenStable().then(() => {
230
- expect(fixture.nativeElement.querySelectorAll('input').length).toBe(2);
231
- expect(
232
- fixture.nativeElement.querySelectorAll('input')[0].disabled
233
- ).toBeTruthy();
234
- expect(
235
- fixture.nativeElement.querySelectorAll('input')[1].disabled
236
- ).toBeTruthy();
237
- });
238
- }));
239
- it('should be enabled by default', async(() => {
240
- setupMockStore(fixture, {
241
- uischema: uischema1,
242
- schema: schema_object1,
243
- data: [{ foo: 'foo_1', bar: 'bar_1' }],
244
- renderers
245
- });
246
- fixture.detectChanges();
247
- component.ngOnInit();
248
- fixture.whenStable().then(() => {
249
- expect(fixture.nativeElement.querySelectorAll('input').length).toBe(2);
250
- expect(fixture.nativeElement.querySelector('input').disabled).toBeFalsy();
251
- });
252
- }));
253
- });
@@ -1,108 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2017-2019 EclipseSource Munich
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { DebugElement } from '@angular/core';
26
- import { ReactiveFormsModule } from '@angular/forms';
27
- import { MatError, MatFormFieldModule } from '@angular/material/form-field';
28
- import { MatInputModule } from '@angular/material/input';
29
- import { NoopAnimationsModule } from '@angular/platform-browser/animations';
30
- import {
31
- ErrorTestExpectation,
32
- TestData,
33
- textBaseTest,
34
- textErrorTest,
35
- textInputEventTest
36
- } from '@jsonforms/angular-test';
37
- import { TextAreaRenderer, TextAreaRendererTester } from '../src';
38
- import { ControlElement, JsonSchema } from '@jsonforms/core';
39
- import { FlexLayoutModule } from '@angular/flex-layout';
40
- import { JsonFormsAngularService } from '@jsonforms/angular';
41
-
42
- describe('Material text field tester', () => {
43
- const uischema = {
44
- type: 'Control',
45
- scope: '#/properties/foo',
46
- options: { multi: true }
47
- };
48
-
49
- it('should succeed', () => {
50
- expect(
51
- TextAreaRendererTester(uischema, {
52
- type: 'object',
53
- properties: {
54
- foo: {
55
- type: 'string'
56
- }
57
- }
58
- }, undefined)
59
- ).toBe(2);
60
- });
61
- });
62
- const imports = [
63
- MatFormFieldModule,
64
- MatInputModule,
65
- NoopAnimationsModule,
66
- ReactiveFormsModule,
67
- FlexLayoutModule
68
- ];
69
- const providers = [JsonFormsAngularService];
70
- const componentUT: any = TextAreaRenderer;
71
- const errorTest: ErrorTestExpectation = {
72
- errorInstance: MatError,
73
- numberOfElements: 1,
74
- indexOfElement: 0
75
- };
76
- const toSelect = (el: DebugElement) => el.nativeElement;
77
- const testConfig = { imports, providers, componentUT };
78
- const defaultData = { foo: 'foo' };
79
- const defaultSchema: JsonSchema = {
80
- type: 'object',
81
- properties: {
82
- foo: {
83
- type: 'string'
84
- }
85
- }
86
- };
87
- const defaultUischema: ControlElement = {
88
- type: 'Control',
89
- scope: '#/properties/foo',
90
- options: { multi: true }
91
- };
92
- const defaultTestData: TestData<ControlElement> = {
93
- data: defaultData,
94
- schema: defaultSchema,
95
- uischema: defaultUischema
96
- };
97
- describe(
98
- 'Text control Base Tests',
99
- textBaseTest(testConfig, 'textarea', toSelect, defaultTestData)
100
- );
101
- describe(
102
- 'Text control Input Event Tests',
103
- textInputEventTest(testConfig, 'textarea', toSelect, defaultTestData)
104
- );
105
- describe(
106
- 'Text control Error Tests',
107
- textErrorTest(testConfig, errorTest, defaultTestData)
108
- );
@@ -1,89 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2017-2019 EclipseSource Munich
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { DebugElement } from '@angular/core';
26
- import { ReactiveFormsModule } from '@angular/forms';
27
- import { MatError, MatFormFieldModule } from '@angular/material/form-field';
28
- import { MatInputModule } from '@angular/material/input';
29
- import { NoopAnimationsModule } from '@angular/platform-browser/animations';
30
- import {
31
- ErrorTestExpectation,
32
- textBaseTest,
33
- textErrorTest,
34
- textInputEventTest,
35
- textTypeTest
36
- } from '@jsonforms/angular-test';
37
- import { TextControlRenderer, TextControlRendererTester } from '../src';
38
- import { FlexLayoutModule } from '@angular/flex-layout';
39
- import { JsonFormsAngularService } from '@jsonforms/angular';
40
-
41
- describe('Material text field tester', () => {
42
- const uischema = {
43
- type: 'Control',
44
- scope: '#/properties/foo'
45
- };
46
-
47
- it('should succeed', () => {
48
- expect(
49
- TextControlRendererTester(uischema, {
50
- type: 'object',
51
- properties: {
52
- foo: {
53
- type: 'string'
54
- }
55
- }
56
- }, undefined)
57
- ).toBe(1);
58
- });
59
- });
60
- const imports = [
61
- MatFormFieldModule,
62
- MatInputModule,
63
- NoopAnimationsModule,
64
- ReactiveFormsModule,
65
- FlexLayoutModule
66
- ];
67
- const providers = [JsonFormsAngularService];
68
- const componentUT: any = TextControlRenderer;
69
- const errorTest: ErrorTestExpectation = {
70
- errorInstance: MatError,
71
- numberOfElements: 1,
72
- indexOfElement: 0
73
- };
74
- const toSelect = (el: DebugElement) => el.nativeElement;
75
- const testConfig = { imports, providers, componentUT };
76
-
77
- describe(
78
- 'Text control Base Tests',
79
- textBaseTest(testConfig, 'input', toSelect)
80
- );
81
- describe(
82
- 'Text control Input Event Tests',
83
- textInputEventTest(testConfig, 'input', toSelect)
84
- );
85
- describe('Text control Error Tests', textErrorTest(testConfig, errorTest));
86
- describe(
87
- 'Text control Type Tests',
88
- textTypeTest(testConfig, 'input', toSelect)
89
- );
@@ -1,77 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2017-2019 EclipseSource Munich
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { MatError, MatFormFieldModule } from '@angular/material/form-field';
26
- import { MatSlideToggle, MatSlideToggleModule } from '@angular/material/slide-toggle';
27
- import {
28
- booleanBaseTest,
29
- booleanErrorTest,
30
- booleanInputEventTest,
31
- ErrorTestExpectation
32
- } from '@jsonforms/angular-test';
33
- import { ToggleControlRenderer, ToggleControlRendererTester } from '../src';
34
- import { FlexLayoutModule } from '@angular/flex-layout';
35
- import { JsonFormsAngularService } from '@jsonforms/angular';
36
-
37
- describe('Material boolean field tester', () => {
38
- const uischema = {
39
- type: 'Control',
40
- scope: '#/properties/foo',
41
- options: { toggle: true }
42
- };
43
-
44
- it('should succeed', () => {
45
- expect(
46
- ToggleControlRendererTester(uischema, {
47
- type: 'object',
48
- properties: {
49
- foo: {
50
- type: 'boolean'
51
- }
52
- }
53
- }, undefined)
54
- ).toBe(3);
55
- });
56
- });
57
- const imports = [MatSlideToggleModule, MatFormFieldModule, FlexLayoutModule];
58
- const providers = [JsonFormsAngularService];
59
- const componentUT: any = ToggleControlRenderer;
60
- const errorTest: ErrorTestExpectation = {
61
- errorInstance: MatError,
62
- numberOfElements: 1,
63
- indexOfElement: 0
64
- };
65
- const testConfig = { imports, providers, componentUT };
66
- describe(
67
- 'Toggle control Base Tests',
68
- booleanBaseTest(testConfig, MatSlideToggle)
69
- );
70
- describe(
71
- 'Toggle control Input Event Tests',
72
- booleanInputEventTest(testConfig, MatSlideToggle, 'label')
73
- );
74
- describe(
75
- 'Toggle control Error Tests',
76
- booleanErrorTest(testConfig, MatSlideToggle, errorTest)
77
- );
@@ -1,18 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "../dist/test",
5
- "target": "es6",
6
- "inlineSourceMap": true
7
- },
8
- "include": [
9
- "**/*.ts",
10
- "**/*.tsx"
11
- ],
12
- "exclude":[
13
- "node_modules"
14
- ],
15
- "files": [
16
- "../src/index.ts"
17
- ]
18
- }
package/test/util.ts DELETED
@@ -1,28 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2022 EclipseSource
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { JsonSchema, TesterContext } from '@jsonforms/core';
26
-
27
- export const createTesterContext =
28
- (rootSchema: JsonSchema, config?: any): TesterContext => ({ rootSchema, config });
@@ -1,113 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2017-2019 EclipseSource Munich
5
- https://github.com/eclipsesource/jsonforms
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- */
25
- import { ComponentFixture } from '@angular/core/testing';
26
- import { UISchemaElement, VerticalLayout } from '@jsonforms/core';
27
- import { beforeEachLayoutTest, setupMockStore } from '@jsonforms/angular-test';
28
- import { FlexLayoutModule } from '@angular/flex-layout';
29
- import {
30
- VerticalLayoutRenderer,
31
- verticalLayoutTester
32
- } from '../src/layouts/vertical-layout.renderer';
33
-
34
- describe('Vertical layout tester', () => {
35
- it('should succeed', () => {
36
- expect(verticalLayoutTester({ type: 'VerticalLayout' }, undefined, undefined)).toBe(1);
37
- });
38
- });
39
- describe('Vertical layout', () => {
40
- let fixture: ComponentFixture<any>;
41
- let component: any;
42
-
43
- beforeEach(() => {
44
- fixture = beforeEachLayoutTest(VerticalLayoutRenderer, {
45
- imports: [FlexLayoutModule]
46
- });
47
- component = fixture.componentInstance;
48
- });
49
-
50
- it('render with undefined elements', () => {
51
- const uischema: UISchemaElement = {
52
- type: 'VerticalLayout'
53
- };
54
- setupMockStore(fixture, {
55
- data: {},
56
- schema: {},
57
- uischema
58
- });
59
- fixture.componentInstance.ngOnInit();
60
- fixture.detectChanges();
61
- expect(fixture.nativeElement.children[0].children.length).toBe(0);
62
- // the component is wrapped in a div
63
- expect(fixture.nativeElement.children[0].style.display).not.toBe('none');
64
- });
65
-
66
- it('render with null elements', () => {
67
- const uischema: VerticalLayout = {
68
- type: 'VerticalLayout',
69
- elements: null
70
- };
71
-
72
- setupMockStore(fixture, {
73
- data: {},
74
- schema: {},
75
- uischema
76
- });
77
- fixture.componentInstance.ngOnInit();
78
- fixture.detectChanges();
79
- expect(fixture.nativeElement.children[0].children.length).toBe(0);
80
- });
81
-
82
- it('render with children', () => {
83
- const uischema: VerticalLayout = {
84
- type: 'VerticalLayout',
85
- elements: [{ type: 'Control' }, { type: 'Control' }]
86
- };
87
- setupMockStore(fixture, {
88
- data: {},
89
- schema: {},
90
- uischema
91
- });
92
- fixture.componentInstance.ngOnInit();
93
- fixture.detectChanges();
94
- expect(fixture.nativeElement.children[0].children.length).toBe(2);
95
- expect(fixture.nativeElement.children[0].hidden).toBe(false);
96
- });
97
-
98
- // TODO: broken due to https://github.com/angular/flex-layout/issues/848
99
- xit('can be hidden', () => {
100
- const uischema: VerticalLayout = {
101
- type: 'VerticalLayout',
102
- elements: [{ type: 'Control' }, { type: 'Control' }]
103
- };
104
- component.visible = false;
105
- setupMockStore(fixture, {
106
- data: {},
107
- schema: {},
108
- uischema
109
- });
110
- component.ngOnInit();
111
- expect(fixture.nativeElement.children[0].style.display).toBe('none');
112
- });
113
- });