js: restore heading-levels attribut (#87290)
gitea/godo.js/pipeline/head This commit looks good
Details
gitea/godo.js/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a92c5f4a87
commit
b0cb872c53
|
@ -51,6 +51,7 @@ export default class Godo extends window.HTMLElement {
|
|||
schema: this.getAttribute('schema') || 'full',
|
||||
instantUpdate: this.getAttribute('instant-update') !== null,
|
||||
updateEvent: this.getAttribute('update-event'),
|
||||
headingLevels: this.getAttribute('heading-levels'),
|
||||
}
|
||||
|
||||
const componentsDefinitions = [base, fontMarks, link]
|
||||
|
|
|
@ -2,11 +2,12 @@ import {Node} from 'prosemirror-model'
|
|||
import { expect, test } from 'vitest'
|
||||
|
||||
import {loadSchema} from '../../src-js/utils'
|
||||
import {parse, serialize, TestState} from '../helpers'
|
||||
import {parse, serialize, TestState, domTest} from '../helpers'
|
||||
|
||||
import base from '../../src-js/components/base'
|
||||
import fontMarks from '../../src-js/components/font-marks'
|
||||
import heading from '../../src-js/components/heading'
|
||||
import '../../src-js/godo.js'
|
||||
|
||||
function headingComponents () {
|
||||
// test we can pick non-consecutive headers levels and that the number
|
||||
|
@ -15,6 +16,20 @@ function headingComponents () {
|
|||
return [base, fontMarks, heading].map(c => c(options))
|
||||
}
|
||||
|
||||
domTest('Heading levels option', ({appendToDom}) => {
|
||||
const dom = appendToDom(`
|
||||
<div>
|
||||
<textarea hidden id="marshmallow">
|
||||
<h1>Initial Content</h1>
|
||||
</textarea>
|
||||
<godo-editor linked-source="marshmallow" heading-levels="4,5,6" >
|
||||
</godo-editor>
|
||||
</div>
|
||||
`)
|
||||
const godoHeadingLevels = dom.querySelector('godo-editor').options.headingLevels
|
||||
expect(godoHeadingLevels).toBe('4,5,6')
|
||||
})
|
||||
|
||||
test.each([
|
||||
['<h1>LES TESTS UNITAIRES</h1>', undefined, undefined],
|
||||
['<h2>LES TESTS UNITAIRES</h2>', 2, undefined],
|
||||
|
|
Loading…
Reference in New Issue