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)
Changes
@@@ -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>@@@ -127,6 +127,7 @@ t('the app page: signed out it invites a sign-in, signed in it lists the chats aassert.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 aassert.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');});
@@ -182,7 +182,7 @@ ${MARK}
@@ -182,7 +182,7 @@ ${MARK}
: '';
: '';
const head = `<header class="vb-head">
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>
<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">
${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)}/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>
<form method="post" action="/vibe/${esc(room.slug)}/delete" data-vb-delete><button type="submit" class="vb-danger">Delete this chat</button></form>
@@ -127,6 +127,7 @@ t('the app page: signed out it invites a sign-in, signed in it lists the chats a
@@ -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');
assert.ok(!out.text.includes('id="ov-footer"'), 'the app has no footer');
const signed = await web('GET', '/vibe', ann);
const signed = await web('GET', '/vibe', ann);
assert.ok(signed.text.includes('What can I help with, 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');
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.
// 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');
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
@@ -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);
assert.ok(/^\/vibe\/v-[0-9a-f]{12}$/.test(form.location), form.location);
const page = await web('GET', form.location, ann);
const page = await web('GET', form.location, ann);
assert.ok(page.text.includes('hello from a form') && page.text.includes('vb-composer'));
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');
assert.strictEqual((await web('GET', form.location, bob)).status, 404, 'someone else\'s chat is not there');
});
});