Skip to content

Commit cc9c07b

Browse files
authored
Enforce that tabs have at least one item. (#798)
* Enforce that tabs have at least one item. * Add test cases.
1 parent 8a73043 commit cc9c07b

4 files changed

Lines changed: 100 additions & 0 deletions

File tree

specification/v0_10/json/basic_catalog.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@
344344
"tabs": {
345345
"type": "array",
346346
"description": "An array of objects, where each object defines a tab with a title and a child component.",
347+
"minItems": 1,
347348
"items": {
348349
"type": "object",
349350
"properties": {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"schema": "server_to_client.json",
3+
"tests": [
4+
{
5+
"description": "Tabs with empty tabs array (should fail)",
6+
"valid": false,
7+
"data": {
8+
"version": "v0.10",
9+
"updateComponents": {
10+
"surfaceId": "test_surface",
11+
"components": [
12+
{
13+
"id": "tabs_empty",
14+
"component": "Tabs",
15+
"tabs": []
16+
}
17+
]
18+
}
19+
}
20+
},
21+
{
22+
"description": "Tabs with valid tabs array",
23+
"valid": true,
24+
"data": {
25+
"version": "v0.10",
26+
"updateComponents": {
27+
"surfaceId": "test_surface",
28+
"components": [
29+
{
30+
"id": "tabs_valid",
31+
"component": "Tabs",
32+
"tabs": [
33+
{
34+
"title": "Tab 1",
35+
"child": "txt1"
36+
}
37+
]
38+
},
39+
{
40+
"id": "txt1",
41+
"component": "Text",
42+
"text": "Tab 1 content"
43+
}
44+
]
45+
}
46+
}
47+
}
48+
]
49+
}

specification/v0_9/json/basic_catalog.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@
406406
"tabs": {
407407
"type": "array",
408408
"description": "An array of objects, where each object defines a tab with a title and a child component.",
409+
"minItems": 1,
409410
"items": {
410411
"type": "object",
411412
"properties": {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"schema": "server_to_client.json",
3+
"tests": [
4+
{
5+
"description": "Tabs with empty tabs array (should fail)",
6+
"valid": false,
7+
"data": {
8+
"version": "v0.9",
9+
"updateComponents": {
10+
"surfaceId": "test_surface",
11+
"components": [
12+
{
13+
"id": "tabs_empty",
14+
"component": "Tabs",
15+
"tabs": []
16+
}
17+
]
18+
}
19+
}
20+
},
21+
{
22+
"description": "Tabs with valid tabs array",
23+
"valid": true,
24+
"data": {
25+
"version": "v0.9",
26+
"updateComponents": {
27+
"surfaceId": "test_surface",
28+
"components": [
29+
{
30+
"id": "tabs_valid",
31+
"component": "Tabs",
32+
"tabs": [
33+
{
34+
"title": "Tab 1",
35+
"child": "txt1"
36+
}
37+
]
38+
},
39+
{
40+
"id": "txt1",
41+
"component": "Text",
42+
"text": "Tab 1 content"
43+
}
44+
]
45+
}
46+
}
47+
}
48+
]
49+
}

0 commit comments

Comments
 (0)