@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
54 lines (44 loc) • 1.48 kB
text/typescript
import { ORIENTATIONS } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
import { orientationWasChangedFromLandscapeToPortrait } from "..";
describe("orientationWasChangedFromLandscapeToPortrait", () => {
it("return true for from=landscape and to=portrait ", () => {
const fromOrientation = ORIENTATIONS.landscapeLeft;
const toOrientation = ORIENTATIONS.portrait;
expect(
orientationWasChangedFromLandscapeToPortrait({
fromOrientation,
toOrientation,
})
).toBe(true);
});
it("return false for from=portrait to=landscape ", () => {
const fromOrientation = ORIENTATIONS.portrait;
const toOrientation = ORIENTATIONS.landscapeLeft;
expect(
orientationWasChangedFromLandscapeToPortrait({
fromOrientation,
toOrientation,
})
).toBe(false);
});
it("return true for from=unknown to=portrait ", () => {
const fromOrientation = ORIENTATIONS.unknown;
const toOrientation = ORIENTATIONS.portrait;
expect(
orientationWasChangedFromLandscapeToPortrait({
fromOrientation,
toOrientation,
})
).toBe(true);
});
it("return false for from=unknown to=landscape", () => {
const fromOrientation = ORIENTATIONS.unknown;
const toOrientation = ORIENTATIONS.landscapeLeft;
expect(
orientationWasChangedFromLandscapeToPortrait({
fromOrientation,
toOrientation,
})
).toBe(false);
});
});