mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
178 lines
3.6 KiB
JSON
178 lines
3.6 KiB
JSON
{
|
|
"description": "Trigger with mode 'on_condition'",
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
],
|
|
"div_data": {
|
|
"card": {
|
|
"log_id": "sample_card",
|
|
"variables": [
|
|
{
|
|
"name": "total_likes",
|
|
"type": "integer",
|
|
"value": 0
|
|
},
|
|
{
|
|
"name": "trigger_state",
|
|
"type": "string",
|
|
"value": "unset"
|
|
}
|
|
],
|
|
"variable_triggers": [
|
|
{
|
|
"condition": "@{total_likes > 100}",
|
|
"mode": "on_condition",
|
|
"actions": [
|
|
{
|
|
"log_id": "trigger_invoke",
|
|
"url": "div-action://set_variable?name=trigger_state&value=activated"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"states": [
|
|
{
|
|
"state_id": 0,
|
|
"div": {
|
|
"type": "text",
|
|
"text": "text"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"cases": [
|
|
{
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "trigger_state",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "unset"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=50",
|
|
"log_id": "set_50"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "trigger_state",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "unset"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=110",
|
|
"log_id": "set_110"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "trigger_state",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "activated"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=110",
|
|
"log_id": "set_110"
|
|
},
|
|
{
|
|
"url": "div-action://set_variable?name=trigger_state&value=unset",
|
|
"log_id": "reset_trigger_state"
|
|
},
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=130",
|
|
"log_id": "set_130"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "trigger_state",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "unset"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
},
|
|
{
|
|
"div_actions": [
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=110",
|
|
"log_id": "set_110"
|
|
},
|
|
{
|
|
"url": "div-action://set_variable?name=trigger_state&value=unset",
|
|
"log_id": "reset_trigger_state"
|
|
},
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=130",
|
|
"log_id": "set_130"
|
|
},
|
|
{
|
|
"url": "div-action://set_variable?name=total_likes&value=50",
|
|
"log_id": "set_50"
|
|
}
|
|
],
|
|
"expected": [
|
|
{
|
|
"type": "variable",
|
|
"variable_name": "trigger_state",
|
|
"value": {
|
|
"type": "string",
|
|
"value": "unset"
|
|
}
|
|
}
|
|
],
|
|
"platforms": [
|
|
"android",
|
|
"ios",
|
|
"web"
|
|
]
|
|
}
|
|
]
|
|
}
|