@jsonforms/angular-material 3.1.0-alpha.0 → 3.1.0-alpha.2

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 (216) hide show
  1. package/README.md +30 -30
  2. package/lib/cjs/controls/autocomplete.renderer.d.ts +4 -3
  3. package/lib/cjs/controls/autocomplete.renderer.js +3 -4
  4. package/lib/cjs/controls/autocomplete.renderer.js.map +1 -1
  5. package/lib/cjs/controls/autocomplete.renderer.metadata.json +1 -1
  6. package/lib/cjs/controls/boolean.renderer.js +2 -2
  7. package/lib/cjs/controls/boolean.renderer.js.map +1 -1
  8. package/lib/cjs/controls/boolean.renderer.metadata.json +1 -1
  9. package/lib/cjs/controls/date.renderer.js +2 -2
  10. package/lib/cjs/controls/date.renderer.js.map +1 -1
  11. package/lib/cjs/controls/date.renderer.metadata.json +1 -1
  12. package/lib/cjs/controls/number.renderer.js +4 -4
  13. package/lib/cjs/controls/number.renderer.js.map +1 -1
  14. package/lib/cjs/controls/number.renderer.metadata.json +1 -1
  15. package/lib/cjs/controls/range.renderer.js +2 -2
  16. package/lib/cjs/controls/range.renderer.js.map +1 -1
  17. package/lib/cjs/controls/range.renderer.metadata.json +1 -1
  18. package/lib/cjs/controls/text.renderer.js +2 -2
  19. package/lib/cjs/controls/text.renderer.js.map +1 -1
  20. package/lib/cjs/controls/text.renderer.metadata.json +1 -1
  21. package/lib/cjs/controls/textarea.renderer.js +2 -2
  22. package/lib/cjs/controls/textarea.renderer.js.map +1 -1
  23. package/lib/cjs/controls/textarea.renderer.metadata.json +1 -1
  24. package/lib/cjs/controls/toggle.renderer.js +2 -2
  25. package/lib/cjs/controls/toggle.renderer.js.map +1 -1
  26. package/lib/cjs/controls/toggle.renderer.metadata.json +1 -1
  27. package/lib/cjs/index.js +1 -1
  28. package/lib/cjs/layouts/array-layout.renderer.d.ts +2 -10
  29. package/lib/cjs/layouts/array-layout.renderer.js +5 -11
  30. package/lib/cjs/layouts/array-layout.renderer.js.map +1 -1
  31. package/lib/cjs/layouts/array-layout.renderer.metadata.json +1 -1
  32. package/lib/cjs/layouts/categorization-layout.renderer.js +2 -2
  33. package/lib/cjs/layouts/categorization-layout.renderer.js.map +1 -1
  34. package/lib/cjs/layouts/categorization-layout.renderer.metadata.json +1 -1
  35. package/lib/cjs/layouts/group-layout.renderer.js +2 -2
  36. package/lib/cjs/layouts/group-layout.renderer.js.map +1 -1
  37. package/lib/cjs/layouts/group-layout.renderer.metadata.json +1 -1
  38. package/lib/cjs/layouts/horizontal-layout.renderer.js +2 -2
  39. package/lib/cjs/layouts/horizontal-layout.renderer.js.map +1 -1
  40. package/lib/cjs/layouts/horizontal-layout.renderer.metadata.json +1 -1
  41. package/lib/cjs/layouts/layout.renderer.js +3 -3
  42. package/lib/cjs/layouts/layout.renderer.js.map +1 -1
  43. package/lib/cjs/layouts/layout.renderer.metadata.json +1 -1
  44. package/lib/cjs/layouts/vertical-layout.renderer.js +2 -2
  45. package/lib/cjs/layouts/vertical-layout.renderer.js.map +1 -1
  46. package/lib/cjs/layouts/vertical-layout.renderer.metadata.json +1 -1
  47. package/lib/cjs/module.js +5 -5
  48. package/lib/cjs/module.js.map +1 -1
  49. package/lib/cjs/module.metadata.json +1 -1
  50. package/lib/cjs/other/label.renderer.d.ts +2 -1
  51. package/lib/cjs/other/label.renderer.js +2 -2
  52. package/lib/cjs/other/label.renderer.js.map +1 -1
  53. package/lib/cjs/other/label.renderer.metadata.json +1 -1
  54. package/lib/cjs/other/master-detail/detail.js +2 -2
  55. package/lib/cjs/other/master-detail/detail.js.map +1 -1
  56. package/lib/cjs/other/master-detail/detail.metadata.json +1 -1
  57. package/lib/cjs/other/master-detail/master.d.ts +4 -3
  58. package/lib/cjs/other/master-detail/master.js +13 -6
  59. package/lib/cjs/other/master-detail/master.js.map +1 -1
  60. package/lib/cjs/other/master-detail/master.metadata.json +1 -1
  61. package/lib/cjs/other/object.renderer.js +1 -1
  62. package/lib/cjs/other/table.renderer.d.ts +4 -2
  63. package/lib/cjs/other/table.renderer.js +10 -12
  64. package/lib/cjs/other/table.renderer.js.map +1 -1
  65. package/lib/cjs/other/table.renderer.metadata.json +1 -1
  66. package/lib/esm/controls/autocomplete.renderer.d.ts +4 -3
  67. package/lib/esm/controls/autocomplete.renderer.js +5 -6
  68. package/lib/esm/controls/autocomplete.renderer.js.map +1 -1
  69. package/lib/esm/controls/autocomplete.renderer.metadata.json +1 -1
  70. package/lib/esm/controls/boolean.renderer.js +3 -3
  71. package/lib/esm/controls/boolean.renderer.js.map +1 -1
  72. package/lib/esm/controls/boolean.renderer.metadata.json +1 -1
  73. package/lib/esm/controls/date.renderer.js +2 -2
  74. package/lib/esm/controls/date.renderer.js.map +1 -1
  75. package/lib/esm/controls/date.renderer.metadata.json +1 -1
  76. package/lib/esm/controls/number.renderer.js +5 -5
  77. package/lib/esm/controls/number.renderer.js.map +1 -1
  78. package/lib/esm/controls/number.renderer.metadata.json +1 -1
  79. package/lib/esm/controls/range.renderer.js +3 -3
  80. package/lib/esm/controls/range.renderer.js.map +1 -1
  81. package/lib/esm/controls/range.renderer.metadata.json +1 -1
  82. package/lib/esm/controls/text.renderer.js +2 -2
  83. package/lib/esm/controls/text.renderer.js.map +1 -1
  84. package/lib/esm/controls/text.renderer.metadata.json +1 -1
  85. package/lib/esm/controls/textarea.renderer.js +2 -2
  86. package/lib/esm/controls/textarea.renderer.js.map +1 -1
  87. package/lib/esm/controls/textarea.renderer.metadata.json +1 -1
  88. package/lib/esm/controls/toggle.renderer.js +4 -4
  89. package/lib/esm/controls/toggle.renderer.js.map +1 -1
  90. package/lib/esm/controls/toggle.renderer.metadata.json +1 -1
  91. package/lib/esm/index.js +16 -16
  92. package/lib/esm/index.js.map +1 -1
  93. package/lib/esm/layouts/array-layout.renderer.d.ts +2 -10
  94. package/lib/esm/layouts/array-layout.renderer.js +8 -14
  95. package/lib/esm/layouts/array-layout.renderer.js.map +1 -1
  96. package/lib/esm/layouts/array-layout.renderer.metadata.json +1 -1
  97. package/lib/esm/layouts/categorization-layout.renderer.js +4 -4
  98. package/lib/esm/layouts/categorization-layout.renderer.js.map +1 -1
  99. package/lib/esm/layouts/categorization-layout.renderer.metadata.json +1 -1
  100. package/lib/esm/layouts/group-layout.renderer.js +3 -3
  101. package/lib/esm/layouts/group-layout.renderer.js.map +1 -1
  102. package/lib/esm/layouts/group-layout.renderer.metadata.json +1 -1
  103. package/lib/esm/layouts/horizontal-layout.renderer.js +4 -4
  104. package/lib/esm/layouts/horizontal-layout.renderer.js.map +1 -1
  105. package/lib/esm/layouts/horizontal-layout.renderer.metadata.json +1 -1
  106. package/lib/esm/layouts/layout.renderer.js +6 -6
  107. package/lib/esm/layouts/layout.renderer.js.map +1 -1
  108. package/lib/esm/layouts/layout.renderer.metadata.json +1 -1
  109. package/lib/esm/layouts/vertical-layout.renderer.js +4 -4
  110. package/lib/esm/layouts/vertical-layout.renderer.js.map +1 -1
  111. package/lib/esm/layouts/vertical-layout.renderer.metadata.json +1 -1
  112. package/lib/esm/module.js +5 -5
  113. package/lib/esm/module.js.map +1 -1
  114. package/lib/esm/module.metadata.json +1 -1
  115. package/lib/esm/other/label.renderer.d.ts +2 -1
  116. package/lib/esm/other/label.renderer.js +3 -3
  117. package/lib/esm/other/label.renderer.js.map +1 -1
  118. package/lib/esm/other/label.renderer.metadata.json +1 -1
  119. package/lib/esm/other/master-detail/detail.js +2 -2
  120. package/lib/esm/other/master-detail/detail.js.map +1 -1
  121. package/lib/esm/other/master-detail/detail.metadata.json +1 -1
  122. package/lib/esm/other/master-detail/master.d.ts +4 -3
  123. package/lib/esm/other/master-detail/master.js +16 -9
  124. package/lib/esm/other/master-detail/master.js.map +1 -1
  125. package/lib/esm/other/master-detail/master.metadata.json +1 -1
  126. package/lib/esm/other/object.renderer.js +3 -3
  127. package/lib/esm/other/object.renderer.js.map +1 -1
  128. package/lib/esm/other/table.renderer.d.ts +4 -2
  129. package/lib/esm/other/table.renderer.js +12 -14
  130. package/lib/esm/other/table.renderer.js.map +1 -1
  131. package/lib/esm/other/table.renderer.metadata.json +1 -1
  132. package/package.json +36 -10
  133. package/src/controls/autocomplete.renderer.ts +25 -14
  134. package/src/controls/boolean.renderer.ts +14 -4
  135. package/src/controls/date.renderer.ts +7 -11
  136. package/src/controls/number.renderer.ts +20 -10
  137. package/src/controls/range.renderer.ts +13 -4
  138. package/src/controls/text.renderer.ts +5 -3
  139. package/src/controls/textarea.renderer.ts +5 -3
  140. package/src/controls/toggle.renderer.ts +14 -5
  141. package/src/index.ts +16 -16
  142. package/src/layouts/array-layout.renderer.ts +40 -42
  143. package/src/layouts/categorization-layout.renderer.ts +22 -11
  144. package/src/layouts/group-layout.renderer.ts +17 -4
  145. package/src/layouts/horizontal-layout.renderer.ts +18 -5
  146. package/src/layouts/layout.renderer.ts +32 -19
  147. package/src/layouts/vertical-layout.renderer.ts +18 -5
  148. package/src/module.ts +7 -9
  149. package/src/other/label.renderer.ts +13 -9
  150. package/src/other/master-detail/detail.ts +2 -2
  151. package/src/other/master-detail/master.ts +50 -26
  152. package/src/other/object.renderer.ts +3 -3
  153. package/src/other/table.renderer.ts +58 -35
  154. package/src/other/util.ts +10 -3
  155. package/docs/assets/css/main.css +0 -1
  156. package/docs/assets/images/icons.png +0 -0
  157. package/docs/assets/images/icons@2x.png +0 -0
  158. package/docs/assets/images/widgets.png +0 -0
  159. package/docs/assets/images/widgets@2x.png +0 -0
  160. package/docs/assets/js/main.js +0 -51
  161. package/docs/assets/js/search.json +0 -1
  162. package/docs/classes/arraylayoutrenderer.html +0 -1256
  163. package/docs/classes/autocompletecontrolrenderer.html +0 -887
  164. package/docs/classes/booleancontrolrenderer.html +0 -771
  165. package/docs/classes/categorizationtablayoutrenderer.html +0 -384
  166. package/docs/classes/datecontrolrenderer.html +0 -739
  167. package/docs/classes/grouplayoutrenderer.html +0 -396
  168. package/docs/classes/horizontallayoutrenderer.html +0 -396
  169. package/docs/classes/jsonformsangularmaterialmodule.html +0 -133
  170. package/docs/classes/jsonformsdetailcomponent.html +0 -227
  171. package/docs/classes/labelrenderer.html +0 -363
  172. package/docs/classes/layoutchildrenrenderpropspipe.html +0 -189
  173. package/docs/classes/layoutrenderer.html +0 -436
  174. package/docs/classes/masterlistcomponent.html +0 -1054
  175. package/docs/classes/numbercontrolrenderer.html +0 -893
  176. package/docs/classes/objectcontrolrenderer.html +0 -761
  177. package/docs/classes/rangecontrolrenderer.html +0 -792
  178. package/docs/classes/tablerenderer.html +0 -1222
  179. package/docs/classes/textarearenderer.html +0 -739
  180. package/docs/classes/textcontrolrenderer.html +0 -760
  181. package/docs/classes/togglecontrolrenderer.html +0 -771
  182. package/docs/classes/verticallayoutrenderer.html +0 -396
  183. package/docs/globals.html +0 -610
  184. package/docs/index.html +0 -378
  185. package/docs/interfaces/columndescription.html +0 -192
  186. package/docs/interfaces/ownpropsofautocomplete.html +0 -327
  187. package/example/app/app.component.ts +0 -122
  188. package/example/app/app.module.ts +0 -42
  189. package/example/index.html +0 -25
  190. package/example/main.ts +0 -37
  191. package/test/autocomplete-control.spec.ts +0 -322
  192. package/test/boolean-control.spec.ts +0 -76
  193. package/test/categorization-tab-layout.spec.ts +0 -330
  194. package/test/date-control.spec.ts +0 -280
  195. package/test/group-layout.spec.ts +0 -105
  196. package/test/horizontal-layout.spec.ts +0 -96
  197. package/test/label-renderer.spec.ts +0 -78
  198. package/test/master-detail.spec.ts +0 -408
  199. package/test/number-control.spec.ts +0 -208
  200. package/test/object-control.spec.ts +0 -247
  201. package/test/range-control.spec.ts +0 -104
  202. package/test/table-control.spec.ts +0 -369
  203. package/test/text-area.spec.ts +0 -108
  204. package/test/text-control.spec.ts +0 -89
  205. package/test/toggle-control.spec.ts +0 -77
  206. package/test/tsconfig.test.json +0 -18
  207. package/test/util.ts +0 -28
  208. package/test/vertical-layout.spec.ts +0 -115
  209. package/test-config/karma-test-shim.js +0 -21
  210. package/test-config/karma.conf.js +0 -58
  211. package/test-config/protractor.conf.js +0 -28
  212. package/test-config/webpack.test.js +0 -65
  213. package/tsconfig.cjs.json +0 -9
  214. package/tsconfig.json +0 -16
  215. package/webpack/webpack.build.js +0 -13
  216. package/webpack/webpack.dev.js +0 -37
@@ -1,369 +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 { MatIconModule } from '@angular/material/icon';
32
- import { MatTableModule } from '@angular/material/table';
33
- import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
34
- import { NoopAnimationsModule } from '@angular/platform-browser/animations';
35
- import { JsonFormsAngularService, JsonFormsModule } from '@jsonforms/angular';
36
- import { ControlElement } from '@jsonforms/core';
37
- import { TextControlRenderer, TextControlRendererTester } from '../src';
38
- import {
39
- TableRenderer,
40
- TableRendererTester
41
- } from '../src/other/table.renderer';
42
- import { FlexLayoutModule } from '@angular/flex-layout';
43
- import { setupMockStore } from '@jsonforms/angular-test';
44
- import { createTesterContext } from './util';
45
-
46
- const uischema1: ControlElement = { type: 'Control', scope: '#' };
47
- const uischema2: ControlElement = {
48
- type: 'Control',
49
- scope: '#/properties/my'
50
- };
51
- const uischemaWithSorting: ControlElement = {
52
- type: 'Control',
53
- scope: '#',
54
- options: {
55
- showSortButtons: true
56
- }
57
- };
58
- const schema_object1 = {
59
- type: 'array',
60
- items: {
61
- type: 'object',
62
- properties: {
63
- foo: { type: 'string' },
64
- bar: { type: 'string' }
65
- }
66
- }
67
- };
68
- const schema_object2 = {
69
- type: 'object',
70
- properties: {
71
- my: {
72
- type: 'array',
73
- items: {
74
- type: 'object',
75
- properties: {
76
- foo: { type: 'string' },
77
- bar: { type: 'string' }
78
- }
79
- }
80
- }
81
- }
82
- };
83
- const schema_simple1 = {
84
- type: 'array',
85
- items: {
86
- type: 'string'
87
- }
88
- };
89
- const schema_simple2 = {
90
- type: 'object',
91
- properties: {
92
- my: {
93
- type: 'array',
94
- items: {
95
- type: 'string'
96
- }
97
- }
98
- }
99
- };
100
- const renderers = [
101
- { tester: TextControlRendererTester, renderer: TextControlRenderer },
102
- { tester: TableRendererTester, renderer: TableRenderer }
103
- ];
104
-
105
- describe('Table tester', () => {
106
- it('should succeed', () => {
107
- expect(TableRendererTester(uischema1, schema_object1, createTesterContext(schema_object1))).toBe(3);
108
- expect(TableRendererTester(uischema1, schema_simple1, createTesterContext(schema_simple1))).toBe(3);
109
- expect(TableRendererTester(uischema2, schema_object2, createTesterContext(schema_object2))).toBe(3);
110
- expect(TableRendererTester(uischema2, schema_simple2, createTesterContext(schema_simple2))).toBe(3);
111
- });
112
- });
113
- describe('Table', () => {
114
- let fixture: ComponentFixture<any>;
115
- let component: any;
116
-
117
- beforeEach(async(() => {
118
- TestBed.configureTestingModule({
119
- declarations: [TableRenderer, TextControlRenderer],
120
- imports: [
121
- CommonModule,
122
- JsonFormsModule,
123
- MatCardModule,
124
- NoopAnimationsModule,
125
- MatFormFieldModule,
126
- MatIconModule,
127
- MatInputModule,
128
- ReactiveFormsModule,
129
- FlexLayoutModule,
130
- MatTableModule
131
- ],
132
- providers: [JsonFormsAngularService]
133
- })
134
- .overrideModule(BrowserDynamicTestingModule, {
135
- set: {
136
- entryComponents: [TextControlRenderer]
137
- }
138
- })
139
- .compileComponents();
140
-
141
- fixture = TestBed.createComponent(TableRenderer);
142
- component = fixture.componentInstance;
143
- }));
144
-
145
- it('renders object array on root', async(() => {
146
- setupMockStore(fixture, {
147
- uischema: uischema1,
148
- schema: schema_object1,
149
- data: [
150
- { foo: 'foo_1', bar: 'bar_1' },
151
- { foo: 'foo_2', bar: 'bar_2' }
152
- ],
153
- renderers
154
- });
155
- fixture.detectChanges();
156
- component.ngOnInit();
157
- fixture.whenStable().then(() => {
158
- // 2 columns
159
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(3);
160
- // 1 head row and 2 data rows
161
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
162
- // 4 data entries
163
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(6);
164
- });
165
- }));
166
- it('renders object array on path', async(() => {
167
- setupMockStore(fixture, {
168
- uischema: uischema2,
169
- schema: schema_object2,
170
- data: {
171
- my: [
172
- { foo: 'foo_1', bar: 'bar_1' },
173
- { foo: 'foo_2', bar: 'bar_2' }
174
- ]
175
- },
176
- renderers
177
- });
178
-
179
- fixture.detectChanges();
180
- component.ngOnInit();
181
- fixture.whenStable().then(() => {
182
- // 2 columns
183
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(3);
184
- // 1 head row and 2 data rows
185
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
186
- // 4 data entries
187
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(6);
188
- });
189
- }));
190
-
191
- it('renders simple array on root', async(() => {
192
- setupMockStore(fixture, {
193
- uischema: uischema1,
194
- schema: schema_simple1,
195
- data: ['foo', 'bar'],
196
- renderers
197
- });
198
- fixture.detectChanges();
199
- component.ngOnInit();
200
- fixture.whenStable().then(() => {
201
- // 1 column
202
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(2);
203
- // 1 head row and 2 data rows
204
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
205
- // 2 data entries
206
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(4);
207
- });
208
- }));
209
- it('renders simple array on path', async(() => {
210
- setupMockStore(fixture, {
211
- uischema: uischema2,
212
- schema: schema_simple2,
213
- data: { my: ['foo', 'bar'] },
214
- renderers
215
- });
216
- fixture.detectChanges();
217
- component.ngOnInit();
218
- fixture.whenStable().then(() => {
219
- // 1 columns
220
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(2);
221
- // 1 head row and 2 data rows
222
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
223
- // 2 data entries
224
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(4);
225
- });
226
- }));
227
-
228
- it('can be disabled', async(() => {
229
- setupMockStore(fixture, {
230
- uischema: uischema1,
231
- schema: schema_object1,
232
- data: [{ foo: 'foo_1', bar: 'bar_1' }],
233
- renderers
234
- });
235
- component.disabled = true;
236
- fixture.detectChanges();
237
- component.ngOnInit();
238
- fixture.whenStable().then(() => {
239
- expect(fixture.nativeElement.querySelectorAll('input').length).toBe(2);
240
- expect(
241
- fixture.nativeElement.querySelectorAll('input')[0].disabled
242
- ).toBeTruthy();
243
- expect(
244
- fixture.nativeElement.querySelectorAll('input')[1].disabled
245
- ).toBeTruthy();
246
- });
247
- }));
248
- it('should be enabled by default', async(() => {
249
- setupMockStore(fixture, {
250
- uischema: uischema1,
251
- schema: schema_object1,
252
- data: [{ foo: 'foo_1', bar: 'bar_1' }],
253
- renderers
254
- });
255
- fixture.detectChanges();
256
- component.ngOnInit();
257
- fixture.whenStable().then(() => {
258
- component.add();
259
- expect(fixture.nativeElement.querySelectorAll('input').length).toBe(2);
260
- expect(fixture.nativeElement.querySelector('input').disabled).toBeFalsy();
261
- });
262
- }));
263
-
264
- it('renderer handles removing of rows', async(() => {
265
- setupMockStore(fixture, {
266
- uischema: uischema1,
267
- schema: schema_object1,
268
- data: [
269
- { foo: 'foo_1', bar: 'bar_1' },
270
- { foo: 'foo_2', bar: 'bar_2' }
271
- ],
272
- renderers
273
- });
274
-
275
- fixture.detectChanges();
276
- component.ngOnInit();
277
- component.remove(0);
278
- component.remove(0);
279
- fixture.detectChanges();
280
-
281
- fixture.whenStable().then(() => {
282
-
283
- // 1 row
284
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 0);
285
- });
286
- }));
287
-
288
- it('renderer handles adding of rows', async(() => {
289
- setupMockStore(fixture, {
290
- uischema: uischema1,
291
- schema: schema_object1,
292
- data: [
293
- { foo: 'foo_1', bar: 'bar_1' },
294
- { foo: 'foo_2', bar: 'bar_2' }
295
- ],
296
- renderers
297
- });
298
-
299
- fixture.detectChanges();
300
- component.ngOnInit();
301
-
302
- component.add();
303
- component.add();
304
- fixture.detectChanges();
305
-
306
- fixture.whenStable().then(() => {
307
- // 3 row
308
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 4);
309
-
310
- });
311
- }));
312
-
313
- it('when disabled doesnt render `add` nor `remove` icons', async(() => {
314
- setupMockStore(fixture, {
315
- uischema: uischema1,
316
- schema: schema_object1,
317
- data: [
318
- { foo: 'foo_1', bar: 'bar_1' },
319
- { foo: 'foo_2', bar: 'bar_2' }
320
- ],
321
- renderers
322
- });
323
- component.disabled = true;
324
- fixture.detectChanges();
325
-
326
- component.ngOnInit();
327
- fixture.whenStable().then(() => {
328
- // 2 columns
329
- expect(fixture.nativeElement.querySelectorAll('th').length).toBe(2);
330
- // 2 rows
331
- expect(fixture.nativeElement.querySelectorAll('tr').length).toBe(1 + 2);
332
- // 2 data entries
333
- expect(fixture.nativeElement.querySelectorAll('td').length).toBe(4);
334
- });
335
- }));
336
- it('when options.showSortButtons is True, it should render sort buttons', async(() => {
337
- setupMockStore(fixture, {
338
- uischema: uischemaWithSorting,
339
- schema: schema_simple1,
340
- data: ['foo', 'bar'],
341
- renderers
342
- });
343
- component.disabled = false;
344
- fixture.detectChanges();
345
-
346
- component.ngOnInit();
347
- fixture.whenStable().then(() => {
348
- expect(fixture.nativeElement.querySelectorAll('.item-up').length).toBe(2);
349
- expect(fixture.nativeElement.querySelectorAll('.item-down').length).toBe(2);
350
- });
351
- }));
352
- it('when options.showSortButtons is False, it should NOT render sort buttons', async(() => {
353
- setupMockStore(fixture, {
354
- uischema: uischema1,
355
- schema: schema_simple1,
356
- data: ['foo', 'bar'],
357
- renderers
358
- });
359
- component.disabled = false;
360
- fixture.detectChanges();
361
-
362
- component.ngOnInit();
363
- fixture.whenStable().then(() => {
364
- expect(fixture.nativeElement.querySelectorAll('.item-up').length).toBe(0);
365
- expect(fixture.nativeElement.querySelectorAll('.item-down').length).toBe(0);
366
- });
367
- }));
368
-
369
- });
@@ -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 });