@umituz/react-native-splash 1.7.1 → 1.9.0

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.
Files changed (35) hide show
  1. package/package.json +11 -36
  2. package/src/presentation/components/SplashErrorBoundary.tsx +13 -18
  3. package/src/presentation/components/SplashLoading.tsx +0 -8
  4. package/src/presentation/components/SplashLogo.tsx +0 -10
  5. package/src/presentation/components/SplashScreen.tsx +1 -1
  6. package/src/presentation/components/SplashTypography.tsx +0 -6
  7. package/src/presentation/hooks/useSplash.ts +1 -1
  8. package/lib/__tests__/mocks/expoLinearGradient.js +0 -7
  9. package/lib/__tests__/mocks/reactNative.js +0 -16
  10. package/lib/__tests__/setup.ts +0 -57
  11. package/lib/__tests__/utils/testUtils.tsx +0 -86
  12. package/lib/domain/entities/SplashOptions.ts +0 -74
  13. package/lib/index.ts +0 -31
  14. package/lib/presentation/components/SplashDecorations.tsx +0 -56
  15. package/lib/presentation/components/SplashErrorBoundary.tsx +0 -63
  16. package/lib/presentation/components/SplashLoading.tsx +0 -74
  17. package/lib/presentation/components/SplashLogo.tsx +0 -80
  18. package/lib/presentation/components/SplashScreen.tsx +0 -175
  19. package/lib/presentation/components/SplashTypography.tsx +0 -72
  20. package/lib/presentation/hooks/useSplash.ts +0 -70
  21. package/lib/presentation/utils/splashGradient.utils.ts +0 -47
  22. package/lib/types/expo-linear-gradient.d.ts +0 -12
  23. package/src/__tests__/SplashScreen.test.tsx +0 -161
  24. package/src/__tests__/accessibility/Accessibility.test.tsx +0 -264
  25. package/src/__tests__/basic/Basic.test.tsx +0 -106
  26. package/src/__tests__/basic/Simple.test.tsx +0 -32
  27. package/src/__tests__/edge-cases/EdgeCases.test.tsx +0 -446
  28. package/src/__tests__/integration/SplashScreen.integration.test.tsx +0 -200
  29. package/src/__tests__/mocks/expoLinearGradient.js +0 -7
  30. package/src/__tests__/mocks/reactNative.js +0 -16
  31. package/src/__tests__/performance/Performance.test.tsx +0 -297
  32. package/src/__tests__/setup.ts +0 -57
  33. package/src/__tests__/useSplash.test.tsx +0 -123
  34. package/src/__tests__/utils/testUtils.tsx +0 -86
  35. package/src/__tests__/visual/VisualRegression.test.tsx +0 -338
@@ -1,338 +0,0 @@
1
- /**
2
- * Visual Regression Tests - UI Consistency
3
- */
4
-
5
- import React from 'react';
6
- import { render } from '../utils/testUtils';
7
- import { SplashScreen } from '../../presentation/components/SplashScreen';
8
-
9
- describe('Visual Regression Tests', () => {
10
- const baseProps = {
11
- appName: 'Visual Test App',
12
- tagline: 'Testing visual consistency',
13
- visible: true,
14
- };
15
-
16
- describe('Basic Layout Consistency', () => {
17
- it('maintains consistent layout structure', () => {
18
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
19
-
20
- const splashContainer = getByTestId('splash-screen');
21
- expect(splashContainer).toBeTruthy();
22
-
23
- // Check for consistent structure
24
- expect(splashContainer.children).toBeDefined();
25
- });
26
-
27
- it('renders logo consistently', () => {
28
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
29
-
30
- const logoElement = getByTestId('splash-logo');
31
- expect(logoElement).toBeTruthy();
32
- });
33
-
34
- it('renders typography consistently', () => {
35
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
36
-
37
- const typographyElement = getByTestId('splash-typography');
38
- expect(typographyElement).toBeTruthy();
39
- });
40
-
41
- it('renders loading indicator consistently', () => {
42
- const props = { ...baseProps, showLoading: true };
43
- const { getByTestId } = render(<SplashScreen {...props} />);
44
-
45
- const loadingElement = getByTestId('splash-loading');
46
- expect(loadingElement).toBeTruthy();
47
- });
48
- });
49
-
50
- describe('Color Consistency', () => {
51
- it('applies text color consistently', () => {
52
- const props = {
53
- ...baseProps,
54
- textColor: '#FF0000',
55
- };
56
-
57
- const { getByText } = render(<SplashScreen {...props} />);
58
-
59
- const appNameElement = getByText('Visual Test App');
60
- expect(appNameElement.props.style).toContainEqual({
61
- color: '#FF0000',
62
- });
63
- });
64
-
65
- it('applies icon color consistently', () => {
66
- const props = {
67
- ...baseProps,
68
- iconColor: '#00FF00',
69
- };
70
-
71
- const { getByTestId } = render(<SplashScreen {...props} />);
72
-
73
- const iconElement = getByTestId('splash-icon');
74
- expect(iconElement.props.customColor).toBe('#00FF00');
75
- });
76
-
77
- it('applies decoration color consistently', () => {
78
- const props = {
79
- ...baseProps,
80
- decorationColor: 'rgba(255, 0, 0, 0.1)',
81
- };
82
-
83
- const { getByTestId } = render(<SplashScreen {...props} />);
84
-
85
- const decorationElement = getByTestId('splash-decorations');
86
- expect(decorationElement).toBeTruthy();
87
- });
88
-
89
- it('handles gradient colors consistently', () => {
90
- const props = {
91
- ...baseProps,
92
- gradientColors: ['#FF0000', '#00FF00', '#0000FF'],
93
- };
94
-
95
- const { getByTestId } = render(<SplashScreen {...props} />);
96
-
97
- const gradientElement = getByTestId('linear-gradient');
98
- expect(gradientElement.props.colors).toEqual([
99
- '#FF0000',
100
- '#00FF00',
101
- '#0000FF',
102
- ]);
103
- });
104
- });
105
-
106
- describe('Typography Consistency', () => {
107
- it('maintains consistent font sizes', () => {
108
- const { getByText } = render(<SplashScreen {...baseProps} />);
109
-
110
- const appNameElement = getByText('Visual Test App');
111
- expect(appNameElement.props.style).toContainEqual({
112
- fontSize: 48,
113
- });
114
- });
115
-
116
- it('maintains consistent font weights', () => {
117
- const { getByText } = render(<SplashScreen {...baseProps} />);
118
-
119
- const appNameElement = getByText('Visual Test App');
120
- expect(appNameElement.props.style).toContainEqual({
121
- fontWeight: '800',
122
- });
123
- });
124
-
125
- it('maintains consistent text alignment', () => {
126
- const { getByText } = render(<SplashScreen {...baseProps} />);
127
-
128
- const appNameElement = getByText('Visual Test App');
129
- expect(appNameElement.props.style).toContainEqual({
130
- textAlign: 'center',
131
- });
132
- });
133
-
134
- it('handles long text consistently', () => {
135
- const longAppName = 'Very Long Application Name That Might Wrap';
136
- const props = {
137
- ...baseProps,
138
- appName: longAppName,
139
- };
140
-
141
- const { getByText } = render(<SplashScreen {...props} />);
142
-
143
- const appNameElement = getByText(longAppName);
144
- expect(appNameElement.props.numberOfLines).toBe(1);
145
- });
146
- });
147
-
148
- describe('Spacing Consistency', () => {
149
- it('maintains consistent padding', () => {
150
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
151
-
152
- const contentElement = getByTestId('splash-content');
153
- expect(contentElement.props.style).toContainEqual({
154
- paddingHorizontal: 24, // xl spacing
155
- });
156
- });
157
-
158
- it('maintains consistent margins', () => {
159
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
160
-
161
- const typographyElement = getByTestId('splash-typography');
162
- expect(typographyElement.props.style).toContainEqual({
163
- marginTop: 24, // xl spacing
164
- });
165
- });
166
- });
167
-
168
- describe('Responsive Consistency', () => {
169
- it('maintains consistency across different safe areas', () => {
170
- // Mock different safe area insets
171
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
172
-
173
- const splashContainer = getByTestId('splash-screen');
174
- expect(splashContainer).toBeTruthy();
175
- });
176
-
177
- it('handles different screen sizes consistently', () => {
178
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
179
-
180
- const splashContainer = getByTestId('splash-screen');
181
- expect(splashContainer.props.style).toContainEqual({
182
- flex: 1,
183
- });
184
- });
185
- });
186
-
187
- describe('State Consistency', () => {
188
- it('maintains visual consistency when hidden', () => {
189
- const props = { ...baseProps, visible: false };
190
- const { queryByText } = render(<SplashScreen {...props} />);
191
-
192
- expect(queryByText('Visual Test App')).toBeFalsy();
193
- });
194
-
195
- it('maintains visual consistency when shown', () => {
196
- const props = { ...baseProps, visible: true };
197
- const { getByText } = render(<SplashScreen {...props} />);
198
-
199
- expect(getByText('Visual Test App')).toBeTruthy();
200
- });
201
-
202
- it('maintains consistency during loading state', () => {
203
- const props = {
204
- ...baseProps,
205
- showLoading: true,
206
- loadingText: 'Custom loading text',
207
- };
208
-
209
- const { getByText } = render(<SplashScreen {...props} />);
210
-
211
- expect(getByText('Custom loading text')).toBeTruthy();
212
- });
213
- });
214
-
215
- describe('Custom Render Consistency', () => {
216
- it('maintains consistency with custom logo', () => {
217
- const CustomLogo = () => <div testID="custom-logo">Custom Logo</div>;
218
- const props = {
219
- ...baseProps,
220
- renderLogo: () => <CustomLogo />,
221
- };
222
-
223
- const { getByTestId } = render(<SplashScreen {...props} />);
224
-
225
- expect(getByTestId('custom-logo')).toBeTruthy();
226
- });
227
-
228
- it('maintains consistency with custom content', () => {
229
- const CustomContent = () => <div testID="custom-content">Custom Content</div>;
230
- const props = {
231
- ...baseProps,
232
- renderContent: () => <CustomContent />,
233
- };
234
-
235
- const { getByTestId } = render(<SplashScreen {...props} />);
236
-
237
- expect(getByTestId('custom-content')).toBeTruthy();
238
- });
239
-
240
- it('maintains consistency with custom footer', () => {
241
- const CustomFooter = () => <div testID="custom-footer">Custom Footer</div>;
242
- const props = {
243
- ...baseProps,
244
- renderFooter: () => <CustomFooter />,
245
- };
246
-
247
- const { getByTestId } = render(<SplashScreen {...props} />);
248
-
249
- expect(getByTestId('custom-footer')).toBeTruthy();
250
- });
251
- });
252
-
253
- describe('Animation Consistency', () => {
254
- it('maintains consistent animation states', () => {
255
- const { getByTestId } = render(<SplashScreen {...baseProps} />);
256
-
257
- const splashContainer = getByTestId('splash-screen');
258
- expect(splashContainer).toBeTruthy();
259
- });
260
- });
261
-
262
- describe('Theme Consistency', () => {
263
- it('maintains consistency with light theme', () => {
264
- const props = {
265
- ...baseProps,
266
- textColor: '#000000',
267
- backgroundColor: '#FFFFFF',
268
- };
269
-
270
- const { getByText } = render(<SplashScreen {...props} />);
271
-
272
- const appNameElement = getByText('Visual Test App');
273
- expect(appNameElement.props.style).toContainEqual({
274
- color: '#000000',
275
- });
276
- });
277
-
278
- it('maintains consistency with dark theme', () => {
279
- const props = {
280
- ...baseProps,
281
- textColor: '#FFFFFF',
282
- backgroundColor: '#000000',
283
- };
284
-
285
- const { getByText } = render(<SplashScreen {...props} />);
286
-
287
- const appNameElement = getByText('Visual Test App');
288
- expect(appNameElement.props.style).toContainEqual({
289
- color: '#FFFFFF',
290
- });
291
- });
292
- });
293
-
294
- describe('Error State Consistency', () => {
295
- it('maintains consistent error display', () => {
296
- const ErrorComponent = () => {
297
- throw new Error('Test error');
298
- };
299
-
300
- const props = {
301
- ...baseProps,
302
- renderLogo: () => <ErrorComponent />,
303
- };
304
-
305
- const { getByText } = render(<SplashScreen {...props} />);
306
-
307
- expect(getByText('Something went wrong')).toBeTruthy();
308
- });
309
- });
310
-
311
- describe('Performance Consistency', () => {
312
- it('maintains consistent render performance', async () => {
313
- const { measureRenderTime } = require('../utils/testUtils');
314
-
315
- const renderTime = await measureRenderTime(<SplashScreen {...baseProps} />);
316
-
317
- // Should maintain consistent performance
318
- expect(renderTime).toBeLessThan(100); // 100ms
319
- });
320
-
321
- it('maintains consistency with complex props', async () => {
322
- const { measureRenderTime } = require('../utils/testUtils');
323
-
324
- const complexProps = {
325
- ...baseProps,
326
- gradientColors: ['#FF0000', '#00FF00', '#0000FF'],
327
- textColor: '#FFFFFF',
328
- iconColor: '#FFFF00',
329
- decorationColor: 'rgba(255, 255, 255, 0.1)',
330
- };
331
-
332
- const renderTime = await measureRenderTime(<SplashScreen {...complexProps} />);
333
-
334
- // Should maintain performance even with complex props
335
- expect(renderTime).toBeLessThan(150); // 150ms
336
- });
337
- });
338
- });