Skip to content

Commit aa05081

Browse files
committed
fix: hydratation problems in org card
1 parent d9ad265 commit aa05081

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

datagouv-components/src/components/OrganizationCard.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
loading="lazy"
1212
>
1313
</div>
14-
<p class="mb-0.5 font-bold">
14+
<div class="mb-0.5 font-bold">
1515
<AppLink
1616
:to="organization.page"
1717
class="overflow-hidden"
@@ -21,7 +21,7 @@
2121
:organization
2222
/>
2323
</AppLink>
24-
</p>
24+
</div>
2525
<div class="mb-2 flex flex-wrap gap-1 items-center">
2626
<template v-if="type !== 'other'">
2727
<OwnerType
@@ -58,13 +58,13 @@
5858
</div>
5959
</div>
6060
</div>
61-
<p class="mt-1 mb-0">
61+
<div class="mt-1 mb-0">
6262
<TextClamp
6363
v-if="'description' in organization"
6464
:text="removeMarkdownSync(organization.description)"
6565
:max-lines="3"
6666
/>
67-
</p>
67+
</div>
6868
</div>
6969
</div>
7070
</template>

pages/reuses/[rid]/discussions.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const props = defineProps<{
1313
reuse: Reuse
1414
}>()
1515
const closed = computed(() => props.reuse.metrics.discussions - props.reuse.metrics.discussions_open)
16-
console.log(closed)
1716
1817
useSeoMeta({ robots: 'noindex' })
1918
</script>

tests/helpers.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Page } from '@playwright/test'
2+
import { test } from '@playwright/test'
23

34
// When clicking "Suivant" we execute the validation of the frequency input
45
// because we blur outside the select. This validation create a warning (because
@@ -8,3 +9,47 @@ import type { Page } from '@playwright/test'
89
export const clickOutside = async (page: Page) => {
910
await page.mouse.click(1, 1)
1011
}
12+
13+
const IGNORED_MESSAGES = [
14+
// Cookie secure flag doesn't work in dev (HTTP)
15+
'non-HTTPS cookie',
16+
]
17+
18+
export function setupConsoleTracking(page: Page) {
19+
const warnings: string[] = []
20+
const errors: string[] = []
21+
22+
page.on('console', (msg) => {
23+
const text = msg.text()
24+
if (IGNORED_MESSAGES.some(ignored => text.includes(ignored))) return
25+
26+
const type = msg.type()
27+
if (type === 'warning') {
28+
warnings.push(text)
29+
}
30+
if (type === 'error') {
31+
errors.push(text)
32+
}
33+
})
34+
35+
page.on('pageerror', (error) => {
36+
if (IGNORED_MESSAGES.some(ignored => error.message.includes(ignored))) return
37+
errors.push(error.message)
38+
})
39+
40+
return {
41+
annotateAndCheck() {
42+
for (const w of warnings) {
43+
test.info().annotations.push({ type: 'warning', description: w })
44+
}
45+
for (const e of errors) {
46+
test.info().annotations.push({ type: 'error', description: e })
47+
}
48+
49+
const all = [...errors, ...warnings]
50+
if (all.length > 0) {
51+
throw new Error(`Console errors/warnings:\n${all.join('\n')}`)
52+
}
53+
},
54+
}
55+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { test, expect } from '@playwright/test'
2+
import { setupConsoleTracking } from '../helpers'
3+
4+
test('organizations page renders without errors', async ({ page }) => {
5+
const { annotateAndCheck } = setupConsoleTracking(page)
6+
7+
const response = await page.goto('/organizations')
8+
expect(response?.status()).toBeLessThan(400)
9+
10+
await expect(page).toHaveTitle(/Organisations/)
11+
await expect(page.getByRole('heading', { name: 'Organisations', level: 1 })).toBeVisible()
12+
13+
await page.waitForLoadState('networkidle')
14+
annotateAndCheck()
15+
})

0 commit comments

Comments
 (0)