UNPKG

react-native-ui-lib

Version:

[![Build Status](https://travis-ci.org/wix/react-native-ui-lib.svg?branch=master)](https://travis-ci.org/wix/react-native-ui-lib) [![npm](https://img.shields.io/npm/v/react-native-ui-lib.svg)](https://www.npmjs.com/package/react-native-ui-lib) [![NPM Down

28 lines (27 loc) 894 B
import TabBar from "../index"; describe("TabBar", () => { describe("calcIndicatorWidth", () => { it("should equale 25%", () => { const uut = new TabBar({}); uut.state = { widths: [80, 80, 80, 80], selectedIndex: 1 }; uut.childrenCount = 4; uut.contentWidth = 320; jest.spyOn(uut, "calcIndicatorWidth"); expect(uut.calcIndicatorWidth()).toEqual("25%"); }); it("should equale 50%", () => { const uut = new TabBar({}); uut.state = { widths: [150, 150, 300], selectedIndex: 2 }; uut.childrenCount = 2; uut.contentWidth = 600; jest.spyOn(uut, "calcIndicatorWidth"); expect(uut.calcIndicatorWidth()).toEqual("50%"); }); }); });