feat: articles format option with markdown new default

This commit is contained in:
fsylvain committed 2026-10-04 19:04:12 +02:00
1 parent 68401d66e0
commit 7e9bd9ba30
61 files changed
+2269 -243

No files matched your search

@@ -56,6 +56,35 @@ afterEach(async () => {
await router.push('/login')
})
describe('the alignment toolbar buttons align the current block', () => {
const ALIGNMENTS = ['left', 'center', 'right', 'justify']
const FIRST_ALIGN_BUTTON = 7
function alignButton(name: string) {
const buttons = document.body.querySelectorAll<HTMLButtonElement>('.article-editor button')
return buttons[FIRST_ALIGN_BUTTON + ALIGNMENTS.indexOf(name)] ?? null
}
it.each(ALIGNMENTS)('keeps the %s button enabled', async (name) => {
await mountArticleEditor()
const button = alignButton(name)
expect(button).not.toBeNull()
expect(button?.disabled).toBe(false)
})
it('writes the alignment into the body when a button is clicked', async () => {
const wrapper = await mountArticleEditor()
const editor = wrapper.findComponent(ArticleEditor)
alignButton('center')?.click()
await flushPromises()
expect(editor.props('modelValue')).toContain('text-align: center')
})
})
describe('insertImage stamps the inserted image with its numeric id', () => {
it('renders data-image-id on the img and emits the updated body', async () => {
const wrapper = await mountArticleEditor()
@@ -206,7 +206,7 @@ describe('Submitting disables the form and cannot be dismissed', () => {
await clickButton('Create draft')
expect(requestMock).toHaveBeenCalledWith(
'/v1/article/',
'/v1/article/?format=html',
expect.objectContaining({
method: 'POST',
body: JSON.stringify({ title: TITLE, body: BODY }),
@@ -336,7 +336,7 @@ describe('Retrying after an Error succeeds', () => {
expect(requestMock).toHaveBeenCalledTimes(2)
expect(requestMock).toHaveBeenNthCalledWith(
2,
'/v1/article/',
'/v1/article/?format=html',
expect.objectContaining({
body: JSON.stringify({ title: TITLE, body: BODY }),
}),