react-native-twopane-navigation
Version:
React Native package for dual screen devices navigation support (Surface Duo)
2 lines • 3.6 kB
JavaScript
var _appStore=require("../../../appStore");var _utilityStore=require("../utilityStore.actions");var _reactNativeDualscreeninfo=require("react-native-dualscreeninfo");describe('utilityStore reducer tests',function(){afterEach(function(){_appStore.store.dispatch((0,_appStore.resetApp)());});it('is twoPane',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:true,config:{}};_appStore.store.dispatch((0,_utilityStore.isTwoPaneAction)(true));var data=_appStore.store.getState().utilityStoreReducer;expect(data).toStrictEqual(expectedState);});it('is twoPane false',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{}};_appStore.store.dispatch((0,_utilityStore.isTwoPaneAction)(false));var data=_appStore.store.getState().utilityStoreReducer;expect(data).toStrictEqual(expectedState);});it('pushPaneRectsActions match',function(){var expectedState={paneRects:[{width:100,height:100,x:100,y:100}],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{}};_appStore.store.dispatch((0,_utilityStore.pushPaneRectsActions)([{width:100,height:100,x:100,y:100}]));var data=_appStore.store.getState().utilityStoreReducer;expect(data).toStrictEqual(expectedState);});it('pushPaneRectsActions notMatch',function(){var expectedState={paneRects:[{width:0,height:0,x:0,y:0}],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{}};_appStore.store.dispatch((0,_utilityStore.pushPaneRectsActions)([{width:100,height:100,x:100,y:100}]));var data=_appStore.store.getState().utilityStoreReducer;expect(data).not.toStrictEqual(expectedState);});it('config match',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{onePane:{paneHeader:{backgroundColor:'red'}},twoPane:{paneHeader:{backgroundColor:'blue'}}}};_appStore.store.dispatch((0,_utilityStore.pushConfigAction)({onePane:{paneHeader:{backgroundColor:'red'}},twoPane:{paneHeader:{backgroundColor:'blue'}}}));var data=_appStore.store.getState().utilityStoreReducer;expect(data).toStrictEqual(expectedState);});it('config notMatch',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{onePane:{paneHeader:{backgroundColor:'red'}},twoPane:{paneHeader:{backgroundColor:'blue'}}}};_appStore.store.dispatch((0,_utilityStore.pushConfigAction)({onePane:{paneHeader:{backgroundColor:'blue'}},twoPane:{paneHeader:{backgroundColor:'red'}}}));var data=_appStore.store.getState().utilityStoreReducer;expect(data).not.toStrictEqual(expectedState);});it('orientation Match',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.LandscapeFlipped,isTwoPane:false,config:{}};_appStore.store.dispatch((0,_utilityStore.pushOrientationActions)(_reactNativeDualscreeninfo.DeviceOrientation.LandscapeFlipped));var data=_appStore.store.getState().utilityStoreReducer;expect(data).toStrictEqual(expectedState);});it('orientation notMatch',function(){var expectedState={paneRects:[],orientation:_reactNativeDualscreeninfo.DeviceOrientation.Portrait,isTwoPane:false,config:{}};_appStore.store.dispatch((0,_utilityStore.pushOrientationActions)(_reactNativeDualscreeninfo.DeviceOrientation.LandscapeFlipped));var data=_appStore.store.getState().utilityStoreReducer;expect(data).not.toStrictEqual(expectedState);});});
//# sourceMappingURL=UtilityStore.test.js.map