@simai-studio/mail 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +188 -0
- package/README.md +79 -2
- package/dist/package-receipt.json +1176 -0
- package/dist/set.json +97 -0
- package/dist/smart/mail-canvas/component.json +562 -0
- package/dist/smart/mail-canvas/component.json.gz +0 -0
- package/dist/smart/mail-canvas/css/mail-canvas.css +85 -0
- package/dist/smart/mail-canvas/css/mail-canvas.css.gz +0 -0
- package/dist/smart/mail-canvas/css/mail-canvas.min.css +2 -0
- package/dist/smart/mail-canvas/css/mail-canvas.min.css.gz +0 -0
- package/dist/smart/mail-canvas/examples.json +731 -0
- package/dist/smart/mail-canvas/examples.json.gz +0 -0
- package/dist/smart/mail-canvas/js/mail-canvas.js +1039 -0
- package/dist/smart/mail-canvas/js/mail-canvas.js.gz +0 -0
- package/dist/smart/mail-canvas/js/mail-canvas.min.js +22 -0
- package/dist/smart/mail-canvas/js/mail-canvas.min.js.gz +0 -0
- package/dist/smart/mail-canvas/lang/en.json +25 -0
- package/dist/smart/mail-canvas/lang/en.json.gz +0 -0
- package/dist/smart/mail-canvas/lang/ru.json +25 -0
- package/dist/smart/mail-canvas/lang/ru.json.gz +0 -0
- package/dist/smart/mail-canvas/probe.json +465 -0
- package/dist/smart/mail-canvas/probe.json.gz +0 -0
- package/dist/smart/mail-canvas/smart.manifest.json +550 -0
- package/dist/smart/mail-canvas/smart.manifest.json.gz +0 -0
- package/dist/smart/mail-canvas/static/default/notes.html +43 -0
- package/dist/smart/mail-canvas/static/default/notes.html.gz +0 -0
- package/dist/smart/mail-canvas/static/default/phone.html +43 -0
- package/dist/smart/mail-canvas/static/default/phone.html.gz +0 -0
- package/dist/smart/mail-canvas/static/default/reference.html +48 -0
- package/dist/smart/mail-canvas/static/default/reference.html.gz +0 -0
- package/dist/smart/mail-canvas/static/sheets.json +132 -0
- package/dist/smart/mail-canvas/static/sheets.json.gz +0 -0
- package/dist/smart/mail-canvas/studio.fixture.json +63 -0
- package/dist/smart/mail-canvas/studio.fixture.json.gz +0 -0
- package/dist/smart/mail-canvas/studio.scenario.json +39 -0
- package/dist/smart/mail-canvas/studio.scenario.json.gz +0 -0
- package/dist/smart/mail-canvas/template/default.css +73 -0
- package/dist/smart/mail-canvas/template/default.css.gz +0 -0
- package/dist/smart/mail-canvas/template/default.js +38 -0
- package/dist/smart/mail-canvas/template/default.js.gz +0 -0
- package/dist/smart/mail-inspector/component.json +768 -0
- package/dist/smart/mail-inspector/component.json.gz +0 -0
- package/dist/smart/mail-inspector/css/mail-inspector.css +194 -0
- package/dist/smart/mail-inspector/css/mail-inspector.css.gz +0 -0
- package/dist/smart/mail-inspector/css/mail-inspector.min.css +2 -0
- package/dist/smart/mail-inspector/css/mail-inspector.min.css.gz +0 -0
- package/dist/smart/mail-inspector/examples.json +1301 -0
- package/dist/smart/mail-inspector/examples.json.gz +0 -0
- package/dist/smart/mail-inspector/js/mail-inspector.js +1619 -0
- package/dist/smart/mail-inspector/js/mail-inspector.js.gz +0 -0
- package/dist/smart/mail-inspector/js/mail-inspector.min.js +103 -0
- package/dist/smart/mail-inspector/js/mail-inspector.min.js.gz +0 -0
- package/dist/smart/mail-inspector/lang/en.json +29 -0
- package/dist/smart/mail-inspector/lang/en.json.gz +0 -0
- package/dist/smart/mail-inspector/lang/ru.json +29 -0
- package/dist/smart/mail-inspector/lang/ru.json.gz +0 -0
- package/dist/smart/mail-inspector/probe.json +648 -0
- package/dist/smart/mail-inspector/probe.json.gz +0 -0
- package/dist/smart/mail-inspector/smart.manifest.json +920 -0
- package/dist/smart/mail-inspector/smart.manifest.json.gz +0 -0
- package/dist/smart/mail-inspector/static/default/item.html +189 -0
- package/dist/smart/mail-inspector/static/default/item.html.gz +0 -0
- package/dist/smart/mail-inspector/static/default/letter.html +247 -0
- package/dist/smart/mail-inspector/static/default/letter.html.gz +0 -0
- package/dist/smart/mail-inspector/static/default/reference.html +545 -0
- package/dist/smart/mail-inspector/static/default/reference.html.gz +0 -0
- package/dist/smart/mail-inspector/static/sheets.json +226 -0
- package/dist/smart/mail-inspector/static/sheets.json.gz +0 -0
- package/dist/smart/mail-inspector/studio.fixture.json +232 -0
- package/dist/smart/mail-inspector/studio.fixture.json.gz +0 -0
- package/dist/smart/mail-inspector/studio.scenario.json +43 -0
- package/dist/smart/mail-inspector/studio.scenario.json.gz +0 -0
- package/dist/smart/mail-inspector/template/default.css +190 -0
- package/dist/smart/mail-inspector/template/default.css.gz +0 -0
- package/dist/smart/mail-inspector/template/default.js +249 -0
- package/dist/smart/mail-inspector/template/default.js.gz +0 -0
- package/dist/smart/mail-letters/component.json +455 -0
- package/dist/smart/mail-letters/component.json.gz +0 -0
- package/dist/smart/mail-letters/css/mail-letters.css +72 -0
- package/dist/smart/mail-letters/css/mail-letters.css.gz +0 -0
- package/dist/smart/mail-letters/css/mail-letters.min.css +2 -0
- package/dist/smart/mail-letters/css/mail-letters.min.css.gz +0 -0
- package/dist/smart/mail-letters/examples.json +477 -0
- package/dist/smart/mail-letters/examples.json.gz +0 -0
- package/dist/smart/mail-letters/js/mail-letters.js +1772 -0
- package/dist/smart/mail-letters/js/mail-letters.js.gz +0 -0
- package/dist/smart/mail-letters/js/mail-letters.min.js +35 -0
- package/dist/smart/mail-letters/js/mail-letters.min.js.gz +0 -0
- package/dist/smart/mail-letters/lang/en.json +29 -0
- package/dist/smart/mail-letters/lang/en.json.gz +0 -0
- package/dist/smart/mail-letters/lang/ru.json +31 -0
- package/dist/smart/mail-letters/lang/ru.json.gz +0 -0
- package/dist/smart/mail-letters/probe.json +290 -0
- package/dist/smart/mail-letters/probe.json.gz +0 -0
- package/dist/smart/mail-letters/smart.manifest.json +476 -0
- package/dist/smart/mail-letters/smart.manifest.json.gz +0 -0
- package/dist/smart/mail-letters/static/default/by-title.html +177 -0
- package/dist/smart/mail-letters/static/default/by-title.html.gz +0 -0
- package/dist/smart/mail-letters/static/default/empty.html +88 -0
- package/dist/smart/mail-letters/static/default/empty.html.gz +0 -0
- package/dist/smart/mail-letters/static/default/nothing-found.html +88 -0
- package/dist/smart/mail-letters/static/default/nothing-found.html.gz +0 -0
- package/dist/smart/mail-letters/static/default/reference.html +168 -0
- package/dist/smart/mail-letters/static/default/reference.html.gz +0 -0
- package/dist/smart/mail-letters/static/sheets.json +245 -0
- package/dist/smart/mail-letters/static/sheets.json.gz +0 -0
- package/dist/smart/mail-letters/studio.fixture.json +41 -0
- package/dist/smart/mail-letters/studio.fixture.json.gz +0 -0
- package/dist/smart/mail-letters/studio.scenario.json +41 -0
- package/dist/smart/mail-letters/studio.scenario.json.gz +0 -0
- package/dist/smart/mail-letters/template/default.css +79 -0
- package/dist/smart/mail-letters/template/default.css.gz +0 -0
- package/dist/smart/mail-letters/template/default.js +61 -0
- package/dist/smart/mail-letters/template/default.js.gz +0 -0
- package/dist/smart/mail-library/component.json +512 -0
- package/dist/smart/mail-library/component.json.gz +0 -0
- package/dist/smart/mail-library/css/mail-library.css +149 -0
- package/dist/smart/mail-library/css/mail-library.css.gz +0 -0
- package/dist/smart/mail-library/css/mail-library.min.css +2 -0
- package/dist/smart/mail-library/css/mail-library.min.css.gz +0 -0
- package/dist/smart/mail-library/examples.json +616 -0
- package/dist/smart/mail-library/examples.json.gz +0 -0
- package/dist/smart/mail-library/js/mail-library.js +559 -0
- package/dist/smart/mail-library/js/mail-library.js.gz +0 -0
- package/dist/smart/mail-library/js/mail-library.min.js +52 -0
- package/dist/smart/mail-library/js/mail-library.min.js.gz +0 -0
- package/dist/smart/mail-library/lang/en.json +21 -0
- package/dist/smart/mail-library/lang/en.json.gz +0 -0
- package/dist/smart/mail-library/lang/ru.json +21 -0
- package/dist/smart/mail-library/lang/ru.json.gz +0 -0
- package/dist/smart/mail-library/probe.json +275 -0
- package/dist/smart/mail-library/probe.json.gz +0 -0
- package/dist/smart/mail-library/smart.manifest.json +512 -0
- package/dist/smart/mail-library/smart.manifest.json.gz +0 -0
- package/dist/smart/mail-library/static/default/category.html +85 -0
- package/dist/smart/mail-library/static/default/category.html.gz +0 -0
- package/dist/smart/mail-library/static/default/nothing-found.html +81 -0
- package/dist/smart/mail-library/static/default/nothing-found.html.gz +0 -0
- package/dist/smart/mail-library/static/default/one-group.html +67 -0
- package/dist/smart/mail-library/static/default/one-group.html.gz +0 -0
- package/dist/smart/mail-library/static/default/reference.html +135 -0
- package/dist/smart/mail-library/static/default/reference.html.gz +0 -0
- package/dist/smart/mail-library/static/sheets.json +180 -0
- package/dist/smart/mail-library/static/sheets.json.gz +0 -0
- package/dist/smart/mail-library/studio.fixture.json +75 -0
- package/dist/smart/mail-library/studio.fixture.json.gz +0 -0
- package/dist/smart/mail-library/studio.scenario.json +41 -0
- package/dist/smart/mail-library/studio.scenario.json.gz +0 -0
- package/dist/smart/mail-library/template/default.css +133 -0
- package/dist/smart/mail-library/template/default.css.gz +0 -0
- package/dist/smart/mail-library/template/default.js +83 -0
- package/dist/smart/mail-library/template/default.js.gz +0 -0
- package/dist/smart/mail-structure/component.json +497 -0
- package/dist/smart/mail-structure/component.json.gz +0 -0
- package/dist/smart/mail-structure/css/mail-structure.css +106 -0
- package/dist/smart/mail-structure/css/mail-structure.css.gz +0 -0
- package/dist/smart/mail-structure/css/mail-structure.min.css +2 -0
- package/dist/smart/mail-structure/css/mail-structure.min.css.gz +0 -0
- package/dist/smart/mail-structure/examples.json +286 -0
- package/dist/smart/mail-structure/examples.json.gz +0 -0
- package/dist/smart/mail-structure/js/mail-structure.js +767 -0
- package/dist/smart/mail-structure/js/mail-structure.js.gz +0 -0
- package/dist/smart/mail-structure/js/mail-structure.min.js +48 -0
- package/dist/smart/mail-structure/js/mail-structure.min.js.gz +0 -0
- package/dist/smart/mail-structure/lang/en.json +22 -0
- package/dist/smart/mail-structure/lang/en.json.gz +0 -0
- package/dist/smart/mail-structure/lang/ru.json +22 -0
- package/dist/smart/mail-structure/lang/ru.json.gz +0 -0
- package/dist/smart/mail-structure/probe.json +112 -0
- package/dist/smart/mail-structure/probe.json.gz +0 -0
- package/dist/smart/mail-structure/smart.manifest.json +495 -0
- package/dist/smart/mail-structure/smart.manifest.json.gz +0 -0
- package/dist/smart/mail-structure/static/default/empty.html +76 -0
- package/dist/smart/mail-structure/static/default/empty.html.gz +0 -0
- package/dist/smart/mail-structure/static/default/reference.html +98 -0
- package/dist/smart/mail-structure/static/default/reference.html.gz +0 -0
- package/dist/smart/mail-structure/static/default/settings.html +98 -0
- package/dist/smart/mail-structure/static/default/settings.html.gz +0 -0
- package/dist/smart/mail-structure/static/sheets.json +142 -0
- package/dist/smart/mail-structure/static/sheets.json.gz +0 -0
- package/dist/smart/mail-structure/studio.fixture.json +45 -0
- package/dist/smart/mail-structure/studio.fixture.json.gz +0 -0
- package/dist/smart/mail-structure/studio.scenario.json +42 -0
- package/dist/smart/mail-structure/studio.scenario.json.gz +0 -0
- package/dist/smart/mail-structure/template/default.css +100 -0
- package/dist/smart/mail-structure/template/default.css.gz +0 -0
- package/dist/smart/mail-structure/template/default.js +80 -0
- package/dist/smart/mail-structure/template/default.js.gz +0 -0
- package/dist/smart/rule.js +161 -0
- package/dist/smart/rule.js.gz +0 -0
- package/package.json +29 -4
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "sf-mail-inspector",
|
|
3
|
+
"probe": "sf-mail-inspector against component.json (standard simai.smart-component 1.4 §12, gate 20): every kind of field, typed text across redraws, each event, section memory, the list verbs, the path and the tabs",
|
|
4
|
+
"format": "stands/15-scenarios (A4 modal: a page, probes in steps); the runner is ui-source tests/browser/manifest-probes.browser.mjs, run for the package by scripts/run-manifest-probes.mjs",
|
|
5
|
+
"page": {
|
|
6
|
+
"lang": "ru",
|
|
7
|
+
"body": [
|
|
8
|
+
"<main>",
|
|
9
|
+
" <sf-mail-inspector id=\"panel\" heading=\"Кнопка\" heading-icon=\"smart_button\" form-key=\"b7\"></sf-mail-inspector>",
|
|
10
|
+
"</main>"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"probes": [
|
|
14
|
+
{
|
|
15
|
+
"id": "p1-draws-every-field",
|
|
16
|
+
"title": "every kind is drawn as its Framework element, and a hint is real text under the field",
|
|
17
|
+
"covers": "settings.sections, settings.heading, settings.head-actions",
|
|
18
|
+
"steps": [
|
|
19
|
+
{
|
|
20
|
+
"wait": 900,
|
|
21
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"wait": 50,
|
|
25
|
+
"check": "(() => { const q = (s) => one.querySelector(s); return q('sf-input[data-path=\"/text\"]') && q('sf-input[data-path=\"/url\"]') && q('sf-input[data-path=\"/discount\"]') && q('sf-input-textarea[data-path=\"/note\"]') && q('sf-dropdown[data-path=\"/tone\"]') && q('sf-switch[data-path=\"/wide\"]') && q('[data-path=\"/image\"] sf-input-image') && q('[data-group=\"/price\"] .sf-mail-inspector-pair sf-input[data-path=\"/price/old\"]') && q('[data-items=\"/items\"] sf-sortable [data-item=\"2\"].has-problem') && q('sf-input-textarea[data-path=\"/note\"]').textContent.includes('Как в бренде') && q('.sf-mail-inspector-title').textContent === 'Кнопка' && one.querySelectorAll('.sf-mail-inspector-action').length === 2 && !q('sf-breadcrumbs') && one.querySelectorAll('.sf-accordion').length === 5 && native('/discount').inputMode === 'numeric' && native('/url').type === 'url' && native('/price/current').inputMode === 'decimal' && q('[data-path=\"/image\"] sf-dropdown'); })()"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "p2-draft-kept-focus-kept",
|
|
31
|
+
"title": "text the host did not take stays across redraws, marked, with the focus and the caret where they were",
|
|
32
|
+
"covers": "events.change, settings.sections",
|
|
33
|
+
"steps": [
|
|
34
|
+
{
|
|
35
|
+
"wait": 900,
|
|
36
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"script": "(() => { const input = put('/url', 'x'); globalThis.input = input; input.setSelectionRange(3, 3); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
|
|
40
|
+
"wait": 400
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"wait": 50,
|
|
44
|
+
"check": "native('/url') === input && document.activeElement === input && input.value === 'https://simai.rux' && input.selectionStart === 3 && input.selectionEnd === 3 && one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid') && one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft === 'true' && one.querySelector('sf-input[data-path=\"/url\"]').textContent.includes('Нужен адрес') && JSON.stringify(heard) === JSON.stringify([['change', {path: '/url', value: 'https://simai.rux', typed: true}]])"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"script": "(() => { document.execCommand('insertText', false, 'Q'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
|
|
48
|
+
"wait": 400
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"wait": 50,
|
|
52
|
+
"check": "document.activeElement === input && input.value === 'httQps://simai.rux' && input.selectionStart === 4"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"script": "(() => { input.blur(); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
|
|
56
|
+
"wait": 400
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"wait": 50,
|
|
60
|
+
"check": "input.value === 'httQps://simai.rux' && one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid')"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"script": "(() => { one.sections = withField('/url', {value: 'https://ok.ru'}); return true; })()",
|
|
64
|
+
"wait": 400
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"wait": 50,
|
|
68
|
+
"check": "native('/url').value === 'https://ok.ru' && !one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid') && !one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "p3-typing-through-a-late-answer",
|
|
74
|
+
"title": "a late answer of the host never overwrites the field being typed in; leaving it shows the host's value",
|
|
75
|
+
"covers": "events.change, settings.sections",
|
|
76
|
+
"steps": [
|
|
77
|
+
{
|
|
78
|
+
"wait": 900,
|
|
79
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"script": "(() => { globalThis.input = put('/text', ' сейчас'); one.sections = withField('/text', {value: 'Подробнее сей'}); return true; })()",
|
|
83
|
+
"wait": 400
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"wait": 50,
|
|
87
|
+
"check": "document.activeElement === input && input.value === 'Подробнее сейчас' && input.selectionStart === input.value.length"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"script": "(() => { input.blur(); return true; })()",
|
|
91
|
+
"wait": 400
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"wait": 50,
|
|
95
|
+
"check": "native('/text').value === 'Подробнее сей'"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"id": "p4-multiline-and-group-keep-drafts",
|
|
101
|
+
"title": "a text area and a field in a group keep a draft the same way",
|
|
102
|
+
"covers": "settings.sections",
|
|
103
|
+
"steps": [
|
|
104
|
+
{
|
|
105
|
+
"wait": 900,
|
|
106
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"script": "(() => { put('/price/current', 'abc'); one.sections = withField('/price/current', {error: 'Нужно число'}); return true; })()",
|
|
110
|
+
"wait": 400
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"wait": 50,
|
|
114
|
+
"check": "native('/price/current').value === '990abc' && document.activeElement === native('/price/current') && one.querySelector('[data-path=\"/price/current\"]').hasAttribute('invalid')"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"script": "(() => { globalThis.area = put('/note', 'Первая строка'); area.setSelectionRange(2, 2); one.sections = withField('/note', {error: 'Слишком длинно'}); return true; })()",
|
|
118
|
+
"wait": 400
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"wait": 50,
|
|
122
|
+
"check": "native('/note') === area && area.value === 'Первая строка' && document.activeElement === area && area.selectionStart === 2 && one.querySelector('sf-input-textarea[data-path=\"/note\"]').hasAttribute('invalid')"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "p5-choices-say-change",
|
|
128
|
+
"title": "a choice, a switch and a typed link each say change, and the element changes nothing",
|
|
129
|
+
"covers": "events.change",
|
|
130
|
+
"steps": [
|
|
131
|
+
{
|
|
132
|
+
"wait": 900,
|
|
133
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"script": "(() => { one.querySelector('sf-dropdown[data-path=\"/tone\"]').selectValue('muted'); const toggle = one.querySelector('sf-switch[data-path=\"/wide\"] input'); toggle.click(); return true; })()",
|
|
137
|
+
"wait": 300
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"wait": 50,
|
|
141
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['change', {path: '/tone', value: 'muted', typed: false}], ['change', {path: '/wide', value: true, typed: false}]])"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"script": "(() => { one.sections = base(); return true; })()",
|
|
145
|
+
"wait": 400
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"wait": 50,
|
|
149
|
+
"check": "one.querySelector('sf-dropdown[data-path=\"/tone\"]').getAttribute('value') === 'accent' && one.querySelector('sf-switch[data-path=\"/wide\"]').isChecked() === false"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "p6-image",
|
|
155
|
+
"title": "a file says attach, a removal detach, a required image stays and says why, a refused file brings the stored image back, and a choice is a change",
|
|
156
|
+
"covers": "events.attach, events.detach",
|
|
157
|
+
"steps": [
|
|
158
|
+
{
|
|
159
|
+
"wait": 1200,
|
|
160
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"script": "(() => { const well = one.querySelector('[data-path=\"/image\"] sf-input-image'); globalThis.file = new File(['probe'], 'new.png', {type: 'image/png'}); well.takeFile(file, 'input'); return true; })()",
|
|
164
|
+
"wait": 300
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"wait": 50,
|
|
168
|
+
"check": "heard.length === 1 && heard[0][0] === 'attach' && heard[0][1].path === '/image' && heard[0][1].files[0] === file && one.querySelector('[data-path=\"/image\"] sf-input-image').value.href.startsWith('blob:')"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"script": "(() => { one.sections = withField('/image', {error: 'Файл слишком большой'}); return true; })()",
|
|
172
|
+
"wait": 500
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"wait": 50,
|
|
176
|
+
"check": "one.querySelector('[data-path=\"/image\"] sf-input-image').value.value === 'a1' && one.querySelector('[data-path=\"/image\"] sf-input-image').textContent.includes('Файл слишком большой')"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"script": "(() => { heard.length = 0; one.sections = base(); return true; })()",
|
|
180
|
+
"wait": 400
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"script": "(() => { one.querySelector('[data-path=\"/image\"] sf-input-image').removeImage(); return true; })()",
|
|
184
|
+
"wait": 300
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"wait": 50,
|
|
188
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['detach', {path: '/image'}]])"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"script": "(() => { heard.length = 0; one.querySelector('[data-path=\"/logo\"] sf-input-image').removeImage(); return true; })()",
|
|
192
|
+
"wait": 400
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"wait": 50,
|
|
196
|
+
"check": "heard.length === 0 && one.querySelector('[data-path=\"/logo\"] sf-input-image').value.value === 'a1' && one.querySelector('[data-path=\"/logo\"] sf-input-image').textContent.includes('обязательно')"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"script": "(() => { one.querySelector('[data-choose=\"/image\"]').selectValue('a2'); return true; })()",
|
|
200
|
+
"wait": 300
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"wait": 50,
|
|
204
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['change', {path: '/image', value: 'a2', typed: false}]])"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"id": "p7-head-actions",
|
|
210
|
+
"title": "the heading's buttons say duplicate and delete, a pinned place's says replace, and an action not offered is refused",
|
|
211
|
+
"covers": "events.duplicate, events.delete, events.replace, actions.duplicate, actions.replace",
|
|
212
|
+
"steps": [
|
|
213
|
+
{
|
|
214
|
+
"wait": 900,
|
|
215
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"script": "(() => { one.querySelector('[data-action=\"duplicate\"]').click(); one.querySelector('[data-action=\"delete\"]').click(); globalThis.notOffered = one.replace().reason; return true; })()",
|
|
219
|
+
"wait": 200
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"wait": 50,
|
|
223
|
+
"check": "names() === 'duplicate,delete' && notOffered === 'unknown'"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"script": "(() => { heard.length = 0; one.headActions = ['replace']; return true; })()",
|
|
227
|
+
"wait": 400
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"script": "(() => { one.querySelector('[data-action=\"replace\"]').click(); return true; })()",
|
|
231
|
+
"wait": 200
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"wait": 50,
|
|
235
|
+
"check": "names() === 'replace' && !one.querySelector('[data-action=\"delete\"]')"
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"id": "p8-section-memory",
|
|
241
|
+
"title": "a section closes, is told, stays closed under new data with the same key, and comes back from the host's list",
|
|
242
|
+
"covers": "events.toggle, settings.closed-sections",
|
|
243
|
+
"steps": [
|
|
244
|
+
{
|
|
245
|
+
"wait": 900,
|
|
246
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"script": "(() => { one.querySelector('[data-section=\"button:look\"] .sf-accordion-trigger').click(); return true; })()",
|
|
250
|
+
"wait": 300
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"wait": 50,
|
|
254
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['toggle', {key: 'button:look', open: false}]]) && one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && one.querySelector('[data-section=\"button:look\"] .sf-accordion-trigger').getAttribute('aria-expanded') === 'false' && JSON.stringify(one.closedSections) === JSON.stringify(['button:look'])"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"script": "(() => { one.setAttribute('form-key', 'b8'); one.sections = base(); return true; })()",
|
|
258
|
+
"wait": 400
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"wait": 50,
|
|
262
|
+
"check": "one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && !one.querySelector('[data-section=\"button:content\"] .sf-accordion-content').hidden"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"script": "(() => { one.closedSections = ['button:content']; return true; })()",
|
|
266
|
+
"wait": 300
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"wait": 50,
|
|
270
|
+
"check": "!one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && one.querySelector('[data-section=\"button:content\"] .sf-accordion-content').hidden && one.toggleSection({key: 'nope'}).reason === 'unknown'"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"script": "(() => { const data = base(); one.sections = [data[0]]; return true; })()",
|
|
274
|
+
"wait": 300
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"wait": 50,
|
|
278
|
+
"check": "one.querySelectorAll('.sf-accordion').length === 0 && one.querySelector('sf-input[data-path=\"/text\"]') !== null"
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"id": "p9-list-verbs",
|
|
284
|
+
"title": "an item opens, adds, copies, removes and moves, each told with its list, and the focus goes to the item that changed",
|
|
285
|
+
"covers": "events.item-toggle, events.item-add, events.item-duplicate, events.item-delete, events.item-move",
|
|
286
|
+
"steps": [
|
|
287
|
+
{
|
|
288
|
+
"wait": 1200,
|
|
289
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"script": "(() => { one.querySelector('[data-items=\"/items\"] [data-toggle=\"1\"]').click(); return true; })()",
|
|
293
|
+
"wait": 200
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"wait": 50,
|
|
297
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-toggle', {path: '/items', index: 1, open: true}]]) && !one.querySelector('[data-path=\"/items/1/title\"]')"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"script": "(() => { heard.length = 0; const data = withField('/items', {open: 1}); one.sections = data; return true; })()",
|
|
301
|
+
"wait": 500
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"wait": 50,
|
|
305
|
+
"check": "one.querySelector('sf-input[data-path=\"/items/1/title\"]') && one.querySelector('[data-item=\"1\"]').classList.contains('is-open') && one.querySelector('[data-toggle=\"1\"]').getAttribute('aria-expanded') === 'true' && !one.querySelector('[data-item=\"0\"] .sf-mail-inspector-item-body').querySelector('sf-input')"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"script": "(() => { one.querySelector('[data-item-add=\"/items\"]').click(); return true; })()",
|
|
309
|
+
"wait": 200
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"wait": 50,
|
|
313
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-add', {path: '/items'}]])"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"script": "(() => { heard.length = 0; one.openItemMenu('/items', 1, one.querySelector('[data-item-menu=\"1\"]')); one.onMenuSelect({id: 'duplicate'}); return true; })()",
|
|
317
|
+
"wait": 300
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"script": "(() => { one.onMenuSelect({id: 'remove'}); return true; })()",
|
|
321
|
+
"wait": 300
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"script": "(() => { one.onMenuSelect({id: 'up'}); return true; })()",
|
|
325
|
+
"wait": 300
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"script": "(() => { one.onMenuSelect({id: 'down'}); return true; })()",
|
|
329
|
+
"wait": 300
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"wait": 50,
|
|
333
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-duplicate', {path: '/items', index: 1}], ['item-delete', {path: '/items', index: 1}], ['item-move', {path: '/items', from: 1, to: 0}], ['item-move', {path: '/items', from: 1, to: 2}]])"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"script": "(() => { one.sections = base(); return true; })()",
|
|
337
|
+
"wait": 500
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"wait": 50,
|
|
341
|
+
"check": "document.activeElement === one.querySelector('[data-toggle=\"2\"]')"
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"id": "p10-item-moves-are-free",
|
|
347
|
+
"title": "any item moves anywhere: first to last, by drag and by keys, and the ends only refuse going beyond them",
|
|
348
|
+
"covers": "actions.item-move, events.item-move",
|
|
349
|
+
"steps": [
|
|
350
|
+
{
|
|
351
|
+
"wait": 1200,
|
|
352
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"script": "(() => { globalThis.answers = [one.itemMove({path: '/items', index: 0, to: 2}).outcome, one.itemMove({path: '/items', index: 2, to: 0}).outcome, one.itemMove({path: '/items', index: 0, by: -1}).reason, one.itemMove({path: '/items', index: 2, by: 1}).reason, one.itemMove({path: '/nope', index: 0, by: 1}).reason]; return true; })()",
|
|
356
|
+
"wait": 200
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"wait": 50,
|
|
360
|
+
"check": "answers.join(',') === 'applied,applied,unchanged,unchanged,unknown' && JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 0, to: 2}], ['item-move', {path: '/items', from: 2, to: 0}]])"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"script": "(() => { heard.length = 0; const list = one.querySelector('[data-items=\"/items\"] sf-sortable'); list.dispatchEvent(new CustomEvent('sf-sortable-move', {bubbles: true, detail: {item: 'item-2', from: list.getAttribute('group'), to: list.getAttribute('group'), index: 0}})); return true; })()",
|
|
364
|
+
"wait": 200
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"wait": 50,
|
|
368
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 2, to: 0}]])"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"script": "(() => { heard.length = 0; const toggle = one.querySelector('[data-toggle=\"1\"]'); toggle.focus(); toggle.dispatchEvent(new KeyboardEvent('keydown', {key: 'ArrowUp', altKey: true, bubbles: true, cancelable: true})); return true; })()",
|
|
372
|
+
"wait": 300
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"wait": 50,
|
|
376
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 1, to: 0}]]) && one.querySelector('.sf-mail-inspector-said[role=\"status\"]').textContent.includes('позиция 1 из 3')"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"id": "p11-list-bounds",
|
|
382
|
+
"title": "at max nothing is added or copied, at min nothing is removed, and the buttons say so",
|
|
383
|
+
"covers": "actions.item-add, actions.item-duplicate, actions.item-delete",
|
|
384
|
+
"steps": [
|
|
385
|
+
{
|
|
386
|
+
"wait": 1200,
|
|
387
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"script": "(() => { one.sections = withField('/items', {max: 3, min: 3}); return true; })()",
|
|
391
|
+
"wait": 400
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"wait": 50,
|
|
395
|
+
"check": "one.itemAdd({path: '/items'}).reason === 'full' && one.itemDuplicate({path: '/items', index: 0}).reason === 'full' && one.itemDelete({path: '/items', index: 0}).reason === 'least' && one.querySelector('[data-item-add=\"/items\"]').hasAttribute('disabled') && heard.length === 0 && one.menuEntries(fieldOf(one.sections, '/items'), 0).filter((entry) => entry.disabled).map((entry) => entry.id).join(',') === 'up,duplicate,remove'"
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"id": "p12-level-and-escape",
|
|
401
|
+
"title": "the path is drawn from two levels; a press and Escape ask for a level, and Escape takes the focus from a closing item to its row",
|
|
402
|
+
"covers": "events.level, settings.levels, actions.level-up",
|
|
403
|
+
"steps": [
|
|
404
|
+
{
|
|
405
|
+
"wait": 1200,
|
|
406
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"script": "(() => { one.levels = [{text: 'Кнопка'}, {text: 'Расширенный'}]; one.sections = withField('/items', {open: 1}); return true; })()",
|
|
410
|
+
"wait": 600
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"script": "(() => { const crumbs = one.querySelector('sf-breadcrumbs'); globalThis.crumbs = crumbs; crumbs.querySelector('a').click(); return true; })()",
|
|
414
|
+
"wait": 200
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"wait": 50,
|
|
418
|
+
"check": "crumbs && JSON.stringify(heard) === JSON.stringify([['level', {index: 0}]]) && location.hash === ''"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"script": "(() => { heard.length = 0; globalThis.input = native('/items/1/title'); input.focus(); globalThis.escape = new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true}); input.dispatchEvent(escape); return true; })()",
|
|
422
|
+
"wait": 200
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"script": "(() => { one.levels = [{text: 'Кнопка'}]; one.sections = base(); return true; })()",
|
|
426
|
+
"wait": 500
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"wait": 50,
|
|
430
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['level', {index: 0}]]) && escape.defaultPrevented && document.activeElement === one.querySelector('[data-toggle=\"1\"]') && !one.querySelector('sf-breadcrumbs')"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"script": "(() => { heard.length = 0; native('/text').dispatchEvent(new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true})); return true; })()",
|
|
434
|
+
"wait": 200
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"wait": 50,
|
|
438
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['level', {index: -1}]])"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"script": "(() => { heard.length = 0; one.levels = []; return true; })()",
|
|
442
|
+
"wait": 300
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"script": "(() => { globalThis.free = new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true}); native('/text').dispatchEvent(free); globalThis.atTop = one.levelUp().reason; return true; })()",
|
|
446
|
+
"wait": 200
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"wait": 50,
|
|
450
|
+
"check": "heard.length === 0 && !free.defaultPrevented && atTop === 'top'"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"id": "p13-tabs-and-host-panels",
|
|
456
|
+
"title": "tabs show the form and the host's panels from slots; a press says tab, the host's tab moves it, and a draft in the form survives",
|
|
457
|
+
"covers": "events.tab, settings.tabs, settings.tab",
|
|
458
|
+
"steps": [
|
|
459
|
+
{
|
|
460
|
+
"wait": 1200,
|
|
461
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"script": "(() => { const brand = document.createElement('div'); brand.id = 'brand-panel'; brand.textContent = 'Панель бренда'; one.setSlot('brand', brand); one.tabs = [{id: 'content', label: 'Основное'}, {id: 'brand', label: 'Бренд', slot: 'brand'}, {id: 'images', label: 'Картинки', slot: 'images'}, {id: 'versions', label: 'Версии', slot: 'versions'}]; one.setAttribute('tab', 'content'); return true; })()",
|
|
465
|
+
"wait": 800
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"wait": 50,
|
|
469
|
+
"check": "one.querySelector('sf-tabs [data-tab=\"content\"] sf-input[data-path=\"/text\"]') && one.querySelector('sf-tabs [data-tab=\"brand\"] #brand-panel') && one.querySelectorAll('sf-tabs [role=\"tab\"]').length === 4 && one.querySelector('sf-tabs [data-tab=\"content\"]').closest('[role=\"tabpanel\"]').hidden === false && one.querySelector('sf-tabs [data-tab=\"brand\"]').closest('[role=\"tabpanel\"]').hidden === true"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"script": "(() => { heard.length = 0; globalThis.input = put('/url', 'x'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
|
|
473
|
+
"wait": 400
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"wait": 50,
|
|
477
|
+
"check": "native('/url') === input && document.activeElement === input && input.value === 'https://simai.rux'"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"script": "(() => { heard.length = 0; [...one.querySelectorAll('sf-tabs [role=\"tab\"]')][1].click(); return true; })()",
|
|
481
|
+
"wait": 400
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"wait": 50,
|
|
485
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['tab', {id: 'brand'}]]) && one.querySelector('sf-tabs [data-tab=\"brand\"]').closest('[role=\"tabpanel\"]').hidden === false"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"script": "(() => { heard.length = 0; one.setAttribute('tab', 'content'); return true; })()",
|
|
489
|
+
"wait": 500
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"wait": 50,
|
|
493
|
+
"check": "heard.length === 0 && one.querySelector('sf-tabs [data-tab=\"content\"]').closest('[role=\"tabpanel\"]').hidden === false && native('/url').value === 'https://simai.rux'"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"script": "(() => { const next = document.createElement('div'); next.id = 'brand-next'; one.setSlot('brand', next); return true; })()",
|
|
497
|
+
"wait": 400
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"wait": 50,
|
|
501
|
+
"check": "one.querySelector('sf-tabs [data-tab=\"brand\"] #brand-next') && !one.querySelector('#brand-panel')"
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"id": "p15-real-keys",
|
|
507
|
+
"title": "with real key presses: typing through redraws loses nothing, Enter and Space open an item, Alt+arrows move it, Shift+F10 opens its menu, Escape goes up",
|
|
508
|
+
"covers": "keyboard.item, keyboard.host",
|
|
509
|
+
"steps": [
|
|
510
|
+
{
|
|
511
|
+
"wait": 1200,
|
|
512
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"script": "(() => { globalThis.input = native('/text'); input.focus(); input.setSelectionRange(9, 9); globalThis.redraws = setInterval(() => { one.sections = withField('/text', {error: 'Не подходит'}); }, 5); return true; })()",
|
|
516
|
+
"wait": 50
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"user": "keyboard:a",
|
|
520
|
+
"wait": 30
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"user": "keyboard:b",
|
|
524
|
+
"wait": 30
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"user": "keyboard:c",
|
|
528
|
+
"wait": 30
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"user": "keyboard:ArrowLeft",
|
|
532
|
+
"wait": 30
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"user": "keyboard:d",
|
|
536
|
+
"wait": 200
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"script": "(() => { clearInterval(redraws); return true; })()",
|
|
540
|
+
"wait": 300
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"wait": 50,
|
|
544
|
+
"check": "input === native('/text') && document.activeElement === input && input.value === 'Подробнееabdc' && input.selectionStart === 12 && heard.at(-1)[1].value === 'Подробнееabdc'"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"script": "(() => { heard.length = 0; one.sections = base(); one.querySelector('[data-toggle=\"0\"]').focus(); return true; })()",
|
|
548
|
+
"wait": 300
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"user": "keyboard:Enter",
|
|
552
|
+
"wait": 200
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"user": "keyboard:Space",
|
|
556
|
+
"wait": 200
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"wait": 50,
|
|
560
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-toggle', {path: '/items', index: 0, open: true}], ['item-toggle', {path: '/items', index: 0, open: true}]])"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"script": "(() => { heard.length = 0; return true; })()",
|
|
564
|
+
"wait": 50
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"user": "keyboard:Alt+ArrowDown",
|
|
568
|
+
"wait": 200
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"wait": 50,
|
|
572
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 0, to: 1}]])"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"script": "(() => { heard.length = 0; one.sections = base(); return true; })()",
|
|
576
|
+
"wait": 400
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"wait": 50,
|
|
580
|
+
"check": "document.activeElement === one.querySelector('[data-toggle=\"1\"]')"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"user": "keyboard:Shift+F10",
|
|
584
|
+
"wait": 700
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"wait": 50,
|
|
588
|
+
"check": "document.querySelector('sf-menu-context.sf-mail-inspector-menu [role=\"menu\"], sf-menu-context.sf-mail-inspector-menu[open]') !== null && one.menuFor.index === 1"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"user": "keyboard:Escape",
|
|
592
|
+
"wait": 300
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"wait": 50,
|
|
596
|
+
"check": "heard.length === 0"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"user": "keyboard:Escape",
|
|
600
|
+
"wait": 200
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"wait": 50,
|
|
604
|
+
"check": "heard.length === 0 && document.activeElement !== one.querySelector('[data-toggle=\"1\"]') && one.contains(document.activeElement)"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"user": "keyboard:Escape",
|
|
608
|
+
"wait": 200
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"wait": 50,
|
|
612
|
+
"check": "JSON.stringify(heard) === JSON.stringify([['level', {index: -1}]])"
|
|
613
|
+
}
|
|
614
|
+
]
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"id": "p14-form-key-and-notice",
|
|
618
|
+
"title": "a new form-key draws the form anew and drops what was typed; the notice's button says so",
|
|
619
|
+
"covers": "settings.form-key, settings.notice, events.notice-action",
|
|
620
|
+
"steps": [
|
|
621
|
+
{
|
|
622
|
+
"wait": 900,
|
|
623
|
+
"script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"script": "(() => { put('/url', 'x'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
|
|
627
|
+
"wait": 400
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"script": "(() => { native('/url').blur(); one.setAttribute('form-key', 'b8'); one.sections = withField('/url', {error: 'Другая ошибка'}); one.notice = {text: 'Причина получения и ссылка отписки — в параметрах письма.', action: 'Открыть параметры письма'}; return true; })()",
|
|
631
|
+
"wait": 500
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"wait": 50,
|
|
635
|
+
"check": "native('/url').value === 'https://simai.ru' && !one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft && one.querySelector('.sf-mail-inspector-notice-text').textContent.includes('Причина')"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"script": "(() => { heard.length = 0; one.querySelector('[data-notice-action]').click(); return true; })()",
|
|
639
|
+
"wait": 200
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"wait": 50,
|
|
643
|
+
"check": "names() === 'notice-action'"
|
|
644
|
+
}
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
]
|
|
648
|
+
}
|