-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2e953d
commit 507a510
Showing
9 changed files
with
577 additions
and
2 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
ui/components/accordion/__tests__/__snapshots__/renders_a_base_accordion.json
Large diffs are not rendered by default.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
ui/components/accordion/__tests__/__snapshots__/renders_a_nested_accordion.json
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
ui/components/accordion/__tests__/__snapshots__/renders_a_styled_accordion.json
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...s/accordion/__tests__/__snapshots__/renders_an_accordion_with_multiple_sections_open.json
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...ponents/accordion/__tests__/__snapshots__/renders_an_accordion_with_section_one_open.json
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...nents/accordion/__tests__/__snapshots__/renders_an_accordion_with_section_three_open.json
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...ponents/accordion/__tests__/__snapshots__/renders_an_accordion_with_section_two_open.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
/* eslint-env jest */ | ||
import React from 'react'; | ||
import { Accordion, AccordionSection } from '../base/example'; | ||
import createHelpers from '../../../../jest.setup'; | ||
|
||
const referenceId01 = 'accordion-details-01'; | ||
const referenceId02 = 'accordion-details-02'; | ||
const referenceId03 = 'accordion-details-03'; | ||
const referenceId04 = 'accordion-details-04'; | ||
const referenceId05 = 'accordion-details-05'; | ||
|
||
const { matchesMarkupAndStyle } = createHelpers(__dirname); | ||
|
||
it('renders a base accordion', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); | ||
|
||
it('renders an accordion with section one open', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); | ||
|
||
it('renders an accordion with section two open', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); | ||
|
||
it('renders an accordion with section three open', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); | ||
|
||
it('renders an accordion with multiple sections open', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); | ||
|
||
it('renders a styled accordion', () => | ||
matchesMarkupAndStyle( | ||
<div className="slds-card"> | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId01} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
</div> | ||
)); | ||
|
||
it('renders a nested accordion', () => | ||
matchesMarkupAndStyle( | ||
<Accordion> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen | ||
referenceId={referenceId01} | ||
> | ||
<Accordion> | ||
<AccordionSection | ||
summary="Nested accordion summary" | ||
isOpen | ||
referenceId={referenceId04} | ||
> | ||
Accordion details - A | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Nested accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId05} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
</Accordion> | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId02} | ||
> | ||
Accordion details - B | ||
</AccordionSection> | ||
<AccordionSection | ||
summary="Accordion summary" | ||
isOpen={false} | ||
referenceId={referenceId03} | ||
> | ||
Accordion details - C | ||
</AccordionSection> | ||
</Accordion> | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters