@yahoo/uds-mobile 2.2.0 → 2.3.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/README.md +92 -0
- package/dist/_virtual/_rolldown/runtime.cjs +14 -0
- package/dist/_virtual/_rolldown/runtime.js +19 -0
- package/dist/jest/index.cjs +27 -0
- package/dist/jest/index.d.cts +19 -0
- package/dist/jest/index.d.cts.map +1 -0
- package/dist/jest/index.d.ts +19 -0
- package/dist/jest/index.d.ts.map +1 -0
- package/dist/jest/index.js +25 -0
- package/dist/jest/index.js.map +1 -0
- package/dist/jest/mocks/icons.cjs +56 -0
- package/dist/jest/mocks/icons.d.cts +24 -0
- package/dist/jest/mocks/icons.d.cts.map +1 -0
- package/dist/jest/mocks/icons.d.ts +24 -0
- package/dist/jest/mocks/icons.d.ts.map +1 -0
- package/dist/jest/mocks/icons.js +46 -0
- package/dist/jest/mocks/icons.js.map +1 -0
- package/dist/jest/mocks/react-native.cjs +212 -0
- package/dist/jest/mocks/react-native.d.cts +293 -0
- package/dist/jest/mocks/react-native.d.cts.map +1 -0
- package/dist/jest/mocks/react-native.d.ts +293 -0
- package/dist/jest/mocks/react-native.d.ts.map +1 -0
- package/dist/jest/mocks/react-native.js +180 -0
- package/dist/jest/mocks/react-native.js.map +1 -0
- package/dist/jest/mocks/reanimated.cjs +249 -0
- package/dist/jest/mocks/reanimated.d.cts +150 -0
- package/dist/jest/mocks/reanimated.d.cts.map +1 -0
- package/dist/jest/mocks/reanimated.d.ts +150 -0
- package/dist/jest/mocks/reanimated.d.ts.map +1 -0
- package/dist/jest/mocks/reanimated.js +210 -0
- package/dist/jest/mocks/reanimated.js.map +1 -0
- package/dist/jest/mocks/styles.cjs +327 -0
- package/dist/jest/mocks/styles.d.cts +33 -0
- package/dist/jest/mocks/styles.d.cts.map +1 -0
- package/dist/jest/mocks/styles.d.ts +33 -0
- package/dist/jest/mocks/styles.d.ts.map +1 -0
- package/dist/jest/mocks/styles.js +310 -0
- package/dist/jest/mocks/styles.js.map +1 -0
- package/dist/jest/mocks/svg.cjs +133 -0
- package/dist/jest/mocks/svg.d.cts +137 -0
- package/dist/jest/mocks/svg.d.cts.map +1 -0
- package/dist/jest/mocks/svg.d.ts +137 -0
- package/dist/jest/mocks/svg.d.ts.map +1 -0
- package/dist/jest/mocks/svg.js +100 -0
- package/dist/jest/mocks/svg.js.map +1 -0
- package/dist/jest/mocks/unistyles.cjs +143 -0
- package/dist/jest/mocks/unistyles.d.cts +197 -0
- package/dist/jest/mocks/unistyles.d.cts.map +1 -0
- package/dist/jest/mocks/unistyles.d.ts +197 -0
- package/dist/jest/mocks/unistyles.d.ts.map +1 -0
- package/dist/jest/mocks/unistyles.js +132 -0
- package/dist/jest/mocks/unistyles.js.map +1 -0
- package/dist/jest/setup.cjs +40 -0
- package/dist/jest/setup.d.cts +11 -0
- package/dist/jest/setup.d.cts.map +1 -0
- package/dist/jest/setup.d.ts +11 -0
- package/dist/jest/setup.d.ts.map +1 -0
- package/dist/jest/setup.js +39 -0
- package/dist/jest/setup.js.map +1 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- [Icons](#icons)
|
|
10
10
|
- [Fonts](#fonts)
|
|
11
11
|
- [CLI](#cli)
|
|
12
|
+
- [Testing](#testing)
|
|
12
13
|
- [Contributing](#contributing)
|
|
13
14
|
- [API Reference](#api-reference)
|
|
14
15
|
|
|
@@ -553,6 +554,97 @@ export const breakpoints = {
|
|
|
553
554
|
};
|
|
554
555
|
```
|
|
555
556
|
|
|
557
|
+
## Testing
|
|
558
|
+
|
|
559
|
+
### Jest Setup
|
|
560
|
+
|
|
561
|
+
UDS Mobile ships Jest mocks for native dependencies that don't work in Jest/JSDOM, allowing **real UDS components** to be tested without native module errors. This approach ensures your tests validate actual component behavior.
|
|
562
|
+
|
|
563
|
+
#### Quick Start
|
|
564
|
+
|
|
565
|
+
Add the setup file to your Jest config:
|
|
566
|
+
|
|
567
|
+
```js
|
|
568
|
+
// jest.config.js
|
|
569
|
+
module.exports = {
|
|
570
|
+
preset: 'react-native',
|
|
571
|
+
setupFilesAfterEnv: ['@yahoo/uds-mobile/jest'],
|
|
572
|
+
transformIgnorePatterns: [
|
|
573
|
+
'node_modules/(?!(@yahoo/uds-mobile|@yahoo/uds-icons|react-native|@react-native)/)',
|
|
574
|
+
],
|
|
575
|
+
};
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Or import manually in your setup file:
|
|
579
|
+
|
|
580
|
+
```js
|
|
581
|
+
// jest.setup.js
|
|
582
|
+
import '@yahoo/uds-mobile/jest';
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
#### What Gets Mocked
|
|
586
|
+
|
|
587
|
+
The setup automatically mocks these native dependencies:
|
|
588
|
+
|
|
589
|
+
| Package | What's Mocked |
|
|
590
|
+
| ------------------------- | ----------------------------------------------------------------------------------- |
|
|
591
|
+
| `react-native-unistyles` | `useUnistyles()`, `StyleSheet.create()`, `UnistylesRuntime` |
|
|
592
|
+
| `react-native-reanimated` | Animated components, hooks (`useSharedValue`, `useAnimatedStyle`), timing functions |
|
|
593
|
+
| `react-native-svg` | `SvgXml`, SVG shape components |
|
|
594
|
+
| `@yahoo/uds-icons` | `glyphMap`, `svgMap`, `ICON_SIZE_MAP` |
|
|
595
|
+
|
|
596
|
+
#### Example Test
|
|
597
|
+
|
|
598
|
+
```tsx
|
|
599
|
+
import { render, fireEvent } from '@testing-library/react-native';
|
|
600
|
+
import { Button } from '@yahoo/uds-mobile/Button';
|
|
601
|
+
import { Text } from '@yahoo/uds-mobile/Text';
|
|
602
|
+
import { VStack } from '@yahoo/uds-mobile/VStack';
|
|
603
|
+
|
|
604
|
+
test('renders button with text and handles press', () => {
|
|
605
|
+
const onPress = jest.fn();
|
|
606
|
+
|
|
607
|
+
const { getByRole, getByText } = render(
|
|
608
|
+
<VStack>
|
|
609
|
+
<Button variant="primary" onPress={onPress}>
|
|
610
|
+
Save
|
|
611
|
+
</Button>
|
|
612
|
+
</VStack>,
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
expect(getByText('Save')).toBeTruthy();
|
|
616
|
+
|
|
617
|
+
fireEvent.press(getByRole('button'));
|
|
618
|
+
expect(onPress).toHaveBeenCalled();
|
|
619
|
+
});
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
#### Benefits
|
|
623
|
+
|
|
624
|
+
- **Real component testing**: Tests validate actual component behavior, not stubs
|
|
625
|
+
- **No native module errors**: Required native dependencies are properly mocked
|
|
626
|
+
- **Zero configuration**: Just add the setup file and transformIgnorePatterns
|
|
627
|
+
- **Catches regressions**: Tests break when component behavior changes
|
|
628
|
+
|
|
629
|
+
#### Manual Mock Access
|
|
630
|
+
|
|
631
|
+
If you need to customize mocks, individual modules are exported:
|
|
632
|
+
|
|
633
|
+
```js
|
|
634
|
+
import { mocks } from '@yahoo/uds-mobile/jest';
|
|
635
|
+
|
|
636
|
+
// Override a specific mock
|
|
637
|
+
jest.mock('react-native-unistyles', () => ({
|
|
638
|
+
...mocks.unistyles,
|
|
639
|
+
useUnistyles: () => ({
|
|
640
|
+
theme: {
|
|
641
|
+
/* custom theme */
|
|
642
|
+
},
|
|
643
|
+
rt: { themeName: 'dark' },
|
|
644
|
+
}),
|
|
645
|
+
}));
|
|
646
|
+
```
|
|
647
|
+
|
|
556
648
|
## Contributing
|
|
557
649
|
|
|
558
650
|
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow, architecture details, and internal documentation.
|
|
@@ -6,6 +6,19 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __exportAll = (all, no_symbols) => {
|
|
10
|
+
let target = {};
|
|
11
|
+
for (var name in all) {
|
|
12
|
+
__defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (!no_symbols) {
|
|
18
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
};
|
|
9
22
|
var __copyProps = (to, from, except, desc) => {
|
|
10
23
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
24
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -27,4 +40,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
40
|
|
|
28
41
|
//#endregion
|
|
29
42
|
|
|
43
|
+
exports.__exportAll = __exportAll;
|
|
30
44
|
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __exportAll = (all, no_symbols) => {
|
|
5
|
+
let target = {};
|
|
6
|
+
for (var name in all) {
|
|
7
|
+
__defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (!no_symbols) {
|
|
13
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
}
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { __exportAll };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_jest_mocks_icons = require('./mocks/icons.cjs');
|
|
4
|
+
const require_jest_mocks_reanimated = require('./mocks/reanimated.cjs');
|
|
5
|
+
const require_jest_mocks_styles = require('./mocks/styles.cjs');
|
|
6
|
+
const require_jest_mocks_svg = require('./mocks/svg.cjs');
|
|
7
|
+
const require_jest_mocks_unistyles = require('./mocks/unistyles.cjs');
|
|
8
|
+
const require_jest_setup = require('./setup.cjs');
|
|
9
|
+
|
|
10
|
+
//#region src/jest/index.ts
|
|
11
|
+
/**
|
|
12
|
+
* Jest testing support for UDS Mobile.
|
|
13
|
+
* Mocks native dependencies so real components can be tested.
|
|
14
|
+
*/
|
|
15
|
+
const mocks = {
|
|
16
|
+
unistyles: require_jest_mocks_unistyles.unistyles_exports,
|
|
17
|
+
reanimated: require_jest_mocks_reanimated.reanimated_exports,
|
|
18
|
+
svg: require_jest_mocks_svg.svg_exports,
|
|
19
|
+
icons: require_jest_mocks_icons.icons_exports,
|
|
20
|
+
styles: require_jest_mocks_styles.styles_exports
|
|
21
|
+
};
|
|
22
|
+
require_jest_setup.setupUDSMobileJest();
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.mocks = mocks;
|
|
26
|
+
exports.resetSetupState = require_jest_setup.resetSetupState;
|
|
27
|
+
exports.setupUDSMobileJest = require_jest_setup.setupUDSMobileJest;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { icons_d_exports } from "./mocks/icons.cjs";
|
|
3
|
+
import { reanimated_d_exports } from "./mocks/reanimated.cjs";
|
|
4
|
+
import { styles_d_exports } from "./mocks/styles.cjs";
|
|
5
|
+
import { svg_d_exports } from "./mocks/svg.cjs";
|
|
6
|
+
import { unistyles_d_exports } from "./mocks/unistyles.cjs";
|
|
7
|
+
import { resetSetupState, setupUDSMobileJest } from "./setup.cjs";
|
|
8
|
+
|
|
9
|
+
//#region src/jest/index.d.ts
|
|
10
|
+
declare const mocks: {
|
|
11
|
+
unistyles: typeof unistyles_d_exports;
|
|
12
|
+
reanimated: typeof reanimated_d_exports;
|
|
13
|
+
svg: typeof svg_d_exports;
|
|
14
|
+
icons: typeof icons_d_exports;
|
|
15
|
+
styles: typeof styles_d_exports;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { mocks, resetSetupState, setupUDSMobileJest };
|
|
19
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/jest/index.ts"],"mappings":";;;;;;;;;cAYM,KAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { icons_d_exports } from "./mocks/icons.js";
|
|
3
|
+
import { reanimated_d_exports } from "./mocks/reanimated.js";
|
|
4
|
+
import { styles_d_exports } from "./mocks/styles.js";
|
|
5
|
+
import { svg_d_exports } from "./mocks/svg.js";
|
|
6
|
+
import { unistyles_d_exports } from "./mocks/unistyles.js";
|
|
7
|
+
import { resetSetupState, setupUDSMobileJest } from "./setup.js";
|
|
8
|
+
|
|
9
|
+
//#region src/jest/index.d.ts
|
|
10
|
+
declare const mocks: {
|
|
11
|
+
unistyles: typeof unistyles_d_exports;
|
|
12
|
+
reanimated: typeof reanimated_d_exports;
|
|
13
|
+
svg: typeof svg_d_exports;
|
|
14
|
+
icons: typeof icons_d_exports;
|
|
15
|
+
styles: typeof styles_d_exports;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { mocks, resetSetupState, setupUDSMobileJest };
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/jest/index.ts"],"mappings":";;;;;;;;;cAYM,KAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { icons_exports } from "./mocks/icons.js";
|
|
3
|
+
import { reanimated_exports } from "./mocks/reanimated.js";
|
|
4
|
+
import { styles_exports } from "./mocks/styles.js";
|
|
5
|
+
import { svg_exports } from "./mocks/svg.js";
|
|
6
|
+
import { unistyles_exports } from "./mocks/unistyles.js";
|
|
7
|
+
import { resetSetupState, setupUDSMobileJest } from "./setup.js";
|
|
8
|
+
|
|
9
|
+
//#region src/jest/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Jest testing support for UDS Mobile.
|
|
12
|
+
* Mocks native dependencies so real components can be tested.
|
|
13
|
+
*/
|
|
14
|
+
const mocks = {
|
|
15
|
+
unistyles: unistyles_exports,
|
|
16
|
+
reanimated: reanimated_exports,
|
|
17
|
+
svg: svg_exports,
|
|
18
|
+
icons: icons_exports,
|
|
19
|
+
styles: styles_exports
|
|
20
|
+
};
|
|
21
|
+
setupUDSMobileJest();
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { mocks, resetSetupState, setupUDSMobileJest };
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/jest/index.ts"],"sourcesContent":["/**\n * Jest testing support for UDS Mobile.\n * Mocks native dependencies so real components can be tested.\n */\n\nimport * as icons from './mocks/icons';\nimport * as reanimated from './mocks/reanimated';\nimport * as styles from './mocks/styles';\nimport * as svg from './mocks/svg';\nimport * as unistyles from './mocks/unistyles';\nimport { resetSetupState, setupUDSMobileJest } from './setup';\n\nconst mocks = {\n unistyles,\n reanimated,\n svg,\n icons,\n styles,\n};\n\n// Auto-run setup when this module is imported\nsetupUDSMobileJest();\n\nexport { mocks, resetSetupState, setupUDSMobileJest };\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACD;AAGD,oBAAoB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/jest/mocks/icons.ts
|
|
6
|
+
var icons_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
7
|
+
ICON_SIZE_MAP: () => ICON_SIZE_MAP,
|
|
8
|
+
glyphMap: () => glyphMap,
|
|
9
|
+
glyphNames: () => glyphNames,
|
|
10
|
+
svgGlyphNames: () => svgGlyphNames,
|
|
11
|
+
svgMap: () => svgMap
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Jest mock for @yahoo/uds-icons.
|
|
15
|
+
*
|
|
16
|
+
* Provides proxy-based mocks for glyph and SVG maps
|
|
17
|
+
* so any icon name returns a valid placeholder.
|
|
18
|
+
*/
|
|
19
|
+
const glyphMapProxy = new Proxy({}, {
|
|
20
|
+
get: (_target, prop) => {
|
|
21
|
+
if (typeof prop === "string") return "";
|
|
22
|
+
},
|
|
23
|
+
has: () => true,
|
|
24
|
+
ownKeys: () => []
|
|
25
|
+
});
|
|
26
|
+
const svgMapProxy = new Proxy({}, {
|
|
27
|
+
get: (_target, prop) => {
|
|
28
|
+
if (typeof prop === "string") return "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" fill=\"currentColor\"/></svg>";
|
|
29
|
+
},
|
|
30
|
+
has: () => true,
|
|
31
|
+
ownKeys: () => []
|
|
32
|
+
});
|
|
33
|
+
const ICON_SIZE_MAP = {
|
|
34
|
+
xs: 12,
|
|
35
|
+
sm: 16,
|
|
36
|
+
md: 24,
|
|
37
|
+
lg: 32,
|
|
38
|
+
xl: 48
|
|
39
|
+
};
|
|
40
|
+
const glyphMap = glyphMapProxy;
|
|
41
|
+
const glyphNames = [];
|
|
42
|
+
const svgMap = svgMapProxy;
|
|
43
|
+
const svgGlyphNames = [];
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.ICON_SIZE_MAP = ICON_SIZE_MAP;
|
|
47
|
+
exports.glyphMap = glyphMap;
|
|
48
|
+
exports.glyphNames = glyphNames;
|
|
49
|
+
Object.defineProperty(exports, 'icons_exports', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return icons_exports;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
exports.svgGlyphNames = svgGlyphNames;
|
|
56
|
+
exports.svgMap = svgMap;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
declare namespace icons_d_exports {
|
|
3
|
+
export { ICON_SIZE_MAP, glyphMap, glyphNames, svgGlyphNames, svgMap };
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Jest mock for @yahoo/uds-icons.
|
|
7
|
+
*
|
|
8
|
+
* Provides proxy-based mocks for glyph and SVG maps
|
|
9
|
+
* so any icon name returns a valid placeholder.
|
|
10
|
+
*/
|
|
11
|
+
declare const ICON_SIZE_MAP: {
|
|
12
|
+
readonly xs: 12;
|
|
13
|
+
readonly sm: 16;
|
|
14
|
+
readonly md: 24;
|
|
15
|
+
readonly lg: 32;
|
|
16
|
+
readonly xl: 48;
|
|
17
|
+
};
|
|
18
|
+
declare const glyphMap: {};
|
|
19
|
+
declare const glyphNames: string[];
|
|
20
|
+
declare const svgMap: {};
|
|
21
|
+
declare const svgGlyphNames: string[];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ICON_SIZE_MAP, glyphMap, glyphNames, icons_d_exports, svgGlyphNames, svgMap };
|
|
24
|
+
//# sourceMappingURL=icons.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.cts","names":[],"sources":["../../../src/jest/mocks/icons.ts"],"mappings":";;;;;;;;;;cAyCa,aAAA;EAAA;;;;;;cASA,QAAA;AAAA,cACA,UAAA;AAAA,cAGA,MAAA;AAAA,cACA,aAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
declare namespace icons_d_exports {
|
|
3
|
+
export { ICON_SIZE_MAP, glyphMap, glyphNames, svgGlyphNames, svgMap };
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Jest mock for @yahoo/uds-icons.
|
|
7
|
+
*
|
|
8
|
+
* Provides proxy-based mocks for glyph and SVG maps
|
|
9
|
+
* so any icon name returns a valid placeholder.
|
|
10
|
+
*/
|
|
11
|
+
declare const ICON_SIZE_MAP: {
|
|
12
|
+
readonly xs: 12;
|
|
13
|
+
readonly sm: 16;
|
|
14
|
+
readonly md: 24;
|
|
15
|
+
readonly lg: 32;
|
|
16
|
+
readonly xl: 48;
|
|
17
|
+
};
|
|
18
|
+
declare const glyphMap: {};
|
|
19
|
+
declare const glyphNames: string[];
|
|
20
|
+
declare const svgMap: {};
|
|
21
|
+
declare const svgGlyphNames: string[];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ICON_SIZE_MAP, glyphMap, glyphNames, icons_d_exports, svgGlyphNames, svgMap };
|
|
24
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","names":[],"sources":["../../../src/jest/mocks/icons.ts"],"mappings":";;;;;;;;;;cAyCa,aAAA;EAAA;;;;;;cASA,QAAA;AAAA,cACA,UAAA;AAAA,cAGA,MAAA;AAAA,cACA,aAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
|
|
4
|
+
//#region src/jest/mocks/icons.ts
|
|
5
|
+
var icons_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
ICON_SIZE_MAP: () => ICON_SIZE_MAP,
|
|
7
|
+
glyphMap: () => glyphMap,
|
|
8
|
+
glyphNames: () => glyphNames,
|
|
9
|
+
svgGlyphNames: () => svgGlyphNames,
|
|
10
|
+
svgMap: () => svgMap
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Jest mock for @yahoo/uds-icons.
|
|
14
|
+
*
|
|
15
|
+
* Provides proxy-based mocks for glyph and SVG maps
|
|
16
|
+
* so any icon name returns a valid placeholder.
|
|
17
|
+
*/
|
|
18
|
+
const glyphMapProxy = new Proxy({}, {
|
|
19
|
+
get: (_target, prop) => {
|
|
20
|
+
if (typeof prop === "string") return "";
|
|
21
|
+
},
|
|
22
|
+
has: () => true,
|
|
23
|
+
ownKeys: () => []
|
|
24
|
+
});
|
|
25
|
+
const svgMapProxy = new Proxy({}, {
|
|
26
|
+
get: (_target, prop) => {
|
|
27
|
+
if (typeof prop === "string") return "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" fill=\"currentColor\"/></svg>";
|
|
28
|
+
},
|
|
29
|
+
has: () => true,
|
|
30
|
+
ownKeys: () => []
|
|
31
|
+
});
|
|
32
|
+
const ICON_SIZE_MAP = {
|
|
33
|
+
xs: 12,
|
|
34
|
+
sm: 16,
|
|
35
|
+
md: 24,
|
|
36
|
+
lg: 32,
|
|
37
|
+
xl: 48
|
|
38
|
+
};
|
|
39
|
+
const glyphMap = glyphMapProxy;
|
|
40
|
+
const glyphNames = [];
|
|
41
|
+
const svgMap = svgMapProxy;
|
|
42
|
+
const svgGlyphNames = [];
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ICON_SIZE_MAP, glyphMap, glyphNames, icons_exports, svgGlyphNames, svgMap };
|
|
46
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../../src/jest/mocks/icons.ts"],"sourcesContent":["/**\n * Jest mock for @yahoo/uds-icons.\n *\n * Provides proxy-based mocks for glyph and SVG maps\n * so any icon name returns a valid placeholder.\n */\n\n// Proxy that returns a placeholder glyph character for any icon name\nconst glyphMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return a placeholder glyph character\n // Using a simple character that works in Jest/JSDOM\n if (typeof prop === 'string') {\n return '\\uE000'; // Private use area character\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Proxy that returns placeholder SVG content for any icon name\nconst svgMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return minimal valid SVG for any key\n if (typeof prop === 'string') {\n return '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" fill=\"currentColor\"/></svg>';\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Icon size mapping (matches actual package)\nexport const ICON_SIZE_MAP = {\n xs: 12,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 48,\n} as const;\n\n// Export glyph map and names\nexport const glyphMap = glyphMapProxy;\nexport const glyphNames: string[] = [];\n\n// Export SVG map and names\nexport const svgMap = svgMapProxy;\nexport const svgGlyphNames: string[] = [];\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgB,IAAI,MACxB,EAAE,EACF;CACE,MAAM,SAAS,SAAS;AAGtB,MAAI,OAAO,SAAS,SAClB,QAAO;;CAIX,WAAW;CACX,eAAe,EAAE;CAClB,CACF;AAGD,MAAM,cAAc,IAAI,MACtB,EAAE,EACF;CACE,MAAM,SAAS,SAAS;AAEtB,MAAI,OAAO,SAAS,SAClB,QAAO;;CAIX,WAAW;CACX,eAAe,EAAE;CAClB,CACF;AAGD,MAAa,gBAAgB;CAC3B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAGD,MAAa,WAAW;AACxB,MAAa,aAAuB,EAAE;AAGtC,MAAa,SAAS;AACtB,MAAa,gBAA0B,EAAE"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
3
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react);
|
|
6
|
+
|
|
7
|
+
//#region src/jest/mocks/react-native.tsx
|
|
8
|
+
global.__DEV__ = true;
|
|
9
|
+
function createMockComponent(name) {
|
|
10
|
+
const MockComponent = (0, react.forwardRef)(({ children, ...props }, ref) => {
|
|
11
|
+
return react.default.createElement(name, {
|
|
12
|
+
...props,
|
|
13
|
+
ref
|
|
14
|
+
}, children);
|
|
15
|
+
});
|
|
16
|
+
MockComponent.displayName = name;
|
|
17
|
+
return MockComponent;
|
|
18
|
+
}
|
|
19
|
+
const View = createMockComponent("View");
|
|
20
|
+
const Text = createMockComponent("Text");
|
|
21
|
+
const Image = createMockComponent("Image");
|
|
22
|
+
const ScrollView = createMockComponent("ScrollView");
|
|
23
|
+
const TextInput = createMockComponent("TextInput");
|
|
24
|
+
const TouchableOpacity = createMockComponent("TouchableOpacity");
|
|
25
|
+
const TouchableHighlight = createMockComponent("TouchableHighlight");
|
|
26
|
+
const TouchableWithoutFeedback = createMockComponent("TouchableWithoutFeedback");
|
|
27
|
+
const Pressable = createMockComponent("Pressable");
|
|
28
|
+
const FlatList = createMockComponent("FlatList");
|
|
29
|
+
const SectionList = createMockComponent("SectionList");
|
|
30
|
+
const ActivityIndicator = createMockComponent("ActivityIndicator");
|
|
31
|
+
const SafeAreaView = createMockComponent("SafeAreaView");
|
|
32
|
+
const Modal = createMockComponent("Modal");
|
|
33
|
+
const Switch = createMockComponent("Switch");
|
|
34
|
+
const RefreshControl = createMockComponent("RefreshControl");
|
|
35
|
+
const KeyboardAvoidingView = createMockComponent("KeyboardAvoidingView");
|
|
36
|
+
const StyleSheet = {
|
|
37
|
+
create: (styles) => styles,
|
|
38
|
+
flatten: (style) => {
|
|
39
|
+
if (Array.isArray(style)) return Object.assign({}, ...style);
|
|
40
|
+
return style || {};
|
|
41
|
+
},
|
|
42
|
+
compose: (style1, style2) => [style1, style2],
|
|
43
|
+
hairlineWidth: 1,
|
|
44
|
+
absoluteFill: {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
top: 0,
|
|
49
|
+
bottom: 0
|
|
50
|
+
},
|
|
51
|
+
absoluteFillObject: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
top: 0,
|
|
56
|
+
bottom: 0
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const Platform = {
|
|
60
|
+
OS: "ios",
|
|
61
|
+
Version: 17,
|
|
62
|
+
select: (config) => {
|
|
63
|
+
return config.ios ?? config.default;
|
|
64
|
+
},
|
|
65
|
+
isTV: false,
|
|
66
|
+
isPad: false,
|
|
67
|
+
isVision: false,
|
|
68
|
+
isTesting: true,
|
|
69
|
+
constants: { reactNativeVersion: {
|
|
70
|
+
major: 0,
|
|
71
|
+
minor: 83,
|
|
72
|
+
patch: 0
|
|
73
|
+
} }
|
|
74
|
+
};
|
|
75
|
+
const SCREEN_WIDTH = 375;
|
|
76
|
+
const SCREEN_HEIGHT = 812;
|
|
77
|
+
const Dimensions = {
|
|
78
|
+
get: (_dim) => ({
|
|
79
|
+
width: SCREEN_WIDTH,
|
|
80
|
+
height: SCREEN_HEIGHT,
|
|
81
|
+
scale: 2,
|
|
82
|
+
fontScale: 1
|
|
83
|
+
}),
|
|
84
|
+
set: jest.fn(),
|
|
85
|
+
addEventListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
86
|
+
removeEventListener: jest.fn()
|
|
87
|
+
};
|
|
88
|
+
const PixelRatio = {
|
|
89
|
+
get: () => 2,
|
|
90
|
+
getFontScale: () => 1,
|
|
91
|
+
getPixelSizeForLayoutSize: (size) => size * 2,
|
|
92
|
+
roundToNearestPixel: (size) => Math.round(size * 2) / 2
|
|
93
|
+
};
|
|
94
|
+
const Animated = {
|
|
95
|
+
View: createMockComponent("Animated.View"),
|
|
96
|
+
Text: createMockComponent("Animated.Text"),
|
|
97
|
+
Image: createMockComponent("Animated.Image"),
|
|
98
|
+
ScrollView: createMockComponent("Animated.ScrollView"),
|
|
99
|
+
Value: class {
|
|
100
|
+
_value;
|
|
101
|
+
constructor(value) {
|
|
102
|
+
this._value = value;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
timing: jest.fn(() => ({ start: jest.fn() })),
|
|
106
|
+
spring: jest.fn(() => ({ start: jest.fn() })),
|
|
107
|
+
createAnimatedComponent: (Component) => Component
|
|
108
|
+
};
|
|
109
|
+
const Keyboard = {
|
|
110
|
+
dismiss: jest.fn(),
|
|
111
|
+
addListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
112
|
+
removeListener: jest.fn(),
|
|
113
|
+
isVisible: jest.fn(() => false)
|
|
114
|
+
};
|
|
115
|
+
const Linking = {
|
|
116
|
+
openURL: jest.fn().mockResolvedValue(true),
|
|
117
|
+
canOpenURL: jest.fn().mockResolvedValue(true),
|
|
118
|
+
getInitialURL: jest.fn().mockResolvedValue(null),
|
|
119
|
+
addEventListener: jest.fn(() => ({ remove: jest.fn() }))
|
|
120
|
+
};
|
|
121
|
+
const AppState = {
|
|
122
|
+
currentState: "active",
|
|
123
|
+
addEventListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
124
|
+
removeEventListener: jest.fn()
|
|
125
|
+
};
|
|
126
|
+
const AccessibilityInfo = {
|
|
127
|
+
isReduceMotionEnabled: jest.fn().mockResolvedValue(false),
|
|
128
|
+
isScreenReaderEnabled: jest.fn().mockResolvedValue(false),
|
|
129
|
+
addEventListener: jest.fn(() => ({ remove: jest.fn() }))
|
|
130
|
+
};
|
|
131
|
+
var NativeEventEmitter = class {
|
|
132
|
+
addListener = jest.fn(() => ({ remove: jest.fn() }));
|
|
133
|
+
removeListener = jest.fn();
|
|
134
|
+
removeAllListeners = jest.fn();
|
|
135
|
+
};
|
|
136
|
+
const Appearance = {
|
|
137
|
+
getColorScheme: () => "light",
|
|
138
|
+
addChangeListener: jest.fn(() => ({ remove: jest.fn() })),
|
|
139
|
+
removeChangeListener: jest.fn()
|
|
140
|
+
};
|
|
141
|
+
const useColorScheme = () => "light";
|
|
142
|
+
const useWindowDimensions = () => ({
|
|
143
|
+
width: SCREEN_WIDTH,
|
|
144
|
+
height: SCREEN_HEIGHT,
|
|
145
|
+
scale: 2,
|
|
146
|
+
fontScale: 1
|
|
147
|
+
});
|
|
148
|
+
const ReactNative = {
|
|
149
|
+
View,
|
|
150
|
+
Text,
|
|
151
|
+
Image,
|
|
152
|
+
ScrollView,
|
|
153
|
+
TextInput,
|
|
154
|
+
TouchableOpacity,
|
|
155
|
+
TouchableHighlight,
|
|
156
|
+
TouchableWithoutFeedback,
|
|
157
|
+
Pressable,
|
|
158
|
+
FlatList,
|
|
159
|
+
SectionList,
|
|
160
|
+
ActivityIndicator,
|
|
161
|
+
SafeAreaView,
|
|
162
|
+
Modal,
|
|
163
|
+
Switch,
|
|
164
|
+
RefreshControl,
|
|
165
|
+
KeyboardAvoidingView,
|
|
166
|
+
StyleSheet,
|
|
167
|
+
Platform,
|
|
168
|
+
Dimensions,
|
|
169
|
+
PixelRatio,
|
|
170
|
+
Animated,
|
|
171
|
+
Keyboard,
|
|
172
|
+
Linking,
|
|
173
|
+
AppState,
|
|
174
|
+
AccessibilityInfo,
|
|
175
|
+
NativeEventEmitter,
|
|
176
|
+
Appearance,
|
|
177
|
+
useColorScheme,
|
|
178
|
+
useWindowDimensions
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
//#endregion
|
|
182
|
+
exports.AccessibilityInfo = AccessibilityInfo;
|
|
183
|
+
exports.ActivityIndicator = ActivityIndicator;
|
|
184
|
+
exports.Animated = Animated;
|
|
185
|
+
exports.AppState = AppState;
|
|
186
|
+
exports.Appearance = Appearance;
|
|
187
|
+
exports.Dimensions = Dimensions;
|
|
188
|
+
exports.FlatList = FlatList;
|
|
189
|
+
exports.Image = Image;
|
|
190
|
+
exports.Keyboard = Keyboard;
|
|
191
|
+
exports.KeyboardAvoidingView = KeyboardAvoidingView;
|
|
192
|
+
exports.Linking = Linking;
|
|
193
|
+
exports.Modal = Modal;
|
|
194
|
+
exports.NativeEventEmitter = NativeEventEmitter;
|
|
195
|
+
exports.PixelRatio = PixelRatio;
|
|
196
|
+
exports.Platform = Platform;
|
|
197
|
+
exports.Pressable = Pressable;
|
|
198
|
+
exports.RefreshControl = RefreshControl;
|
|
199
|
+
exports.SafeAreaView = SafeAreaView;
|
|
200
|
+
exports.ScrollView = ScrollView;
|
|
201
|
+
exports.SectionList = SectionList;
|
|
202
|
+
exports.StyleSheet = StyleSheet;
|
|
203
|
+
exports.Switch = Switch;
|
|
204
|
+
exports.Text = Text;
|
|
205
|
+
exports.TextInput = TextInput;
|
|
206
|
+
exports.TouchableHighlight = TouchableHighlight;
|
|
207
|
+
exports.TouchableOpacity = TouchableOpacity;
|
|
208
|
+
exports.TouchableWithoutFeedback = TouchableWithoutFeedback;
|
|
209
|
+
exports.View = View;
|
|
210
|
+
exports.default = ReactNative;
|
|
211
|
+
exports.useColorScheme = useColorScheme;
|
|
212
|
+
exports.useWindowDimensions = useWindowDimensions;
|