diff --git a/.github/workflows/betapublish.yml b/.github/workflows/betapublish.yml index 41dd19c..966870e 100644 --- a/.github/workflows/betapublish.yml +++ b/.github/workflows/betapublish.yml @@ -1,33 +1,35 @@ name: Pre-Release on: - release: - types: [prereleased] + release: + types: [prereleased] jobs: - Publish: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '12.x' - registry-url: 'https://registry.npmjs.org' - - name: Install - run: npm install - - name: Test - run: npm run test - - uses: codecov/codecov-action@v2 - with: - files: coverage/*.json - flags: unittests - name: react-carousel-codecov - fail_ci_if_error: true - verbose: true - - name: Build - run: npm run build - - name: Publish - run: npm publish --access=public --tag beta - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + Publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org' + - name: Install + run: npm install + - name: Test + run: npm run test + - uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: coverage/*.json + flags: unittests + name: react-carousel-codecov + fail_ci_if_error: true + verbose: true + - name: Build + run: npm run build + - name: Publish + run: npm publish --access=public --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/prchecks.yml b/.github/workflows/prchecks.yml index 3af8c57..99bccd3 100644 --- a/.github/workflows/prchecks.yml +++ b/.github/workflows/prchecks.yml @@ -22,7 +22,9 @@ jobs: run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose - name: Test run: npm run test - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: files: coverage/*.json flags: unittests diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c0c35aa..8298d45 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,9 @@ jobs: run: npm install - name: Test run: npm run test - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: files: coverage/*.json flags: unittests diff --git a/__tests__/arrow.spec.tsx b/__tests__/arrow.spec.tsx index a99f866..4db5593 100644 --- a/__tests__/arrow.spec.tsx +++ b/__tests__/arrow.spec.tsx @@ -12,4 +12,14 @@ describe('', () => { fireEvent.click(getByRole('button')); expect(onClick).toHaveBeenCalled(); }); + + it('should have the correct aria-label when direction is right', () => { + const { getByRole } = render(); + expect(getByRole('button')).toHaveAttribute('aria-label', 'Sağa kaydır'); + }); + + it('should have the correct aria-label when direction is left', () => { + const { getByRole } = render(); + expect(getByRole('button')).toHaveAttribute('aria-label', 'Sola kaydır'); + }); }); diff --git a/__tests__/scrollingCarousel.spec.tsx b/__tests__/scrollingCarousel.spec.tsx index 33a7f09..b341490 100644 --- a/__tests__/scrollingCarousel.spec.tsx +++ b/__tests__/scrollingCarousel.spec.tsx @@ -1,5 +1,5 @@ import React, { MouseEvent } from 'react'; -import { render, cleanup, fireEvent, wait } from '@testing-library/react'; +import { render, cleanup, fireEvent, wait, waitFor } from '@testing-library/react'; import { ScrollingCarousel } from '../src'; import { carouselItemNodes } from './__fixtures__/nodes'; import * as helpers from '../src/helpers'; @@ -102,4 +102,23 @@ describe('', () => { expect(container.querySelector('.sliding')).toBeInTheDocument(); }); }); + + it('should remove sliding class when isDown is false', async () => { + const { getByTestId } = render( + } + children={carouselItemNodes(6)} + />, + ); + + const sliderList = getByTestId('sliderList'); + fireEvent.mouseDown(sliderList, { pageX: 600 }); + fireEvent.mouseMove(sliderList, { pageX: 605 }); // Ensure some movement occurs + fireEvent.mouseUp(sliderList); + + await waitFor(() => { + expect(sliderList).not.toHaveClass('sliding'); + }); + }); }); diff --git a/src/components/arrow/index.tsx b/src/components/arrow/index.tsx index c81ee39..b9a5a84 100644 --- a/src/components/arrow/index.tsx +++ b/src/components/arrow/index.tsx @@ -3,6 +3,7 @@ import styles from '../../styles/styles.module.css'; export const Arrow: FunctionComponent = (props: ArrowProps) => ( = ( ) => { return ( slide(direction)}> - {element ?? } + {element ?? } ); };