diff --git a/src-js/godo.js b/src-js/godo.js index e8d03ed..ee9b415 100644 --- a/src-js/godo.js +++ b/src-js/godo.js @@ -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] diff --git a/tests/components/heading.test.js b/tests/components/heading.test.js index 84c2cb4..a44486b 100644 --- a/tests/components/heading.test.js +++ b/tests/components/heading.test.js @@ -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(` +
+ + + +
+ `) + const godoHeadingLevels = dom.querySelector('godo-editor').options.headingLevels + expect(godoHeadingLevels).toBe('4,5,6') +}) + test.each([ ['

LES TESTS UNITAIRES

', undefined, undefined], ['

LES TESTS UNITAIRES

', 2, undefined],