openvibers/openvibe.chat Commits

Vibe: one <h1> on a new chat (the greeting); the header's name is a heading only inside a chat (#177)

OP OpenVibers committed 20 days ago · 1b979be9ca · 2 files, +3 −1

Changes

ddiff --git a/server/web/vibe-pages.js b/server/web/vibe-pages.js
iindex 8451e1a..5003e34 100644
---- a/server/web/vibe-pages.js
++++ b/server/web/vibe-pages.js
@@@ -182,7 +182,7 @@ ${MARK}
: '';
const head = `<header class="vb-head">
<button class="vb-icon vb-menu" type="button" data-vb-open aria-controls="vb-rail" aria-expanded="false" aria-label="Show your chats">${ICON.menu}</button>
--<h1 class="vb-title" id="vb-title">${esc(title)}</h1>
++${room ? `<h1 class="vb-title" id="vb-title">${esc(title)}</h1>` : `<p class="vb-title" id="vb-title">${esc(title)}</p>`}
${room ? `<details class="vb-actions"><summary class="vb-icon" aria-label="Chat options">${ICON.more}</summary><div class="vb-pop">
<form method="post" action="/vibe/${esc(room.slug)}/rename" class="vb-rename"><label for="vb-name">Name</label><input id="vb-name" name="name" maxlength="${vibe.TITLE_MAX}" value="${esc(room.name)}" required><button type="submit">Rename</button></form>
<form method="post" action="/vibe/${esc(room.slug)}/delete" data-vb-delete><button type="submit" class="vb-danger">Delete this chat</button></form>
ddiff --git a/test/vibe.test.js b/test/vibe.test.js
iindex 367bfbb..6d0902a 100644
---- a/test/vibe.test.js
++++ b/test/vibe.test.js
@@@ -127,6 +127,7 @@ t('the app page: signed out it invites a sign-in, signed in it lists the chats a
assert.ok(!out.text.includes('id="ov-footer"'), 'the app has no footer');
const signed = await web('GET', '/vibe', ann);
assert.ok(signed.text.includes('What can I help with, Ann?'));
++ assert.strictEqual((signed.text.match(/<h1[\s>]/g) || []).length, 1, 'one h1 on a new chat: the greeting (the header names it in a <p>)');
assert.ok(signed.text.includes('class="vb-chat" href="/vibe/v-'), 'the rail lists their chats');
// The rail leads to the rest of the person's agent: their tasks, their computers and robots, team workspaces.
assert.ok(/href="https:\/\/openvibe\.actor\/tasks"[^>]*>[\s\S]*?<span>Tasks<\/span>/.test(signed.text), 'Tasks');
@@@ -138,6 +139,7 @@ t('the app page: signed out it invites a sign-in, signed in it lists the chats a
assert.ok(/^\/vibe\/v-[0-9a-f]{12}$/.test(form.location), form.location);
const page = await web('GET', form.location, ann);
assert.ok(page.text.includes('hello from a form') && page.text.includes('vb-composer'));
++ assert.strictEqual((page.text.match(/<h1[\s>]/g) || []).length, 1, 'one h1 in a chat: its name');
assert.strictEqual((await web('GET', form.location, bob)).status, 404, 'someone else\'s chat is not there');
});