react-native-reanimated-carousel
Version:
Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.
2 lines • 2.38 kB
JavaScript
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _reactNative=require("@testing-library/react-native");var _react=_interopRequireDefault(require("react"));var _reactNative2=require("react-native");var _LazyView=require("./LazyView");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/LazyView.test.tsx";describe("LazyView",function(){it("should render children when shouldUpdate is true",function(){var _render=(0,_reactNative.render)((0,_jsxRuntime.jsx)(_LazyView.LazyView,{shouldUpdate:true,children:(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"Test Child"})})),getByText=_render.getByText;expect(getByText("Test Child")).toBeTruthy();});it("should not render children when shouldUpdate is false",function(){var _render2=(0,_reactNative.render)((0,_jsxRuntime.jsx)(_LazyView.LazyView,{shouldUpdate:false,children:(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"Test Child"})})),queryByText=_render2.queryByText;expect(queryByText("Test Child")).toBeNull();});it("should render empty fragment when shouldUpdate is false",function(){var _render3=(0,_reactNative.render)((0,_jsxRuntime.jsx)(_LazyView.LazyView,{shouldUpdate:false,children:(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"Test Child"})})),container=_render3.container;expect(container.children.length).toBe(0);});it("should handle multiple children when shouldUpdate is true",function(){var _render4=(0,_reactNative.render)((0,_jsxRuntime.jsxs)(_LazyView.LazyView,{shouldUpdate:true,children:[(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"First Child"}),(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"Second Child"})]})),getByText=_render4.getByText;expect(getByText("First Child")).toBeTruthy();expect(getByText("Second Child")).toBeTruthy();});it("should not render multiple children when shouldUpdate is false",function(){var _render5=(0,_reactNative.render)((0,_jsxRuntime.jsxs)(_LazyView.LazyView,{shouldUpdate:false,children:[(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"First Child"}),(0,_jsxRuntime.jsx)(_reactNative2.Text,{children:"Second Child"})]})),queryByText=_render5.queryByText;expect(queryByText("First Child")).toBeNull();expect(queryByText("Second Child")).toBeNull();});});
//# sourceMappingURL=LazyView.test.js.map