@@ -36,47 +36,36 @@ describe('Content Sections', () => {
3636 cy . openFile ( fileName , { force : true } )
3737 cy . getContent ( )
3838 . type ( '# Heading\nText\n## Heading 2\nText\n## Heading 2' )
39- . then ( ( ) => {
40- cy . getContent ( )
41- . find ( 'a.heading-anchor' )
42- . should ( ( $anchor ) => {
43- expect ( $anchor ) . to . have . length ( 3 )
44- expect ( $anchor . eq ( 0 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading' )
45- expect ( $anchor . eq ( 1 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading-2' )
46- expect ( $anchor . eq ( 2 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading-2--1' )
47- } )
39+ cy . getContent ( ) . find ( 'a.heading-anchor' )
40+ . should ( ( $anchor ) => {
41+ expect ( $anchor ) . to . have . length ( 3 )
42+ expect ( $anchor . eq ( 0 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading' )
43+ expect ( $anchor . eq ( 1 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading-2' )
44+ expect ( $anchor . eq ( 2 ) ) . to . have . attr ( 'href' ) . and . equal ( '#h-heading-2--1' )
4845 } )
4946 } )
5047
5148 it ( 'Anchor ID is updated' , ( ) => {
5249 cy . visitTestFolder ( )
5350 cy . openFile ( fileName , { force : true } )
51+ cy . getContent ( ) . type ( '# Heading 1{enter}' )
5452 cy . getContent ( )
55- . type ( '# Heading 1{enter}' )
56- . then ( ( ) => {
57- cy . getContent ( )
58- . find ( 'h1' )
59- . should ( 'have.attr' , 'id' )
60- . and ( 'equal' , 'h-heading-1' )
61- cy . getContent ( )
62- . find ( 'a.heading-anchor' )
63- . should ( 'have.attr' , 'href' )
64- . and ( 'equal' , '#h-heading-1' )
65- } )
66- cy . then ( ( ) => {
67- cy . getContent ( )
68- . type ( '{backspace}{backspace}2{enter}' )
69- . then ( ( ) => {
70- cy . getContent ( )
71- . find ( 'h1' )
72- . should ( 'have.attr' , 'id' )
73- . and ( 'equal' , 'h-heading-2' )
74- cy . getContent ( )
75- . find ( 'a.heading-anchor' )
76- . should ( 'have.attr' , 'href' )
77- . and ( 'equal' , '#h-heading-2' )
78- } )
79- } )
53+ . find ( 'h1' )
54+ . should ( 'have.attr' , 'id' )
55+ . and ( 'equal' , 'h-heading-1' )
56+ cy . getContent ( )
57+ . find ( 'a.heading-anchor' )
58+ . should ( 'have.attr' , 'href' )
59+ . and ( 'equal' , '#h-heading-1' )
60+ cy . getContent ( ) . type ( '{backspace}{backspace}2{enter}' )
61+ cy . getContent ( )
62+ . find ( 'h1' )
63+ . should ( 'have.attr' , 'id' )
64+ . and ( 'equal' , 'h-heading-2' )
65+ cy . getContent ( )
66+ . find ( 'a.heading-anchor' )
67+ . should ( 'have.attr' , 'href' )
68+ . and ( 'equal' , '#h-heading-2' )
8069 } )
8170
8271 it ( 'scrolls anchor into view' , ( ) => {
@@ -100,27 +89,18 @@ describe('Content Sections', () => {
10089 // Issue #2868
10190 cy . getContent ( )
10291 . type ( '# Heading 1{enter}' )
103- . then ( ( ) => {
104- cy . getContent ( )
105- . find ( 'h1' )
106- . should ( 'have.attr' , 'id' )
107- . and ( 'equal' , 'h-heading-1' )
108- } )
109- cy . then ( ( ) => {
110- cy . getContent ( )
111- . find ( 'h1 [data-node-view-content]' )
112- . click ( { force : true , position : 'center' } )
113- . then ( ( ) => {
114- cy . getActionEntry ( 'headings' )
115- . click ( )
116- cy . get ( '.v-popper__wrapper .open' ) . getActionEntry ( 'headings-h3' )
117- . click ( )
118- cy . getContent ( )
119- . find ( 'h3' )
120- . should ( 'have.attr' , 'id' )
121- . and ( 'equal' , 'h-heading-1' )
122- } )
123- } )
92+ cy . getContent ( )
93+ . find ( 'h1' )
94+ . should ( 'have.attr' , 'id' )
95+ . and ( 'equal' , 'h-heading-1' )
96+ cy . getContent ( )
97+ . find ( 'h1 [data-node-view-content]' )
98+ . click ( { force : true , position : 'center' } )
99+ cy . getActionEntry ( 'headings' ) . click ( )
100+ cy . get ( '.v-popper__wrapper .open' ) . getActionEntry ( 'headings-h3' ) . click ( )
101+ cy . getContent ( ) . find ( 'h3' )
102+ . should ( 'have.attr' , 'id' )
103+ . and ( 'equal' , 'h-heading-1' )
124104 } )
125105 } )
126106
@@ -130,7 +110,7 @@ describe('Content Sections', () => {
130110 cy . openFile ( fileName , { force : true } )
131111 cy . getContent ( )
132112 . type ( '# T1 \n## T2 \n### T3 \n#### T4 \n##### T5 \n###### T6\n' )
133- . then ( refresh )
113+ cy . then ( refresh )
134114 . then ( ( ) => cy . openFile ( fileName , { force : true } ) )
135115 . then ( clickOutline )
136116
0 commit comments