Skip to content

Commit f605d83

Browse files
committed
test: add tests for ViewLayouts
1 parent e94e2e0 commit f605d83

10 files changed

+72
-0
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
import {VALUE, VIEW_COLUMN} from './helpers';
4+
5+
import {test} from '~playwright/core';
6+
import {DynamicView} from '~playwright/core/DynamicView';
7+
8+
test.describe('ViewColumn View', () => {
9+
test('object spec', async ({mount, expectScreenshot}) => {
10+
await mount(<DynamicView spec={VIEW_COLUMN} value={VALUE} />);
11+
12+
await expectScreenshot();
13+
});
14+
15+
test('object spec with layoutDescription', async ({mount, expectScreenshot}) => {
16+
await mount(<DynamicView spec={VIEW_COLUMN} value={VALUE} showLayoutDescription />);
17+
18+
await expectScreenshot();
19+
});
20+
});
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import {FormValue, ObjectSpec, SpecTypes} from '../../../../../core';
2+
3+
export const VIEW_COLUMN: ObjectSpec = {
4+
defaultValue: {
5+
name: 'value',
6+
age: 10,
7+
license: false,
8+
},
9+
type: SpecTypes.Object,
10+
properties: {
11+
name: {
12+
type: SpecTypes.String,
13+
viewSpec: {
14+
type: 'base',
15+
layout: 'column',
16+
layoutDescription: 'Description for Name',
17+
layoutTitle: 'Name',
18+
},
19+
},
20+
age: {
21+
type: SpecTypes.Number,
22+
viewSpec: {
23+
type: 'base',
24+
layout: 'column',
25+
layoutDescription: 'Description for Age',
26+
layoutTitle: 'Age',
27+
},
28+
},
29+
license: {
30+
type: SpecTypes.Boolean,
31+
viewSpec: {
32+
type: 'base',
33+
layout: 'column',
34+
layoutDescription: 'Description for License',
35+
layoutTitle: 'License',
36+
},
37+
},
38+
},
39+
viewSpec: {
40+
type: 'base',
41+
layout: 'accordeon',
42+
layoutTitle: 'Candidate',
43+
layoutDescription: 'Description for base',
44+
layoutOpen: true,
45+
},
46+
};
47+
48+
export const VALUE: FormValue = {
49+
name: 'name',
50+
age: 21,
51+
license: true,
52+
};

0 commit comments

Comments
 (0)