From 424c29cd9b7739591cf16f0a283e1c025ae49080 Mon Sep 17 00:00:00 2001 From: Danish Shakeel Date: Thu, 12 Feb 2026 03:11:02 +0100 Subject: [PATCH 1/5] feat: remove dist branch creation on release --- .github/workflows/release.yml | 43 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9a7561..d906c07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,27 +34,22 @@ jobs: - name: Build Plugin ZIP run: make zip - - name: Create Release and Upload Asset - uses: softprops/action-gh-release@v1 - with: - tag_name: v${{ steps.get_version.outputs.VERSION }} - name: v${{ steps.get_version.outputs.VERSION }} - generate_release_notes: true - files: core-carousel.zip - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Prepare Distribution Bundle - run: | - mkdir dist-bundle - cp core-carousel.zip dist-bundle/ - - - name: Deploy to Dist Branch - uses: s0/git-publish-subdir-action@develop - env: - REPO: self - BRANCH: dist - FOLDER: dist-bundle - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MESSAGE: "chore: distribution build v${{ steps.get_version.outputs.VERSION }}" - SKIP_EMPTY_COMMITS: true \ No newline at end of file + - name: Create Release and Upload Asset + + uses: softprops/action-gh-release@v1 + + with: + + tag_name: v${{ steps.get_version.outputs.VERSION }} + + name: v${{ steps.get_version.outputs.VERSION }} + + generate_release_notes: true + + files: core-carousel.zip + + env: + + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + \ No newline at end of file From 38fe6716c07829ed9683eaccba83e077806cacdf Mon Sep 17 00:00:00 2001 From: Danish Shakeel Date: Thu, 12 Feb 2026 03:12:00 +0100 Subject: [PATCH 2/5] fix: change plugin url to github releases --- blueprint.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/blueprint.json b/blueprint.json index cb95e0e..f43cad8 100644 --- a/blueprint.json +++ b/blueprint.json @@ -10,13 +10,12 @@ "step": "installPlugin", "pluginData": { "resource": "url", - "url": "https://cdn.statically.io/gh/rtCamp/core-carousel@dist/core-carousel.zip" + "url": "https://github.com/rtCamp/core-carousel/releases/latest/download/core-carousel.zip" } }, { "step": "login", - "username": "admin", - "password": "password" + "username": "admin" }, { "step": "importWxr", From 01a8002a15eda89c5da8902d37f2e1510217b382 Mon Sep 17 00:00:00 2001 From: Danish Shakeel Date: Thu, 12 Feb 2026 03:24:53 +0100 Subject: [PATCH 3/5] chore: update packages --- package-lock.json | 12 ++++++------ package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4313f8..d43f770 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "devDependencies": { "@commitlint/cli": "20.4.1", "@commitlint/config-conventional": "20.4.1", - "@testing-library/jest-dom": "^6.6.3", + "@testing-library/jest-dom": "6.9.1", "@testing-library/react": "^16.1.0", "@types/jest": "^29.5.14", "@types/react": "^18.3.27", @@ -11139,14 +11139,14 @@ } }, "node_modules/axios": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", - "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "version": "1.13.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz", + "integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==", "dev": true, "license": "MIT", "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.4", + "follow-redirects": "^1.15.11", + "form-data": "^4.0.5", "proxy-from-env": "^1.1.0" } }, diff --git a/package.json b/package.json index d933fc4..b4761d2 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@commitlint/cli": "20.4.1", "@commitlint/config-conventional": "20.4.1", - "@testing-library/jest-dom": "^6.6.3", + "@testing-library/jest-dom": "6.9.1", "@testing-library/react": "^16.1.0", "@types/jest": "^29.5.14", "@types/react": "^18.3.27", @@ -63,4 +63,4 @@ "react-dom": "^18.3.1", "webpack-dev-server": ">=5.2.1" } -} \ No newline at end of file +} From 6ab9931a924bb170adcd6381d8c1ba7a9d828aec Mon Sep 17 00:00:00 2001 From: Danish Shakeel Date: Thu, 12 Feb 2026 03:35:19 +0100 Subject: [PATCH 4/5] feat: add tests tsconfig --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8c5701a..7dc6ff5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,7 +36,7 @@ "parserOptions": { "ecmaFeatures": { "jsx": true }, "sourceType": "module", - "project": "./tsconfig.json" + "project": ["./tsconfig.json", "./tests/js/tsconfig.json"] }, "plugins": ["@typescript-eslint"], "rules": { From f2abd09245b8be2dca7c5fc783b881d70d3b392d Mon Sep 17 00:00:00 2001 From: Danish Shakeel Date: Thu, 12 Feb 2026 03:35:38 +0100 Subject: [PATCH 5/5] fix: doc params --- src/blocks/carousel/__tests__/view.test.ts | 91 ++++++++++------------ 1 file changed, 42 insertions(+), 49 deletions(-) diff --git a/src/blocks/carousel/__tests__/view.test.ts b/src/blocks/carousel/__tests__/view.test.ts index ee8c22a..9640019 100644 --- a/src/blocks/carousel/__tests__/view.test.ts +++ b/src/blocks/carousel/__tests__/view.test.ts @@ -12,11 +12,7 @@ * @package */ -import { - store, - getContext, - getElement, -} from '@wordpress/interactivity'; +import { store, getContext, getElement } from '@wordpress/interactivity'; import EmblaCarousel, { type EmblaCarouselType } from 'embla-carousel'; @@ -25,7 +21,7 @@ const EMBLA_KEY = Symbol.for( 'core-carousel.carousel' ); // Type for viewport element with Embla instance attached type EmblaViewportElement = HTMLElement & { - [ EMBLA_KEY ]?: EmblaCarouselType; + [EMBLA_KEY]?: EmblaCarouselType; }; import type { CarouselContext } from '../types'; @@ -41,23 +37,25 @@ const storeConfig = storeCall ? storeCall[ 1 ] : null; /** * Helper to set Embla instance on a viewport element. - * @param viewport The viewport element to attach the Embla instance to. - * @param embla The Embla instance to attach. + * + * @param {HTMLElement} viewport The viewport element to attach the Embla instance to. + * @param {Partial} embla The Embla instance to attach. */ const setEmblaOnViewport = ( viewport: HTMLElement, - embla: Partial< EmblaCarouselType >, + embla: Partial, ) => { - ( viewport as EmblaViewportElement )[ EMBLA_KEY ] = - embla as EmblaCarouselType; + ( viewport as EmblaViewportElement )[ EMBLA_KEY ] = embla as EmblaCarouselType; }; /** * Helper to create mock carousel context with customizable properties. - * @param overrides Partial properties to override in the default context. + * + * @param {Partial} overrides Partial properties to override in the default context. + * @return {CarouselContext} The mock carousel context. */ const createMockContext = ( - overrides: Partial< CarouselContext > = {}, + overrides: Partial = {}, ): CarouselContext => ( { options: { loop: true }, autoplay: false, @@ -73,6 +71,8 @@ const createMockContext = ( /** * Helper to create a mock DOM element structure for carousel. + * + * @return {Object} The mock DOM elements. */ const createMockCarouselDOM = () => { const viewport = document.createElement( 'div' ); @@ -90,7 +90,9 @@ const createMockCarouselDOM = () => { /** * Helper to create mock Embla instance with all required methods. - * @param overrides Partial methods to override in the default mock instance. + * + * @param {Object} overrides Partial methods to override in the default mock instance. + * @return {Object} The mock Embla instance. */ const createMockEmblaInstance = ( overrides = {} ) => ( { scrollPrev: jest.fn(), @@ -227,9 +229,7 @@ describe( 'Carousel View Module', () => { } ); it( 'should log warning when embla instance not found', () => { - const consoleSpy = jest - .spyOn( console, 'warn' ) - .mockImplementation(); + const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation(); const button = document.createElement( 'button' ); ( getElement as jest.Mock ).mockReturnValue( { ref: button } ); @@ -244,9 +244,7 @@ describe( 'Carousel View Module', () => { } ); it( 'should handle null element gracefully', () => { - const consoleSpy = jest - .spyOn( console, 'warn' ) - .mockImplementation(); + const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation(); ( getElement as jest.Mock ).mockReturnValue( null ); expect( () => storeConfig.actions.scrollPrev() ).not.toThrow(); @@ -279,9 +277,7 @@ describe( 'Carousel View Module', () => { } ); it( 'should log warning when embla instance not found', () => { - const consoleSpy = jest - .spyOn( console, 'warn' ) - .mockImplementation(); + const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation(); const button = document.createElement( 'button' ); ( getElement as jest.Mock ).mockReturnValue( { ref: button } ); @@ -309,8 +305,9 @@ describe( 'Carousel View Module', () => { setEmblaOnViewport( viewport, mockEmbla ); const mockContext = createMockContext(); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 2 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 2, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); ( getElement as jest.Mock ).mockReturnValue( { ref: button } ); @@ -338,8 +335,9 @@ describe( 'Carousel View Module', () => { setEmblaOnViewport( viewport, mockEmbla ); const mockContext = createMockContext(); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 0 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 0, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); ( getElement as jest.Mock ).mockReturnValue( { ref: button } ); @@ -362,9 +360,7 @@ describe( 'Carousel View Module', () => { describe( 'isSlideActive', () => { it( 'should be defined as a function', () => { expect( storeConfig?.callbacks?.isSlideActive ).toBeDefined(); - expect( typeof storeConfig?.callbacks?.isSlideActive ).toBe( - 'function', - ); + expect( typeof storeConfig?.callbacks?.isSlideActive ).toBe( 'function' ); } ); it( 'should return false when element is null', () => { @@ -446,8 +442,9 @@ describe( 'Carousel View Module', () => { it( 'should return true when snap.index matches selectedIndex', () => { const mockContext = createMockContext( { selectedIndex: 2 } ); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 2 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 2, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); @@ -458,8 +455,9 @@ describe( 'Carousel View Module', () => { it( 'should return false when snap.index does not match selectedIndex', () => { const mockContext = createMockContext( { selectedIndex: 0 } ); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 2 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 2, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); @@ -479,8 +477,9 @@ describe( 'Carousel View Module', () => { const mockContext = createMockContext( { ariaLabelPattern: 'Go to slide %d', } ); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 2 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 2, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); @@ -493,8 +492,9 @@ describe( 'Carousel View Module', () => { const mockContext = createMockContext( { ariaLabelPattern: 'Slide %d of 5', } ); - ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = - { index: 0 }; + ( mockContext as CarouselContext & { snap?: { index: number } } ).snap = { + index: 0, + }; ( getContext as jest.Mock ).mockReturnValue( mockContext ); @@ -519,15 +519,11 @@ describe( 'Carousel View Module', () => { describe( 'initCarousel', () => { it( 'should be defined as a function', () => { expect( storeConfig?.callbacks?.initCarousel ).toBeDefined(); - expect( typeof storeConfig?.callbacks?.initCarousel ).toBe( - 'function', - ); + expect( typeof storeConfig?.callbacks?.initCarousel ).toBe( 'function' ); } ); it( 'should return early and log warning for invalid element', () => { - const consoleSpy = jest - .spyOn( console, 'warn' ) - .mockImplementation(); + const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation(); const mockContext = createMockContext(); ( getContext as jest.Mock ).mockReturnValue( mockContext ); @@ -545,9 +541,7 @@ describe( 'Carousel View Module', () => { } ); it( 'should log warning when viewport not found', () => { - const consoleSpy = jest - .spyOn( console, 'warn' ) - .mockImplementation(); + const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation(); const mockContext = createMockContext(); const element = document.createElement( 'div' ); @@ -596,8 +590,7 @@ describe( 'Carousel View Module', () => { describe( 'Embla Carousel Integration', () => { // Type-safe helper to get mocked Embla instance - const getMockedEmblaCarousel = () => - EmblaCarousel as unknown as jest.Mock; + const getMockedEmblaCarousel = () => EmblaCarousel as unknown as jest.Mock; it( 'should have EmblaCarousel mocked', () => { expect( EmblaCarousel ).toBeDefined();