react-native-ui-lib
Version:
<p align="center"> <img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/> </p> <p align="center">UI Toolset & Components Library for React Native</p> <p a
30 lines (27 loc) • 841 B
JavaScript
import TabBar from '../index';
describe.skip('TabBar', () => {
describe('calcIndicatorWidth', () => {
it('should equale 25%', () => {
const uut = new TabBar({});
uut.itemsWidths = [80, 80, 80, 80];
uut.state = {
selectedIndex: 1
};
uut.childrenCount = 4; // This fails because we change childrenCount into a getter
uut.contentWidth = 320;
jest.spyOn(uut, 'calcIndicatorWidth');
expect(uut.calcIndicatorWidth()).toEqual('25%');
});
it('should equale 50%', () => {
const uut = new TabBar({});
uut.itemsWidths = [150, 150, 300];
uut.state = {
selectedIndex: 2
};
uut.childrenCount = 2;
uut.contentWidth = 600;
jest.spyOn(uut, 'calcIndicatorWidth');
expect(uut.calcIndicatorWidth()).toEqual('50%');
});
});
});