I have created my UI using JSON schema, I am very confused on how can I write a test for it? I checked various resources online but couldn't figure out on how to get started. I want to test that if the radio button is true then the dropdown displays and the dropdown further has input fields in them. Here is my code and I want to test it using javascript or enzyme:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
},
"type": "object",
"properties": {
"enabled": {
"title": "click me to enable this radiobutton",
"type": "boolean",
"default": false
}
},
"dependencies": {
"enabled": {
"oneOf": [
{
"properties": {
"enabled": {
"enum": [
false
]
}
}
},
{
"properties": {
"enabled": {
"enum": [
true
]
},
"style": {
"title": "Color Type",
"enum": [
"rainbow",
"primaryColors",
"mixedColors"
],
"enumNames": [
"Rainbow",
"Primary",
"Mixed"
],
"default": "primaryColors"
}
},
"dependencies": {
"style": {
"oneOf": [
{
"properties": {
"style": {
"enum": [
"rainbow"
]
},
"violet": {
"title": "Violet",
"type": "string"
}
}
},
{
"properties": {
"style": {
"enum": [
"primaryColors"
]
},
"red": {
"title": "this is red",
"type": "string"
}
}
},
{
"properties": {
"style": {
"enum": [
"mixedColors"
]
},
"pink": {
"title": "I am pink",
"type": "string"
}
}
}
]
}
}
}
]
}
}
}
Aucun commentaire:
Enregistrer un commentaire