chore: sync with main
@ -1,5 +1,5 @@
|
|||||||
import type { ComponentInterface } from '@stencil/core';
|
import type { ComponentInterface } from '@stencil/core';
|
||||||
import { Component, Element, Host, Prop, State, h } from '@stencil/core';
|
import { Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';
|
||||||
import { addEventListener, getElementRoot, raf, removeEventListener, transitionEndAsync } from '@utils/helpers';
|
import { addEventListener, getElementRoot, raf, removeEventListener, transitionEndAsync } from '@utils/helpers';
|
||||||
import { chevronDown } from 'ionicons/icons';
|
import { chevronDown } from 'ionicons/icons';
|
||||||
|
|
||||||
@ -56,6 +56,10 @@ export class Accordion implements ComponentInterface {
|
|||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
@Prop() value = `ion-accordion-${accordionIds++}`;
|
@Prop() value = `ion-accordion-${accordionIds++}`;
|
||||||
|
@Watch('value')
|
||||||
|
valueChanged() {
|
||||||
|
this.updateState();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If `true`, the accordion cannot be interacted with.
|
* If `true`, the accordion cannot be interacted with.
|
||||||
|
@ -4,7 +4,7 @@ import { AccordionGroup } from '../../accordion-group/accordion-group.tsx';
|
|||||||
import { Item } from '../../item/item.tsx';
|
import { Item } from '../../item/item.tsx';
|
||||||
import { Accordion } from '../accordion.tsx';
|
import { Accordion } from '../accordion.tsx';
|
||||||
|
|
||||||
it('should open correct accordions', async () => {
|
it('should open correct accordions when accordion group value is set', async () => {
|
||||||
const page = await newSpecPage({
|
const page = await newSpecPage({
|
||||||
components: [Item, Accordion, AccordionGroup],
|
components: [Item, Accordion, AccordionGroup],
|
||||||
html: `
|
html: `
|
||||||
@ -40,6 +40,42 @@ it('should open correct accordions', async () => {
|
|||||||
expect(accordions[2].classList.contains('accordion-collapsed')).toEqual(true);
|
expect(accordions[2].classList.contains('accordion-collapsed')).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should open correct accordions when accordion value is set', async () => {
|
||||||
|
const page = await newSpecPage({
|
||||||
|
components: [Item, Accordion, AccordionGroup],
|
||||||
|
html: `
|
||||||
|
<ion-accordion-group animated="false" value="first">
|
||||||
|
<ion-accordion>
|
||||||
|
<ion-item slot="header">Label</ion-item>
|
||||||
|
<div slot="content">Content</div>
|
||||||
|
</ion-accordion>
|
||||||
|
<ion-accordion value="second">
|
||||||
|
<ion-item slot="header">Label</ion-item>
|
||||||
|
<div slot="content">Content</div>
|
||||||
|
</ion-accordion>
|
||||||
|
<ion-accordion value="third">
|
||||||
|
<ion-item slot="header">Label</ion-item>
|
||||||
|
<div slot="content">Content</div>
|
||||||
|
</ion-accordion>
|
||||||
|
</ion-accordion-group>
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
|
const accordionGroup = page.body.querySelector('ion-accordion-group');
|
||||||
|
const accordions = accordionGroup.querySelectorAll('ion-accordion');
|
||||||
|
|
||||||
|
accordions.forEach((accordion) => {
|
||||||
|
expect(accordion.classList.contains('accordion-collapsed')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
accordions[0].value = 'first';
|
||||||
|
await page.waitForChanges();
|
||||||
|
|
||||||
|
expect(accordions[0].classList.contains('accordion-collapsed')).toEqual(false);
|
||||||
|
expect(accordions[1].classList.contains('accordion-collapsed')).toEqual(true);
|
||||||
|
expect(accordions[2].classList.contains('accordion-collapsed')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should open more than one accordion when multiple="true"', async () => {
|
it('should open more than one accordion when multiple="true"', async () => {
|
||||||
const page = await newSpecPage({
|
const page = await newSpecPage({
|
||||||
components: [Item, Accordion, AccordionGroup],
|
components: [Item, Accordion, AccordionGroup],
|
||||||
|
@ -194,7 +194,7 @@ input {
|
|||||||
* the checkbox should be on the end
|
* the checkbox should be on the end
|
||||||
* when the label sits at the start.
|
* when the label sits at the start.
|
||||||
*/
|
*/
|
||||||
@include margin(0, 8px, 0, 0);
|
@include margin(0, $form-control-label-margin, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ input {
|
|||||||
* when the label sits at the end.
|
* when the label sits at the end.
|
||||||
*/
|
*/
|
||||||
:host(.checkbox-label-placement-end) .label-text-wrapper {
|
:host(.checkbox-label-placement-end) .label-text-wrapper {
|
||||||
@include margin(0, 0, 0, 8px);
|
@include margin(0, 0, 0, $form-control-label-margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ input {
|
|||||||
* the checkbox should be on the end
|
* the checkbox should be on the end
|
||||||
* when the label sits at the start.
|
* when the label sits at the start.
|
||||||
*/
|
*/
|
||||||
@include margin(0, 8px, 0, 0);
|
@include margin(0, $form-control-label-margin, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 865 B After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 998 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |