@arnonsang/react-loading
Version:
A highly customizable React loading component library with 17 beautiful animations, and flexible children API
92 lines (91 loc) • 2.91 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
describe('TypeScript Type Exports', function () {
it('exports LoadingVariant type correctly', function () {
var variants = [
'spinner',
'dots',
'pulse',
'skeleton',
'bars',
'bubbles',
'cylon',
'spinningBubbles',
'ripple',
'wave',
'orbit',
'bounce',
'snake',
'grid',
'heart',
'spiral',
'blank'
];
expect(variants).toHaveLength(17);
expect(variants).toContain('spinner');
expect(variants).toContain('blank');
});
it('exports LoadingSize type correctly', function () {
var sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
expect(sizes).toHaveLength(6);
expect(sizes).toContain('xs');
expect(sizes).toContain('sm');
expect(sizes).toContain('md');
expect(sizes).toContain('lg');
expect(sizes).toContain('xl');
expect(sizes).toContain('2xl');
});
it('exports LoadingThemeColor type correctly', function () {
var themeColors = [
'red',
'blue',
'green',
'yellow',
'purple',
'pink',
'gray'
];
expect(themeColors).toHaveLength(7);
expect(themeColors).toContain('red');
expect(themeColors).toContain('blue');
expect(themeColors).toContain('gray');
});
it('exports LoadingProps interface correctly', function () {
var props = {
variant: 'spinner',
size: 'md',
themeColor: 'blue',
color: '#ff0000',
width: 100,
height: 50,
delay: 300,
text: 'Loading...',
fullPage: false,
hideText: false,
className: 'custom-class'
};
expect(props.variant).toBe('spinner');
expect(props.size).toBe('md');
expect(props.themeColor).toBe('blue');
expect(props.color).toBe('#ff0000');
expect(props.width).toBe(100);
expect(props.height).toBe(50);
expect(props.delay).toBe(300);
expect(props.text).toBe('Loading...');
expect(props.fullPage).toBe(false);
expect(props.hideText).toBe(false);
expect(props.className).toBe('custom-class');
});
it('allows optional props', function () {
var minimalProps = {};
expect(minimalProps).toBeDefined();
});
it('allows string dimensions', function () {
var propsWithStringDimensions = {
width: '200px',
height: '100px'
};
expect(propsWithStringDimensions.width).toBe('200px');
expect(propsWithStringDimensions.height).toBe('100px');
});
});