From 116aacb1685eea6e7622e1e9995ed0b048d95e0f Mon Sep 17 00:00:00 2001 From: Peppa Date: Tue, 17 Nov 2026 11:44:52 +0500 Subject: [PATCH] =?UTF-8?q?TPTIP-19:=20=D0=BA=D0=B0=D1=80=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BA=D0=B0=20=D0=B1=D0=BB=D1=8E=D0=B4=D0=B0=20=E2=80=94?= =?UTF-8?q?=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8,=20=D0=BE=D1=82=D1=81?= =?UTF-8?q?=D1=82=D1=83=D0=BF=20=D0=BF=D0=BE=D0=B4=20=D0=BD=D0=B8=D0=B6?= =?UTF-8?q?=D0=BD=D0=B5=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- index.html | 13 ++++++++----- tests/dish-card.test.js | 8 ++++++++ tests/dish-card.test.js-e | 14 +++++++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 28087cd..eada9f3 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ *{box-sizing:border-box;-webkit-tap-highlight-color:transparent} html,body{margin:0;background:var(--bg);color:var(--text);font:16px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif} -#app{max-width:640px;margin:0 auto;min-height:100vh;padding:12px 16px calc(84px + env(safe-area-inset-bottom))} +#app{max-width:640px;margin:0 auto;min-height:100vh;padding:12px 16px calc(120px + env(safe-area-inset-bottom))} h1,h2,h3{margin:0} h2{font-size:1.15rem} h3{font-size:1rem} @@ -83,6 +83,9 @@ input:focus,select:focus,textarea:focus,button:focus-visible{outline:2px solid v .item:first-child{border-top:0} .item .main{flex:1;min-width:0;cursor:pointer;overflow-wrap:anywhere} .item .main b{display:block;overflow-wrap:anywhere} +.item .main .dish-row{display:block;margin-top:4px} +.item.dish{flex-wrap:wrap} +.item.dish>button{flex:none;margin-left:auto} .badge{display:inline-block;border-radius:999px;padding:1px 8px;font-size:.75rem;background:var(--bg);border:1px solid var(--line);color:var(--muted)} .ok{color:var(--ok)}.bad{color:var(--bad)} .quick{display:grid;grid-template-columns:repeat(3,1fr);gap:8px} @@ -887,12 +890,12 @@ function chooseRecipe(r) { function recipeView(r, actions) { const lines = r.ingredients.split('\n').map(x => x.trim()).filter(Boolean); const steps = (r.steps || '').split('\n').map(x => x.trim()).filter(Boolean); - return h('div', { class: 'item', style: 'align-items:flex-start' }, + return h('div', { class: 'item dish', style: 'align-items:flex-start' }, r.photo ? h('img', { src: r.photo, alt: r.title, style: 'width:96px;height:96px;object-fit:cover;border-radius:12px;flex:none' }) : h('div', { style: 'width:96px;height:96px;border-radius:12px;background:var(--bg);display:flex;align-items:center;justify-content:center;font-size:2rem;flex:none' }, '🍲'), h('div', { class: 'main', onclick: () => { if (db.recipes.includes(r)) openRecipeForm({ entry: r }); } }, h('b', null, r.title), - h('span', { class: 'muted small' }, '⏱ ' + r.time + ' мин'), - r.kcal != null ? h('span', { class: 'small', 'data-nutrition': '' }, (r.grams ? 'Порция ' + fmtInt(r.grams) + ' г · ' : '') + fmtInt(r.kcal) + ' ккал · Б ' + fmt(r.protein || 0) + ' · Ж ' + fmt(r.fat || 0) + ' · У ' + fmt(r.carbs || 0)) : null, - lines.length ? h('div', { class: 'small' }, 'Состав: ' + lines.join(', ')) : null, + h('span', { class: 'muted small dish-row' }, '⏱ ' + r.time + ' мин'), + r.kcal != null ? h('span', { class: 'small dish-row', 'data-nutrition': '' }, (r.grams ? 'Порция ' + fmtInt(r.grams) + ' г · ' : '') + fmtInt(r.kcal) + ' ккал · Б ' + fmt(r.protein || 0) + ' · Ж ' + fmt(r.fat || 0) + ' · У ' + fmt(r.carbs || 0)) : null, + lines.length ? h('div', { class: 'small dish-row' }, 'Состав: ' + lines.join(', ')) : null, steps.length ? h('div', { class: 'small', 'data-steps': '' }, h('b', null, 'Как приготовить'), h('ol', { style: 'margin:4px 0 0;padding-left:20px' }, ...steps.map(x => h('li', null, x)))) : null), actions); } diff --git a/tests/dish-card.test.js b/tests/dish-card.test.js index 214e724..c50e53f 100644 --- a/tests/dish-card.test.js +++ b/tests/dish-card.test.js @@ -92,3 +92,11 @@ test('Сценарий: на пустом дне рядом с кольцами [...document.querySelectorAll('button')].find(b => b.textContent === 'Выбрать').click(); assert.equal(document.querySelector('[data-empty-hint]'), null); }); + +test('Сценарий: время, порция и состав в карточке — отдельные строки, меню не закрывает низ', t => { + const { dom, document } = open(); t.after(() => dom.window.close()); + const card = [...document.querySelectorAll('.item')].find(i => i.querySelector('[data-nutrition]')); + const rows = card.querySelectorAll('.main .dish-row'); + assert.ok(rows.length >= 3, 'время, порция и состав должны быть отдельными строками'); + assert.match(source, /#app\{[^}]*padding:12px 16px calc\(1[2-9]\dpx/); +}); diff --git a/tests/dish-card.test.js-e b/tests/dish-card.test.js-e index 2a18709..fed42f2 100644 --- a/tests/dish-card.test.js-e +++ b/tests/dish-card.test.js-e @@ -76,13 +76,14 @@ test('Сценарий: после «Выбрать» видны вес и КБ assert.match(row.textContent, new RegExp(n[2] + ' ккал · Б ' + n[3] + ' · Ж ' + n[4] + ' · У ' + n[5])); }); -<<<<<<< HEAD test('Сценарий: рецепт читается на телефоне — текст переносится, а не обрезается', () => { const css = source.match(/\.item \.main\{[^}]*\}/)[0]; assert.match(css, /min-width:0/); assert.match(css, /overflow-wrap:anywhere/); assert.doesNotMatch(source, /text-overflow:\s*ellipsis/); -======= +}); + +<<<<<<< HEAD test('Сценарий: на пустом дне рядом с кольцами есть подсказка, после «Выбрать» она исчезает', t => { const { dom, document } = open(); t.after(() => dom.window.close()); const hint = document.querySelector('[data-empty-hint]'); @@ -91,5 +92,12 @@ test('Сценарий: на пустом дне рядом с кольцами assert.match(document.querySelector('[data-choose-hint]').textContent, /«Выбрать» добавит блюдо в приём пищи и в кольца/); [...document.querySelectorAll('button')].find(b => b.textContent === 'Выбрать').click(); assert.equal(document.querySelector('[data-empty-hint]'), null); ->>>>>>> d4dee26 (TPTIP-17: подсказка на пустом главном экране) +======= +test('Сценарий: время, порция и состав в карточке — отдельные строки, меню не закрывает низ', t => { + const { dom, document } = open(); t.after(() => dom.window.close()); + const card = [...document.querySelectorAll('.item')].find(i => i.querySelector('[data-nutrition]')); + const rows = card.querySelectorAll('.main .dish-row'); + assert.ok(rows.length >= 3, 'время, порция и состав должны быть отдельными строками'); + assert.match(source, /#app\{[^}]*padding:12px 16px calc\(1[2-9]\dpx/); +>>>>>>> 576873e (TPTIP-19: карточка блюда — отдельные строки, отступ под нижнее меню) }); -- 2.45.2