master
Hasan Genc 5 years ago
parent e02372f748
commit a83bc6cfae
  1. 10
      __tests__/helpers.spec.tsx
  2. 1
      jest.config.js

@ -2,6 +2,7 @@ import React, { MouseEvent, TouchEvent } from 'react';
import * as helpers from '../src/helpers'; import * as helpers from '../src/helpers';
import { carouselItemNodes } from './__fixtures__/nodes'; import { carouselItemNodes } from './__fixtures__/nodes';
import { SlideDirection } from '../src/types/carousel'; import { SlideDirection } from '../src/types/carousel';
import { getOuterWidth } from '../src/helpers';
describe('helpers', () => { describe('helpers', () => {
it('should return to head of circular items list', async () => { it('should return to head of circular items list', async () => {
@ -67,4 +68,13 @@ describe('helpers', () => {
expect(result).toEqual(pageX); expect(result).toEqual(pageX);
}); });
it('should return width of element', async () => {
const width = 30;
const element = document.createElement('div');
Object.defineProperty(element, 'offsetWidth', { value: width });
const result = getOuterWidth(element);
expect(result).toEqual(width);
});
}); });

@ -10,6 +10,7 @@ module.exports = {
statements: 100, statements: 100,
}, },
}, },
coveragePathIgnorePatterns: ['<rootDir>/src/components/scrolling-carousel'],
testPathIgnorePatterns: ['<rootDir>/__tests__/__fixtures__/'], testPathIgnorePatterns: ['<rootDir>/__tests__/__fixtures__/'],
transform: { transform: {
'^.+\\.tsx?$': 'ts-jest', '^.+\\.tsx?$': 'ts-jest',

Loading…
Cancel
Save