mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
3b5319c96a
commit_hash:0397a4b5c9e86b49dbcde0edf3084ddba5a4b85f
200 lines
4.2 KiB
JSON
200 lines
4.2 KiB
JSON
{
|
|
"description": "Check getStringValue subscription.",
|
|
"div_data": {
|
|
"card": {
|
|
"log_id": "get_string_value",
|
|
"variables": [
|
|
{
|
|
"name": "part_of_name",
|
|
"type": "string",
|
|
"value": "1"
|
|
},
|
|
{
|
|
"name": "var_1",
|
|
"type": "string",
|
|
"value": "var_1_initial"
|
|
},
|
|
{
|
|
"name": "var_2",
|
|
"type": "string",
|
|
"value": "var_2_initial"
|
|
}
|
|
],
|
|
"variable_triggers": [
|
|
{
|
|
"condition": "@{getStringValue('var_' + part_of_name, '') != ''}",
|
|
"mode": "on_variable",
|
|
"actions": [
|
|
{
|
|
"log_id": "check result",
|
|
"typed": {
|
|
"type": "set_variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "@{getStringValue('var_' + part_of_name, '')}"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"states": [
|
|
{
|
|
"state_id": 0,
|
|
"div": {
|
|
"type": "text",
|
|
"text": "text"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"cases": [
|
|
{
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_1_initial"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"log_id": "change part of name",
|
|
"url": "div-action://set_variable?name=part_of_name&value=2"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_2_initial"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"log_id": "change value",
|
|
"url": "div-action://set_variable?name=var_1&value=var_1_changed"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_1_changed"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"log_id": "change part of name",
|
|
"url": "div-action://set_variable?name=part_of_name&value=2"
|
|
},
|
|
{
|
|
"log_id": "change value",
|
|
"url": "div-action://set_variable?name=var_2&value=var_2_changed"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_2_changed"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"log_id": "change part of name",
|
|
"url": "div-action://set_variable?name=part_of_name&value=2"
|
|
},
|
|
{
|
|
"log_id": "change old value",
|
|
"url": "div-action://set_variable?name=var_1&value=var_1_changed"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_2_initial"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"log_id": "change another value",
|
|
"url": "div-action://set_variable?name=var_2&value=var_2_changed"
|
|
},
|
|
{
|
|
"log_id": "change part of name",
|
|
"url": "div-action://set_variable?name=part_of_name&value=2"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "result",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "var_2_changed"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
}
|
|
]
|
|
}
|