@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.
- package/package.json +11 -36
- package/src/presentation/components/SplashErrorBoundary.tsx +13 -18
- package/src/presentation/components/SplashLoading.tsx +0 -8
- package/src/presentation/components/SplashLogo.tsx +0 -10
- package/src/presentation/components/SplashScreen.tsx +1 -1
- package/src/presentation/components/SplashTypography.tsx +0 -6
- package/src/presentation/hooks/useSplash.ts +1 -1
- package/lib/__tests__/mocks/expoLinearGradient.js +0 -7
- package/lib/__tests__/mocks/reactNative.js +0 -16
- package/lib/__tests__/setup.ts +0 -57
- package/lib/__tests__/utils/testUtils.tsx +0 -86
- package/lib/domain/entities/SplashOptions.ts +0 -74
- package/lib/index.ts +0 -31
- package/lib/presentation/components/SplashDecorations.tsx +0 -56
- package/lib/presentation/components/SplashErrorBoundary.tsx +0 -63
- package/lib/presentation/components/SplashLoading.tsx +0 -74
- package/lib/presentation/components/SplashLogo.tsx +0 -80
- package/lib/presentation/components/SplashScreen.tsx +0 -175
- package/lib/presentation/components/SplashTypography.tsx +0 -72
- package/lib/presentation/hooks/useSplash.ts +0 -70
- package/lib/presentation/utils/splashGradient.utils.ts +0 -47
- package/lib/types/expo-linear-gradient.d.ts +0 -12
- package/src/__tests__/SplashScreen.test.tsx +0 -161
- package/src/__tests__/accessibility/Accessibility.test.tsx +0 -264
- package/src/__tests__/basic/Basic.test.tsx +0 -106
- package/src/__tests__/basic/Simple.test.tsx +0 -32
- package/src/__tests__/edge-cases/EdgeCases.test.tsx +0 -446
- package/src/__tests__/integration/SplashScreen.integration.test.tsx +0 -200
- package/src/__tests__/mocks/expoLinearGradient.js +0 -7
- package/src/__tests__/mocks/reactNative.js +0 -16
- package/src/__tests__/performance/Performance.test.tsx +0 -297
- package/src/__tests__/setup.ts +0 -57
- package/src/__tests__/useSplash.test.tsx +0 -123
- package/src/__tests__/utils/testUtils.tsx +0 -86
- package/src/__tests__/visual/VisualRegression.test.tsx +0 -338
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accessibility Tests - Screen Reader Support
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render, checkAccessibility } from '../utils/testUtils';
|
|
7
|
-
import { SplashScreen } from '../../presentation/components/SplashScreen';
|
|
8
|
-
|
|
9
|
-
describe('Accessibility Tests', () => {
|
|
10
|
-
const defaultProps = {
|
|
11
|
-
appName: 'Accessible App',
|
|
12
|
-
tagline: 'Accessible tagline',
|
|
13
|
-
visible: true,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
describe('Screen Reader Support', () => {
|
|
17
|
-
it('provides proper accessibility labels', () => {
|
|
18
|
-
const { getByRole } = render(<SplashScreen {...defaultProps} />);
|
|
19
|
-
|
|
20
|
-
// Check for main content accessibility
|
|
21
|
-
const mainContent = getByRole('main');
|
|
22
|
-
expect(mainContent).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('announces app name properly', () => {
|
|
26
|
-
const { getByText } = render(<SplashScreen {...defaultProps} />);
|
|
27
|
-
|
|
28
|
-
const appNameElement = getByText('Accessible App');
|
|
29
|
-
expect(appNameElement.props.accessible).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('handles loading announcements', () => {
|
|
33
|
-
const props = {
|
|
34
|
-
...defaultProps,
|
|
35
|
-
showLoading: true,
|
|
36
|
-
loadingText: 'Loading application...',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
40
|
-
|
|
41
|
-
const loadingElement = getByText('Loading application...');
|
|
42
|
-
expect(loadingElement.props.accessible).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('provides accessibility hints for interactive elements', () => {
|
|
46
|
-
const onReady = jest.fn();
|
|
47
|
-
const props = {
|
|
48
|
-
...defaultProps,
|
|
49
|
-
onReady,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const { getByRole } = render(<SplashScreen {...props} />);
|
|
53
|
-
|
|
54
|
-
// Check if interactive elements have proper hints
|
|
55
|
-
const interactiveElements = getByRole('button');
|
|
56
|
-
if (interactiveElements) {
|
|
57
|
-
expect(interactiveElements.props.accessibilityHint).toBeDefined();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe('Focus Management', () => {
|
|
63
|
-
it('manages focus order correctly', () => {
|
|
64
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
65
|
-
|
|
66
|
-
// Check that focusable elements are in logical order
|
|
67
|
-
const splashContainer = getByTestId('splash-screen');
|
|
68
|
-
expect(splashContainer).toBeTruthy();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('handles focus when splash becomes visible', () => {
|
|
72
|
-
const { rerender, getByTestId } = render(
|
|
73
|
-
<SplashScreen {...defaultProps} visible={false} />
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
rerender(<SplashScreen {...defaultProps} visible={true} />);
|
|
77
|
-
|
|
78
|
-
const splashContainer = getByTestId('splash-screen');
|
|
79
|
-
expect(splashContainer).toBeTruthy();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('Color Contrast', () => {
|
|
84
|
-
it('provides sufficient color contrast', () => {
|
|
85
|
-
const props = {
|
|
86
|
-
...defaultProps,
|
|
87
|
-
textColor: '#FFFFFF', // High contrast
|
|
88
|
-
backgroundColor: '#000000', // High contrast
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
92
|
-
|
|
93
|
-
const appNameElement = getByText('Accessible App');
|
|
94
|
-
expect(appNameElement).toBeTruthy();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('supports high contrast mode', () => {
|
|
98
|
-
const props = {
|
|
99
|
-
...defaultProps,
|
|
100
|
-
textColor: '#000000',
|
|
101
|
-
backgroundColor: '#FFFFFF',
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
105
|
-
|
|
106
|
-
const appNameElement = getByText('Accessible App');
|
|
107
|
-
expect(appNameElement).toBeTruthy();
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('Reduced Motion', () => {
|
|
112
|
-
it('respects prefers-reduced-motion', () => {
|
|
113
|
-
// Mock reduced motion preference
|
|
114
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
115
|
-
writable: true,
|
|
116
|
-
value: jest.fn().mockImplementation(query => ({
|
|
117
|
-
matches: query === '(prefers-reduced-motion: reduce)',
|
|
118
|
-
media: query,
|
|
119
|
-
onchange: null,
|
|
120
|
-
addListener: jest.fn(),
|
|
121
|
-
removeListener: jest.fn(),
|
|
122
|
-
addEventListener: jest.fn(),
|
|
123
|
-
removeEventListener: jest.fn(),
|
|
124
|
-
dispatchEvent: jest.fn(),
|
|
125
|
-
})),
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
129
|
-
|
|
130
|
-
const splashContainer = getByTestId('splash-screen');
|
|
131
|
-
expect(splashContainer).toBeTruthy();
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('Screen Size Adaptation', () => {
|
|
136
|
-
it('adapts to different screen sizes', () => {
|
|
137
|
-
// Mock different screen dimensions
|
|
138
|
-
const originalDimensions = require('react-native').Dimensions;
|
|
139
|
-
|
|
140
|
-
require('react-native').Dimensions = {
|
|
141
|
-
get: jest.fn(() => ({
|
|
142
|
-
width: 320,
|
|
143
|
-
height: 568,
|
|
144
|
-
})),
|
|
145
|
-
addEventListener: jest.fn(),
|
|
146
|
-
removeEventListener: jest.fn(),
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const { getByText } = render(<SplashScreen {...defaultProps} />);
|
|
150
|
-
|
|
151
|
-
const appNameElement = getByText('Accessible App');
|
|
152
|
-
expect(appNameElement).toBeTruthy();
|
|
153
|
-
|
|
154
|
-
// Restore original dimensions
|
|
155
|
-
require('react-native').Dimensions = originalDimensions;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('handles orientation changes', () => {
|
|
159
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
160
|
-
|
|
161
|
-
const splashContainer = getByTestId('splash-screen');
|
|
162
|
-
expect(splashContainer).toBeTruthy();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe('Voice Control', () => {
|
|
167
|
-
it('supports voice commands', () => {
|
|
168
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
169
|
-
|
|
170
|
-
const splashContainer = getByTestId('splash-screen');
|
|
171
|
-
expect(splashContainer).toBeTruthy();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe('Keyboard Navigation', () => {
|
|
176
|
-
it('supports keyboard navigation', () => {
|
|
177
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
178
|
-
|
|
179
|
-
const splashContainer = getByTestId('splash-screen');
|
|
180
|
-
expect(splashContainer).toBeTruthy();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('handles tab navigation properly', () => {
|
|
184
|
-
const { getByTestId } = render(<SplashScreen {...defaultProps} />);
|
|
185
|
-
|
|
186
|
-
const splashContainer = getByTestId('splash-screen');
|
|
187
|
-
expect(splashContainer).toBeTruthy();
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe('Custom Accessibility', () => {
|
|
192
|
-
it('allows custom accessibility props', () => {
|
|
193
|
-
const props = {
|
|
194
|
-
...defaultProps,
|
|
195
|
-
accessibilityLabel: 'Custom splash screen',
|
|
196
|
-
accessibilityHint: 'Application is loading',
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const { getByTestId } = render(<SplashScreen {...props} />);
|
|
200
|
-
|
|
201
|
-
const splashContainer = getByTestId('splash-screen');
|
|
202
|
-
expect(splashContainer).toBeTruthy();
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('supports custom accessibility role', () => {
|
|
206
|
-
const props = {
|
|
207
|
-
...defaultProps,
|
|
208
|
-
accessibilityRole: 'alert',
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const { getByRole } = render(<SplashScreen {...props} />);
|
|
212
|
-
|
|
213
|
-
const alertElement = getByRole('alert');
|
|
214
|
-
expect(alertElement).toBeTruthy();
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
describe('Error Accessibility', () => {
|
|
219
|
-
it('announces errors properly', () => {
|
|
220
|
-
const ErrorComponent = () => {
|
|
221
|
-
throw new Error('Test error');
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const props = {
|
|
225
|
-
...defaultProps,
|
|
226
|
-
renderLogo: () => <ErrorComponent />,
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const { getByRole } = render(<SplashScreen {...props} />);
|
|
230
|
-
|
|
231
|
-
// Error should be announced to screen readers
|
|
232
|
-
const errorMessage = getByRole('alert');
|
|
233
|
-
expect(errorMessage).toBeTruthy();
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
describe('Multi-language Support', () => {
|
|
238
|
-
it('supports right-to-left languages', () => {
|
|
239
|
-
const props = {
|
|
240
|
-
...defaultProps,
|
|
241
|
-
appName: 'تطبيق قابل للوصول', // Arabic text
|
|
242
|
-
tagline: 'علامة تجريبية',
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
246
|
-
|
|
247
|
-
const appNameElement = getByText('تطبيق قابل للوصول');
|
|
248
|
-
expect(appNameElement).toBeTruthy();
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('handles different character sets', () => {
|
|
252
|
-
const props = {
|
|
253
|
-
...defaultProps,
|
|
254
|
-
appName: 'アクセシブルアプリ', // Japanese text
|
|
255
|
-
tagline: 'テストタグライン',
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
259
|
-
|
|
260
|
-
const appNameElement = getByText('アクセシブルアプリ');
|
|
261
|
-
expect(appNameElement).toBeTruthy();
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic Component Tests
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render } from '@testing-library/react-native';
|
|
7
|
-
import { SplashScreen } from '../../presentation/components/SplashScreen';
|
|
8
|
-
|
|
9
|
-
// Mock React Native components
|
|
10
|
-
jest.mock('react-native', () => ({
|
|
11
|
-
View: ({ children, testID }) => ({ type: 'View', props: { testID }, children }),
|
|
12
|
-
Text: ({ children, testID }) => ({ type: 'Text', props: { testID }, children }),
|
|
13
|
-
StyleSheet: { create: jest.fn(() => ({})) },
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
jest.mock('expo-linear-gradient', () => ({
|
|
17
|
-
LinearGradient: ({ children, testID }) => ({ type: 'LinearGradient', props: { testID }, children }),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
jest.mock('@umituz/react-native-design-system-atoms', () => ({
|
|
21
|
-
AtomicIcon: ({ name, testID }) => ({ type: 'AtomicIcon', props: { testID: testID || `icon-${name}`, name } }),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
jest.mock('@umituz/react-native-design-system-theme', () => ({
|
|
25
|
-
useAppDesignTokens: () => ({
|
|
26
|
-
colors: { primary: '#007AFF' },
|
|
27
|
-
spacing: { xl: 24, md: 16, xxxl: 48 },
|
|
28
|
-
}),
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
jest.mock('@umituz/react-native-localization', () => ({
|
|
32
|
-
useLocalization: () => ({
|
|
33
|
-
t: (key: string, fallback: string) => fallback || key,
|
|
34
|
-
}),
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
jest.mock('react-native-safe-area-context', () => ({
|
|
38
|
-
useSafeAreaInsets: () => ({ top: 44, bottom: 34, left: 0, right: 0 }),
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
describe('SplashScreen Basic Tests', () => {
|
|
42
|
-
it('renders without crashing', () => {
|
|
43
|
-
const props = {
|
|
44
|
-
appName: 'Test App',
|
|
45
|
-
visible: true,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
expect(() => render(<SplashScreen {...props} />)).not.toThrow();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('renders app name when provided', () => {
|
|
52
|
-
const props = {
|
|
53
|
-
appName: 'Test App',
|
|
54
|
-
visible: true,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
58
|
-
expect(getByText('Test App')).toBeTruthy();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('renders tagline when provided', () => {
|
|
62
|
-
const props = {
|
|
63
|
-
appName: 'Test App',
|
|
64
|
-
tagline: 'Test Tagline',
|
|
65
|
-
visible: true,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const { getByText } = render(<SplashScreen {...props} />);
|
|
69
|
-
expect(getByText('Test Tagline')).toBeTruthy();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('does not render when visible is false', () => {
|
|
73
|
-
const props = {
|
|
74
|
-
appName: 'Test App',
|
|
75
|
-
visible: false,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const { queryByText } = render(<SplashScreen {...props} />);
|
|
79
|
-
expect(queryByText('Test App')).toBeFalsy();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders with default props', () => {
|
|
83
|
-
const { container } = render(<SplashScreen />);
|
|
84
|
-
expect(container).toBeTruthy();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('handles empty props gracefully', () => {
|
|
88
|
-
const props = {
|
|
89
|
-
appName: '',
|
|
90
|
-
tagline: '',
|
|
91
|
-
visible: true,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
expect(() => render(<SplashScreen {...props} />)).not.toThrow();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('handles null props gracefully', () => {
|
|
98
|
-
const props = {
|
|
99
|
-
appName: null,
|
|
100
|
-
tagline: null,
|
|
101
|
-
visible: true,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
expect(() => render(<SplashScreen {...props} />)).not.toThrow();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple Function Tests
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
describe('Basic Functionality Tests', () => {
|
|
6
|
-
it('should pass basic math', () => {
|
|
7
|
-
expect(2 + 2).toBe(4);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should handle string operations', () => {
|
|
11
|
-
expect('Hello'.length).toBe(5);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should work with objects', () => {
|
|
15
|
-
const obj = { name: 'test' };
|
|
16
|
-
expect(obj.name).toBe('test');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should handle arrays', () => {
|
|
20
|
-
const arr = [1, 2, 3];
|
|
21
|
-
expect(arr.length).toBe(3);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should handle boolean logic', () => {
|
|
25
|
-
expect(true && false).toBe(false);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should handle async operations', async () => {
|
|
29
|
-
const promise = Promise.resolve('success');
|
|
30
|
-
await expect(promise).resolves.toBe('success');
|
|
31
|
-
});
|
|
32
|
-
});
|