@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
109 lines (94 loc) • 2.96 kB
text/typescript
import { getMoveUpValue } from "../utils";
describe("getMoveUpValue", () => {
it("returns correct value when additionalData.saveArea is true and isAudioItem is false", () => {
const result = getMoveUpValue({
additionalData: { saveArea: true },
insets: { top: 20 },
isAudioItem: false,
progressBarHeight: 10,
isTablet: false,
isTabletLandscape: false,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 100,
});
expect(result).toBe(-20 + 10);
});
it("returns correct value when additionalData.saveArea is true and isAudioItem is true", () => {
const result = getMoveUpValue({
additionalData: { saveArea: true },
insets: { top: 15 },
isAudioItem: true,
progressBarHeight: 5,
isTablet: false,
isTabletLandscape: false,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 100,
});
expect(result).toBe(-15 + 0);
});
it("returns correct value for audio item (tablet or not)", () => {
const result = getMoveUpValue({
additionalData: { marginTop: 30 },
insets: { top: 0 },
isAudioItem: true,
progressBarHeight: 0,
isTablet: false,
isTabletLandscape: false,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 0,
});
expect(result).toBe(-30);
});
it("returns correct value for tablet landscape with inline audio player", () => {
const result = getMoveUpValue({
additionalData: {},
insets: { top: 0 },
isAudioItem: true,
progressBarHeight: 8,
isTablet: true,
isTabletLandscape: true,
inlineAudioPlayer: true,
tabletLandscapePlayerTopPosition: 50,
});
expect(result).toBe(-0);
});
it("returns correct value for tablet landscape without audio item", () => {
const result = getMoveUpValue({
additionalData: {},
insets: { top: 0 },
isAudioItem: false,
progressBarHeight: 12,
isTablet: true,
isTabletLandscape: true,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 60,
});
expect(result).toBe(-60 + 12);
});
it("returns -130 for tablet portrait (not landscape)", () => {
const result = getMoveUpValue({
additionalData: {},
insets: { top: 0 },
isAudioItem: false,
progressBarHeight: 0,
isTablet: true,
isTabletLandscape: false,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 0,
});
expect(result).toBe(-130);
});
it("returns -50 + progressBarHeight for mobile audio player in docked mode", () => {
const result = getMoveUpValue({
additionalData: {},
insets: { top: 0 },
isAudioItem: false,
progressBarHeight: 7,
isTablet: false,
isTabletLandscape: false,
inlineAudioPlayer: false,
tabletLandscapePlayerTopPosition: 0,
});
expect(result).toBe(-50 + 7);
});
});