-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(accordion): value can now be set as string when using multiple is…
- Loading branch information
1 parent
e5a7b34
commit 8f172de
Showing
3 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
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
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,55 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
test('accordion: multiple - open', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/accordion/test/multiple?ionic:_testing=true' | ||
}); | ||
|
||
const screenshotCompares = []; | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
const accordionGroup = await page.find('ion-accordion-group'); | ||
const diningAccordion = await page.find('ion-accordion[value="dining"] ion-item[slot="header"]'); | ||
const attractionsAccordion = await page.find('ion-accordion[value="attractions"] ion-item[slot="header"]'); | ||
|
||
const groupValue = await accordionGroup.getProperty('value'); | ||
expect(groupValue).toEqual('attractions'); | ||
|
||
await diningAccordion.click(); | ||
await page.waitForChanges(); | ||
|
||
const groupValueAgain = await accordionGroup.getProperty('value'); | ||
expect(groupValueAgain).toEqual(['attractions', 'dining']); | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
for (const screenshotCompare of screenshotCompares) { | ||
expect(screenshotCompare).toMatchScreenshot(); | ||
} | ||
}); | ||
|
||
test('accordion: multiple - close', async () => { | ||
const page = await newE2EPage({ | ||
url: '/src/components/accordion/test/multiple?ionic:_testing=true' | ||
}); | ||
|
||
const screenshotCompares = []; | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
const accordionGroup = await page.find('ion-accordion-group'); | ||
const attractionsAccordion = await page.find('ion-accordion[value="attractions"] ion-item[slot="header"]'); | ||
|
||
await attractionsAccordion.click(); | ||
await page.waitForChanges(); | ||
|
||
const groupValue = await accordionGroup.getProperty('value'); | ||
expect(groupValue).toEqual([]); | ||
|
||
screenshotCompares.push(await page.compareScreenshot()); | ||
|
||
for (const screenshotCompare of screenshotCompares) { | ||
expect(screenshotCompare).toMatchScreenshot(); | ||
} | ||
}); |
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,118 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Accordion - Multiple</title> | ||
<meta name="viewport" | ||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> | ||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet"> | ||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet"> | ||
<script src="../../../../../scripts/testing/scripts.js"></script> | ||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
<style> | ||
.grid { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); | ||
grid-row-gap: 20px; | ||
grid-column-gap: 20px; | ||
} | ||
h2 { | ||
font-size: 12px; | ||
font-weight: normal; | ||
|
||
color: #6f7378; | ||
|
||
margin-top: 10px; | ||
margin-left: 5px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<ion-app> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Accordion - Multiple</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<div class="grid ion-padding"> | ||
<div class="grid-item"> | ||
<h2>Multiple</h2> | ||
<ion-accordion-group value="attractions" multiple="true"> | ||
<ion-accordion value="attractions"> | ||
<ion-item color="primary" slot="header" button detail="false"> | ||
<ion-icon slot="start" ios="film-outline" md="film"></ion-icon> | ||
<ion-label> Attractions</ion-label> | ||
</ion-item> | ||
<ion-list lines="none" slot="content"> | ||
<ion-item> | ||
<ion-label>Movie Theaters</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Amusement Parks</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Mini Golf</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-accordion> | ||
<ion-accordion value="dining"> | ||
<ion-item color="warning" slot="header" button detail="false"> | ||
<ion-icon slot="start" name="pizza"></ion-icon> | ||
<ion-label>Dining</ion-label> | ||
</ion-item> | ||
<ion-list lines="none" slot="content"> | ||
<ion-item> | ||
<ion-label>Breakfast & Brunch</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>New American</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Sushi Bars</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-accordion> | ||
<ion-accordion value="games"> | ||
<ion-item color="danger" slot="header" button detail="false"> | ||
<ion-icon slot="start" ios="game-controller-outline" md="game-controller"></ion-icon> | ||
<ion-label>Games</ion-label> | ||
</ion-item> | ||
|
||
<ion-list lines="none" slot="content"> | ||
<ion-item> | ||
<ion-label>Xbox</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Playstation</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Switch</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-accordion> | ||
<ion-accordion value="exercise"> | ||
<ion-item color="success" slot="header" button detail="false"> | ||
<ion-icon slot="start" ios="bicycle-outline" md="bicycle"></ion-icon> | ||
<ion-label>Exercise</ion-label> | ||
</ion-item> | ||
|
||
<ion-list lines="none" slot="content"> | ||
<ion-item> | ||
<ion-label>Jog</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Swim</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Nap</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-accordion> | ||
</ion-accordion-group> | ||
</div> | ||
</div> | ||
</ion-content> | ||
</ion-app> | ||
</body> | ||
</html> |