@momo-kits/foundation 0.169.18-beta.2 → 0.170.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,142 +0,0 @@
1
- import {
2
- getFooterGeometry,
3
- getFooterRowWidth,
4
- getFooterSeparator,
5
- getFooterStyle,
6
- } from '../screenFooter';
7
-
8
- // the grid row pulls in every foundation component; geometry does not render
9
- jest.mock('../Section', () => ({ __esModule: true, default: () => null }));
10
-
11
- const NO_INSETS = { insetLeft: 0, insetRight: 0 };
12
- const PHONE = { width: 390, height: 844, contentWidth: 390, ...NO_INSETS };
13
- const FOLD_PORTRAIT = {
14
- width: 760,
15
- height: 900,
16
- contentWidth: 760,
17
- ...NO_INSETS,
18
- };
19
- const FOLD_LANDSCAPE = {
20
- width: 860,
21
- height: 700,
22
- contentWidth: 860,
23
- ...NO_INSETS,
24
- };
25
- const TABLET = { width: 1194, height: 834, contentWidth: 1194, ...NO_INSETS };
26
- // iPhone Duo inner landscape: side column on the left, home indicator inset on the right
27
- const DUO_INNER = {
28
- width: 900,
29
- height: 669,
30
- contentWidth: 782,
31
- insetLeft: 84,
32
- insetRight: 34,
33
- };
34
- const ANCHORED = {
35
- footerStyle: 'anchored' as const,
36
- hasImageBackground: false,
37
- };
38
- const SHEET = { footerStyle: 'sheet' as const, hasImageBackground: false };
39
-
40
- describe('getFooterGeometry', () => {
41
- it('keeps the phone footer below 600pt, landscape included', () => {
42
- expect(getFooterGeometry({ ...PHONE, ...SHEET }).kind).toBe('phone');
43
- const landscape = {
44
- ...NO_INSETS,
45
- width: 844,
46
- height: 390,
47
- contentWidth: 844,
48
- };
49
- expect(getFooterGeometry({ ...landscape, ...SHEET }).kind).toBe('phone');
50
- });
51
-
52
- it('caps the width at 600pt below an 800pt window, 800pt from it', () => {
53
- expect(getFooterGeometry({ ...FOLD_PORTRAIT, ...ANCHORED })).toMatchObject({
54
- kind: 'anchored',
55
- width: 600,
56
- });
57
- expect(getFooterGeometry({ ...FOLD_LANDSCAPE, ...SHEET })).toMatchObject({
58
- kind: 'sheet',
59
- width: 800,
60
- });
61
- expect(getFooterGeometry({ ...TABLET, ...SHEET }).width).toBe(800);
62
- });
63
-
64
- it('keeps the width inside the content area minus its margins', () => {
65
- const duoPortrait = {
66
- ...NO_INSETS,
67
- width: 669,
68
- height: 900,
69
- contentWidth: 585,
70
- };
71
- expect(getFooterGeometry({ ...duoPortrait, ...ANCHORED }).width).toBe(561);
72
- });
73
-
74
- it('drops the sheet for an image background', () => {
75
- const input = { ...FOLD_LANDSCAPE, ...SHEET, hasImageBackground: true };
76
- expect(getFooterGeometry(input).kind).toBe('anchored');
77
- });
78
-
79
- it('keeps the phone bar clear of the iPhone Duo side column', () => {
80
- const duoOuter = { width: 390, height: 844, contentWidth: 306 };
81
- const input = { ...duoOuter, insetLeft: 84, insetRight: 0, ...ANCHORED };
82
- expect(getFooterGeometry(input)).toMatchObject({
83
- barMargin: { left: 84, right: 0 },
84
- });
85
- });
86
-
87
- it('spans the anchored bar and centers its content on the window', () => {
88
- expect(getFooterGeometry({ ...DUO_INNER, ...ANCHORED })).toEqual({
89
- kind: 'anchored',
90
- width: 758,
91
- barMargin: { left: 0, right: 0 },
92
- });
93
- });
94
-
95
- it('centers the sheet on the window, its width kept from the content area', () => {
96
- expect(getFooterGeometry({ ...DUO_INNER, ...SHEET })).toEqual({
97
- kind: 'sheet',
98
- width: 758,
99
- barMargin: { left: 0, right: 0 },
100
- });
101
- });
102
- });
103
-
104
- describe('getFooterRowWidth', () => {
105
- it('keeps the 12pt margins inside the foldable content area', () => {
106
- const portrait = getFooterGeometry({ ...FOLD_PORTRAIT, ...ANCHORED });
107
- const landscape = getFooterGeometry({ ...FOLD_LANDSCAPE, ...ANCHORED });
108
- expect(getFooterRowWidth(portrait, true)).toBe(576);
109
- expect(getFooterRowWidth(landscape, true)).toBe(776);
110
- });
111
-
112
- it('fills the area without margins and leaves the phone row uncapped', () => {
113
- const landscape = getFooterGeometry({ ...FOLD_LANDSCAPE, ...ANCHORED });
114
- expect(getFooterRowWidth(landscape, false)).toBe(800);
115
- const phone = getFooterGeometry({ ...PHONE, ...ANCHORED });
116
- expect(getFooterRowWidth(phone, true)).toBeUndefined();
117
- });
118
- });
119
-
120
- describe('getFooterStyle', () => {
121
- it('lets the screen prop win over the host config', () => {
122
- expect(getFooterStyle('anchored', 'sheet')).toBe('anchored');
123
- expect(getFooterStyle(undefined, 'sheet')).toBe('sheet');
124
- });
125
-
126
- it('falls back to anchored for a missing or unknown value', () => {
127
- expect(getFooterStyle()).toBe('anchored');
128
- expect(getFooterStyle(undefined, 'floating')).toBe('anchored');
129
- });
130
- });
131
-
132
- describe('getFooterSeparator', () => {
133
- it('lets the screen prop win over the host config', () => {
134
- expect(getFooterSeparator('border', 'shadow')).toBe('border');
135
- expect(getFooterSeparator(undefined, 'shadow')).toBe('shadow');
136
- });
137
-
138
- it('falls back to border for a missing or unknown value', () => {
139
- expect(getFooterSeparator()).toBe('border');
140
- expect(getFooterSeparator(undefined, 'line')).toBe('border');
141
- });
142
- });