Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ilc/client): observe data-ilc-slot-ready attribute #589

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export class SlotRenderObserver {
}
});

this.#observer.observe(targetNode, { childList: true, subtree: true, attributeFilter: ['style'] });
this.#observer.observe(targetNode, {
childList: true,
subtree: true,
attributeFilter: ['style', 'data-ilc-slot-ready'],
});
}

disconnect() {
Expand Down
28 changes: 28 additions & 0 deletions ilc/client/TransitionManager/TransitionManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,34 @@ describe('TransitionManager', () => {
chai.expect(spinner.getRef()).to.be.null;
});

it('should destroy spinner when data attribute is set', async () => {
const newBodyApplication = {
id: 'new-body-application',
class: 'new-body-spa',
};

newBodyApplication.ref = html` <div id="${newBodyApplication.id}" class="${newBodyApplication.class}"></div> `;

applications.navbar.appendApplication();
applications.body.appendApplication();

handlePageTransition(slots.body.id, slotWillBe.rerendered);

applications.body.removeApplication();
await clock.runAllAsync();

chai.expect(spinner.getRef()).to.be.not.null;

slots.body.ref.appendChild(newBodyApplication.ref);
await clock.runAllAsync();

chai.expect(spinner.getRef()).to.be.not.null;

document.getElementById(newBodyApplication.id).dataset.ilcSlotReady = true;
await clock.runAllAsync();
chai.expect(spinner.getRef()).to.be.null;
});

it('should remove CSS that is marked as non used when all fragments contain visible nodes', async () => {
const newBodyApplication = {
id: 'new-body-application',
Expand Down
Loading