Skip to content

Commit 85c7083

Browse files
committed
fixed tests
1 parent c17946d commit 85c7083

14 files changed

+181
-28
lines changed

test/renderers/array-renderer.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ import { JsonSchema } from '../../src/models/jsonSchema';
99
import { ControlElement } from '../../src/models/uischema';
1010
import { ArrayControlRenderer, arrayTester } from '../../src/renderers/additional/array-renderer';
1111
import { instantiateSchemaService } from '../../src/core';
12-
12+
import { JsonForms } from '../../src/core';
13+
test.before(t => {
14+
JsonForms.stylingRegistry.registerMany([
15+
{
16+
name: 'array.layout',
17+
classNames: ['array-layout']
18+
},
19+
{
20+
name: 'array.children',
21+
classNames: ['children']
22+
}
23+
]);
24+
});
1325
test('generate array child control', t => {
1426

1527
const renderer: ArrayControlRenderer = new ArrayControlRenderer();

test/renderers/boolean.control.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ installCE(global, 'force');
77
import { DataService } from '../../src/core/data.service';
88
import { ControlElement } from '../../src/models/uischema';
99
import { BooleanControl, booleanControlTester } from '../../src/renderers/controls/boolean.control';
10+
import { JsonForms } from '../../src/core';
1011
import {
1112
testDisable, testEnable, testHide,
1213
testMultipleErrors,
@@ -19,7 +20,18 @@ import {
1920
testShow,
2021
testUndefinedErrors
2122
} from './base.control.tests';
22-
23+
test.before(t => {
24+
JsonForms.stylingRegistry.registerMany([
25+
{
26+
name: 'control',
27+
classNames: ['control']
28+
},
29+
{
30+
name: 'control.validation',
31+
classNames: ['validation']
32+
}
33+
]);
34+
});
2335
test.beforeEach(t => {
2436
t.context.data = { 'foo': true };
2537
t.context.schema = {

test/renderers/categorization.control.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,32 @@ import {
1010
CategorizationRenderer,
1111
categorizationTester
1212
} from '../../src/renderers/additional/categorization-renderer';
13+
import { JsonForms } from '../../src/core';
1314
import { testNotifyAboutVisibiltyWhenDisconnected } from './base.control.tests';
14-
15+
test.before(t => {
16+
JsonForms.stylingRegistry.registerMany([
17+
{
18+
name: 'categorization',
19+
classNames: ['jsf-categorization']
20+
},
21+
{
22+
name: 'categorization.master',
23+
classNames: ['jsf-categorization-master']
24+
},
25+
{
26+
name: 'category.group',
27+
classNames: ['jsf-category-group']
28+
},
29+
{
30+
name: 'category.subcategories',
31+
classNames: ['jsf-category-subcategories']
32+
},
33+
{
34+
name: 'categorization.detail',
35+
classNames: ['jsf-categorization-detail']
36+
}
37+
]);
38+
});
1539
test.beforeEach(t => {
1640
t.context.data = { };
1741
t.context.uiSchema = {

test/renderers/date.control.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ installCE(global, 'force');
77
import { DataService } from '../../src/core/data.service';
88
import { ControlElement } from '../../src/models/uischema';
99
import { DateControl, dateControlTester } from '../../src/renderers/controls/date.control';
10+
import { JsonForms } from '../../src/core';
1011
import {
1112
testDisable,
1213
testEnable, testHide,
@@ -20,7 +21,18 @@ import {
2021
testShow,
2122
testUndefinedErrors
2223
} from './base.control.tests';
23-
24+
test.before(t => {
25+
JsonForms.stylingRegistry.registerMany([
26+
{
27+
name: 'control',
28+
classNames: ['control']
29+
},
30+
{
31+
name: 'control.validation',
32+
classNames: ['validation']
33+
}
34+
]);
35+
});
2436
test.beforeEach(t => {
2537
t.context.data = {'foo': '1980-04-04'};
2638
t.context.schema = {

test/renderers/enum.control.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ installCE(global, 'force');
77
import { DataService } from '../../src/core/data.service';
88
import { ControlElement } from '../../src/models/uischema';
99
import { EnumControl, enumControlTester } from '../../src/renderers/controls/enum.control';
10+
import { JsonForms } from '../../src/core';
1011
import {
1112
testDisable,
1213
testEnable, testHide,
@@ -20,7 +21,18 @@ import {
2021
testShow,
2122
testUndefinedErrors
2223
} from './base.control.tests';
23-
24+
test.before(t => {
25+
JsonForms.stylingRegistry.registerMany([
26+
{
27+
name: 'control',
28+
classNames: ['control']
29+
},
30+
{
31+
name: 'control.validation',
32+
classNames: ['validation']
33+
}
34+
]);
35+
});
2436
test.beforeEach(t => {
2537
t.context.data = { 'foo': 'a' };
2638
t.context.schema = {

test/renderers/group.layout.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ import {GroupLayout, UISchemaElement} from '../../src/models/uischema';
77
import {
88
GroupLayoutRenderer, groupTester
99
} from '../../src/renderers/layouts/group.layout';
10-
10+
import { JsonForms } from '../../src/core';
11+
test.before(t => {
12+
JsonForms.stylingRegistry.registerMany([
13+
{
14+
name: 'group-layout',
15+
classNames: ['group-layout']
16+
}
17+
]);
18+
});
1119
test.beforeEach(t => {
1220
t.context.uiSchema = {
1321
type: 'GroupLayout',

test/renderers/horizontal.layout.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ import '../helpers/setup';
44
/*tslint:disable */
55
import {HorizontalLayout, UISchemaElement} from '../../src/models/uischema';
66
/*tslint:enable */
7+
import { JsonForms } from '../../src/core';
78
import {
89
HorizontalLayoutRenderer,
910
horizontalLayoutTester
1011
} from '../../src/renderers/layouts/horizontal.layout';
11-
12+
test.before(t => {
13+
JsonForms.stylingRegistry.registerMany([
14+
{
15+
name: 'horizontal-layout',
16+
classNames: ['horizontal-layout']
17+
}
18+
]);
19+
});
1220
test.beforeEach(t => {
1321
t.context.uiSchema = {
1422
type: 'HorizontalLayout',

test/renderers/integer.control.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ installCE(global, 'force');
77
import { DataService } from '../../src/core/data.service';
88
import { ControlElement } from '../../src/models/uischema';
99
import { IntegerControl, integerControlTester } from '../../src/renderers/controls/integer.control';
10+
import { JsonForms } from '../../src/core';
1011
import {
1112
testDisable,
1213
testEnable, testHide,
@@ -21,6 +22,18 @@ import {
2122
testUndefinedErrors,
2223
} from './base.control.tests';
2324

25+
test.before(t => {
26+
JsonForms.stylingRegistry.registerMany([
27+
{
28+
name: 'control',
29+
classNames: ['control']
30+
},
31+
{
32+
name: 'control.validation',
33+
classNames: ['validation']
34+
}
35+
]);
36+
});
2437
test.beforeEach(t => {
2538
t.context.data = {'foo': 42};
2639
t.context.schema = {

test/renderers/label.control.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ declare let global;
66
installCE(global, 'force');
77
import { DataService } from '../../src/core/data.service';
88
import { Runtime } from '../../src/core/runtime';
9+
import { JsonForms } from '../../src/core';
910
import { LabelElement, UISchemaElement } from '../../src/models/uischema';
1011
import { LabelRenderer, labelRendererTester } from '../../src/renderers/additional/label.renderer';
1112
import {
1213
testHide,
1314
testNotifyAboutVisibiltyWhenDisconnected,
1415
testShow
1516
} from './base.control.tests';
16-
17+
test.before(t => {
18+
JsonForms.stylingRegistry.registerMany([
19+
{
20+
name: 'label-control',
21+
classNames: ['jsf-label']
22+
}
23+
]);
24+
});
1725
test.beforeEach(t => {
1826
t.context.data = {'name': 'Foo'};
1927
t.context.schema = {type: 'object', properties: {name: {type: 'string'}}};

test/renderers/number.control.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../helpers/setup';
44
// tslint:disable:ordered-imports
55
import { DataService } from '../../src/core/data.service';
66
// tslint:enable:ordered-imports
7+
import { JsonForms } from '../../src/core';
78
import { JsonSchema } from '../../src/models/jsonSchema';
89
import { ControlElement } from '../../src/models/uischema';
910
import { NumberControl, numberControlTester } from '../../src/renderers/controls/number.control';
@@ -20,7 +21,18 @@ import {
2021
testShow,
2122
testUndefinedErrors
2223
} from './base.control.tests';
23-
24+
test.before(t => {
25+
JsonForms.stylingRegistry.registerMany([
26+
{
27+
name: 'control',
28+
classNames: ['control']
29+
},
30+
{
31+
name: 'control.validation',
32+
classNames: ['validation']
33+
}
34+
]);
35+
});
2436
test.beforeEach(t => {
2537
t.context.data = {'foo': 3.14};
2638
t.context.schema = {
@@ -46,7 +58,7 @@ test('NumberControlTester', t => {
4658
t.is(numberControlTester({type: 'Control'}, undefined), -1);
4759
});
4860

49-
test('NumberControl tester with wrong schema type', t => {
61+
test('NumberCostyleNamentrol tester with wrong schema type', t => {
5062
const control: ControlElement = {
5163
type: 'Control',
5264
scope: {

0 commit comments

Comments
 (0)