@@ -52,6 +52,13 @@ describePlugin(Heading, testEditor => {
5252 contentAfter : '<p>[ab</p><h2>]cd</h2>' ,
5353 } ) ;
5454 } ) ;
55+ it ( 'should not turn a div into a heading 0' , async ( ) => {
56+ await testEditor ( BasicEditor , {
57+ contentBefore : '<div>[ab]</div>' ,
58+ stepFunction : applyHeadingStyle ( 0 ) ,
59+ contentAfter : '<div>[ab]</div>' ,
60+ } ) ;
61+ } ) ;
5562 } ) ;
5663 describe ( 'level 1' , ( ) => {
5764 it ( 'should turn a paragraph into a heading 1' , async ( ) => {
@@ -82,6 +89,13 @@ describePlugin(Heading, testEditor => {
8289 contentAfter : '<h1>[ab</h1><h2>]cd</h2>' ,
8390 } ) ;
8491 } ) ;
92+ it ( 'should not turn a div into a heading 1' , async ( ) => {
93+ await testEditor ( BasicEditor , {
94+ contentBefore : '<div>[ab]</div>' ,
95+ stepFunction : applyHeadingStyle ( 1 ) ,
96+ contentAfter : '<div>[ab]</div>' ,
97+ } ) ;
98+ } ) ;
8599 } ) ;
86100 describe ( 'level 2' , ( ) => {
87101 it ( 'should turn a heading 1 into a heading 2' , async ( ) => {
@@ -112,6 +126,13 @@ describePlugin(Heading, testEditor => {
112126 contentAfter : '<h2>[ab</h2><h1>]cd</h1>' ,
113127 } ) ;
114128 } ) ;
129+ it ( 'should not turn a div into a heading 2' , async ( ) => {
130+ await testEditor ( BasicEditor , {
131+ contentBefore : '<div>[ab]</div>' ,
132+ stepFunction : applyHeadingStyle ( 2 ) ,
133+ contentAfter : '<div>[ab]</div>' ,
134+ } ) ;
135+ } ) ;
115136 } ) ;
116137 describe ( 'level 3' , ( ) => {
117138 it ( 'should turn a heading 1 into a heading 3' , async ( ) => {
@@ -142,6 +163,13 @@ describePlugin(Heading, testEditor => {
142163 contentAfter : '<h3>[ab</h3><h1>]cd</h1>' ,
143164 } ) ;
144165 } ) ;
166+ it ( 'should not turn a div into a heading 3' , async ( ) => {
167+ await testEditor ( BasicEditor , {
168+ contentBefore : '<div>[ab]</div>' ,
169+ stepFunction : applyHeadingStyle ( 3 ) ,
170+ contentAfter : '<div>[ab]</div>' ,
171+ } ) ;
172+ } ) ;
145173 } ) ;
146174 describe ( 'level 4' , ( ) => {
147175 it ( 'should turn a heading 1 into a heading 4' , async ( ) => {
@@ -172,6 +200,13 @@ describePlugin(Heading, testEditor => {
172200 contentAfter : '<h4>[ab</h4><h1>]cd</h1>' ,
173201 } ) ;
174202 } ) ;
203+ it ( 'should not turn a div into a heading 4' , async ( ) => {
204+ await testEditor ( BasicEditor , {
205+ contentBefore : '<div>[ab]</div>' ,
206+ stepFunction : applyHeadingStyle ( 4 ) ,
207+ contentAfter : '<div>[ab]</div>' ,
208+ } ) ;
209+ } ) ;
175210 } ) ;
176211 describe ( 'level 5' , ( ) => {
177212 it ( 'should turn a heading 1 into a heading 5' , async ( ) => {
@@ -202,6 +237,13 @@ describePlugin(Heading, testEditor => {
202237 contentAfter : '<h5>[ab</h5><h1>]cd</h1>' ,
203238 } ) ;
204239 } ) ;
240+ it ( 'should not turn a div into a heading 5' , async ( ) => {
241+ await testEditor ( BasicEditor , {
242+ contentBefore : '<div>[ab]</div>' ,
243+ stepFunction : applyHeadingStyle ( 5 ) ,
244+ contentAfter : '<div>[ab]</div>' ,
245+ } ) ;
246+ } ) ;
205247 } ) ;
206248 describe ( 'level 6' , ( ) => {
207249 it ( 'should turn a heading 1 into a heading 6' , async ( ) => {
@@ -232,6 +274,13 @@ describePlugin(Heading, testEditor => {
232274 contentAfter : '<h6>[ab</h6><h1>]cd</h1>' ,
233275 } ) ;
234276 } ) ;
277+ it ( 'should not turn a div into a heading 6' , async ( ) => {
278+ await testEditor ( BasicEditor , {
279+ contentBefore : '<div>[ab]</div>' ,
280+ stepFunction : applyHeadingStyle ( 6 ) ,
281+ contentAfter : '<div>[ab]</div>' ,
282+ } ) ;
283+ } ) ;
235284 } ) ;
236285 } ) ;
237286 describe ( 'insertParagraphBreak' , ( ) => {
0 commit comments