@@ -2,7 +2,7 @@ export const exampleAccordionPlain = (): HTMLElement => {
22 const div = document . createElement ( 'div' ) ;
33
44 div . innerHTML = `
5- <article class="usa-accordion" id="accEx1">
5+ <article class="usa-accordion" id="accEx1" data-heading-selector="h3" >
66 <section class="usa-prose">
77 <h3>this is section header 1 (ex. 1)</h3>
88 <p>this is accordion content.</p>
@@ -43,38 +43,38 @@ export const exampleProseless = (): HTMLElement => {
4343 const div = document . createElement ( 'div' ) ;
4444
4545 div . innerHTML = `
46- <article class="usa-accordion" id="accEx1">
46+ <article class="usa-accordion" id="accEx1" data-heading-selector="h3" >
4747 <section>
4848 <h3>this is section header 1 (ex. 1)</h3>
4949 <p>this is accordion content.</p>
50- <ul>
51- <li>fake list for content</li>
52- </ul>
53- <h4>Header meant to try and break stuff</h4>
54- <p>
55- Cuz they do this in content sometimes. this is the real test
56- </p>
57- <h3>this is section header 2 (ex. 1)</h3>
58- <p>This is more content</p>
59- <ol>
60- <li>trying out some different content types</li>
61- </ol>
62- <h3>this is section header 3 (ex. 1)</h3>
63- <p>Even more content</p>
64- <p>
65- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras
66- iaculis fringilla orci eu sagittis. Phasellus sit amet neque
67- vitae ex molestie condimentum sit amet sed leo.
68- </p>
69- <h3>this is section header 4 (ex. 1)</h3>
70- <p>Even more content</p>
71- <p>
72- Donec ullamcorper porta nibh id accumsan. Quisque non ornare
73- neque, et volutpat dolor. Vestibulum nisi ipsum, sagittis in
74- ex ac, viverra placerat massa.
75- </p>
76- </section>
77- </article>
50+ <ul>
51+ <li>fake list for content</li>
52+ </ul>
53+ <h4>Header meant to try and break stuff</h4>
54+ <p>
55+ Cuz they do this in content sometimes. this is the real test
56+ </p>
57+ <h3>this is section header 2 (ex. 1)</h3>
58+ <p>This is more content</p>
59+ <ol>
60+ <li>trying out some different content types</li>
61+ </ol>
62+ <h3>this is section header 3 (ex. 1)</h3>
63+ <p>Even more content</p>
64+ <p>
65+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras
66+ iaculis fringilla orci eu sagittis. Phasellus sit amet neque
67+ vitae ex molestie condimentum sit amet sed leo.
68+ </p>
69+ <h3>this is section header 4 (ex. 1)</h3>
70+ <p>Even more content</p>
71+ <p>
72+ Donec ullamcorper porta nibh id accumsan. Quisque non ornare
73+ neque, et volutpat dolor. Vestibulum nisi ipsum, sagittis in
74+ ex ac, viverra placerat massa.
75+ </p>
76+ </section>
77+ </article>
7878 ` ;
7979
8080 return div ;
@@ -84,7 +84,7 @@ export const exampleAccordionBad = (): HTMLElement => {
8484 const div = document . createElement ( 'div' ) ;
8585
8686 div . innerHTML = `
87- <article class="usa-accordion" id="accEx1" data-open-sections="1,2,3">
87+ <article class="usa-accordion" id="accEx1" data-open-sections="1,2,3" data-allow-multiple data-heading-selector="h3" >
8888 <section class="usa-prose">
8989 <h3>this is section header 1 (ex. 1)</h3>
9090 <p>this is accordion content.</p>
@@ -125,7 +125,7 @@ export const exampleAccordionInitialized = (): HTMLElement => {
125125 const div = document . createElement ( 'div' ) ;
126126
127127 div . innerHTML = `
128- <div class="usa-accordion " data-open-sections="1">
128+ <div class="usa-accordion" data-open-sections="1">
129129 <h4 class="usa-accordion__heading">
130130 <button class="usa-accordion__button" aria-controls="acc1234" type="button" aria-expanded="true">
131131 First Amendment
@@ -153,3 +153,22 @@ export const exampleAccordionInitialized = (): HTMLElement => {
153153 </div>` ;
154154 return div ;
155155} ;
156+
157+ export const exampleAccordionNoNesting = ( ) : HTMLElement => {
158+ const div = document . createElement ( 'div' ) ;
159+
160+ div . innerHTML = `
161+ <div class="cgdp-article-body cgdp-article-body--multiple" data-heading-selector="h2">
162+ <section>
163+ <h2>First Heading</h2>
164+ <p>Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech</p>
165+ <h2>Inner Heading</h2>
166+ <p>Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech</p>
167+ </section>
168+ <section>
169+ <h2>Second Section Heading</h2>
170+ <p>Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech</p>
171+ </section>
172+ </div>` ;
173+ return div ;
174+ } ;
0 commit comments