Remove RevealController initial class

- This is not used and was added as part of #10793
- Avoid this controller managing this behaviour and instead if needed we can use w-init
pull/11101/head
Chiemezuo 2023-10-24 04:58:10 +01:00 zatwierdzone przez LB (Ben Johnston)
rodzic f0b6509f29
commit 415b569b29
2 zmienionych plików z 8 dodań i 18 usunięć

Wyświetl plik

@ -143,13 +143,12 @@ describe('RevealController', () => {
it('should update classes when opened/closed', async () => {
await setup(`
<section
class="container remove-me-when-connected"
class="container"
id="section"
data-controller="w-reveal"
data-w-reveal-close-icon-class="icon-collapse"
data-w-reveal-closed-class="collapsed"
data-w-reveal-closed-value="true"
data-w-reveal-initial-class="remove-me-when-connected"
data-w-reveal-open-icon-class="icon-expand"
data-w-reveal-opened-class="open--container"
data-w-reveal-opened-content-class="show-max-width"
@ -170,10 +169,6 @@ describe('RevealController', () => {
const icon = document.querySelector('.icon');
const useElement = icon.querySelector('use');
// initially closed
expect(document.getElementById('section').className).toEqual(
'container collapsed', // should not have 'remove-me-when-connected'
);
expect(
[...document.querySelectorAll('li')].every(
(li) => li.className === 'item',

Wyświetl plik

@ -17,7 +17,6 @@ export class RevealController extends Controller<HTMLElement> {
static classes = [
'closed',
'closeIcon',
'initial',
'opened',
'openedContent',
'openIcon',
@ -76,18 +75,14 @@ export class RevealController extends Controller<HTMLElement> {
new Promise((resolve) => {
setTimeout(resolve);
})
.then(() => {
this.element.classList.remove(...this.initialClasses);
})
.then(() => {
this.dispatch('ready', {
cancelable: false,
detail: {
closed: this.closedValue,
},
});
}).then(() => {
this.dispatch('ready', {
cancelable: false,
detail: {
closed: this.closedValue,
},
});
});
}
closedValueChanged(shouldClose: boolean, previouslyClosed?: boolean) {