From b6e60c749751f9410b9d171f21827f06985004b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20CG?= Date: Mon, 19 Aug 2024 10:49:48 +0200 Subject: [PATCH] fix(staggered-fade-and-slide): filter already animated elements --- .../staggered-fade-and-slide.spec.ts | 8 --- .../animations/staggered-fade-and-slide.vue | 51 ++++++++++++------- packages/x-components/src/views/home/Home.vue | 6 ++- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/packages/x-components/src/components/animations/__tests__/staggered-fade-and-slide.spec.ts b/packages/x-components/src/components/animations/__tests__/staggered-fade-and-slide.spec.ts index 70d2c19dbe..08285a229f 100644 --- a/packages/x-components/src/components/animations/__tests__/staggered-fade-and-slide.spec.ts +++ b/packages/x-components/src/components/animations/__tests__/staggered-fade-and-slide.spec.ts @@ -75,25 +75,17 @@ describe('testing StaggeredFadeAndSlide component', () => { expect(elements[1].element.style.transitionDelay).not.toBe('0ms'); expect(elements[2].element.style.transitionDelay).not.toBe('0ms'); - expect(elements[0].element.dataset.animated).toBe('true'); - expect(elements[1].element.dataset.animated).toBeUndefined(); - expect(elements[2].element.dataset.animated).toBeUndefined(); - // Once the previous transition is finished wait for the stagger delay jest.advanceTimersByTime(stagger); expect(elements[1].element.style.transitionDelay).toBe('0ms'); expect(elements[2].element.style.transitionDelay).not.toBe('0ms'); - expect(elements[1].element.dataset.animated).toBe('true'); - expect(elements[2].element.dataset.animated).toBeUndefined(); - // Once the previous transition is finished wait for the stagger delay jest.advanceTimersByTime(stagger); for (const el of elements) { expect(el.element.style.transitionDelay).toBe('0ms'); - expect(el.element.dataset.animated).toBe('true'); } }); }); diff --git a/packages/x-components/src/components/animations/staggered-fade-and-slide.vue b/packages/x-components/src/components/animations/staggered-fade-and-slide.vue index b085b63231..bb4e27c5b4 100644 --- a/packages/x-components/src/components/animations/staggered-fade-and-slide.vue +++ b/packages/x-components/src/components/animations/staggered-fade-and-slide.vue @@ -11,7 +11,7 @@