Comments (4)
@chiuam any idea? I think you worked last on the high contrast getter?
from fluentui-react-native.
Might need a mock - a lot of RN module functionality tends to need to get mocked out. esp if it accesses native info
from fluentui-react-native.
https://jestjs.io/docs/tutorial-react-native#mock-native-modules-using-jestmock
from fluentui-react-native.
Think I found a fix for this, which was to make sure the AccessibilityInfo module was not getting mocked out. My working understanding of why this fixed the issue is that the AccessibilityInfo module was getting mocked out automatically (I think because it's a node module, and node modules get mocked out automatically) - but it was getting mocked out incorrectly. When I would try printing out what was in AccessibilityInfo this is what I would get:
{
addEventListener: [Function: mockConstructor] {
_isMockFunction: true,
getMockImplementation: [Function (anonymous)],
mock: [Getter/Setter],
mockClear: [Function (anonymous)],
mockReset: [Function (anonymous)],
mockRestore: [Function (anonymous)],
mockReturnValueOnce: [Function (anonymous)],
mockResolvedValueOnce: [Function (anonymous)],
mockRejectedValueOnce: [Function (anonymous)],
mockReturnValue: [Function (anonymous)],
mockResolvedValue: [Function (anonymous)],
mockRejectedValue: [Function (anonymous)],
mockImplementationOnce: [Function (anonymous)],
mockImplementation: [Function (anonymous)],
mockReturnThis: [Function (anonymous)],
mockName: [Function (anonymous)],
getMockName: [Function (anonymous)]
},
announceForAccessibility: [Function: mockConstructor] {
_isMockFunction: true,
getMockImplementation: [Function (anonymous)],
mock: [Getter/Setter],
mockClear: [Function (anonymous)],
mockReset: [Function (anonymous)],
mockRestore: [Function (anonymous)],
mockReturnValueOnce: [Function (anonymous)],
mockResolvedValueOnce: [Function (anonymous)],
mockRejectedValueOnce: [Function (anonymous)],
mockReturnValue: [Function (anonymous)],
mockResolvedValue: [Function (anonymous)],
mockRejectedValue: [Function (anonymous)],
mockImplementationOnce: [Function (anonymous)],
mockImplementation: [Function (anonymous)],
mockReturnThis: [Function (anonymous)],
mockName: [Function (anonymous)],
getMockName: [Function (anonymous)]
},
...
It would print a bunch of mocked methods, but not isHighContrast. The list of methods printed out corresponded with the react-native AccessiibilityInfo object (which doesn't include isHighContastEnabled), not the react-native-macos AccessibilityInfo object.
If i printed out AccessibilityInfo while I was running the tester, all the react-native-macos methods would get printed out correctly.
I don't know why AccessibilityInfo was getting mocked out incorrectly, but using the actual module worked.
from fluentui-react-native.
Related Issues (20)
- Make default theme use platform-specific alias tokens
- Unable to use the Callout component in a React native windows application HOT 2
- Where is RCTFocusTrapZone? HOT 5
- Some necessary NPM modules are not in dependencies in package.json HOT 1
- All Platforms Compatibility HOT 8
- React 18 and expo 40 HOT 1
- Update macOS status tokens
- Can we use Fluent UI react with C++ application?
- Block property on button does not consistently work properly HOT 4
- Stack horizontal not working HOT 3
- Refactor Android and iOS datepicker test pages out to separate file HOT 1
- Deprecate "branded" token variants HOT 1
- ThemeProvider not updating the state when themeRef changes HOT 2
- Thumb size on Switch component does not adhere to `thumbSize` Switch Token in the pressed down state. HOT 1
- Subtle IconOnly buttons using a Font Icon do not show click state on iOS HOT 2
- NormalPeoplePicker sometimes not returning persona text after user selected one item from suggestion list HOT 1
- The Switch component does not re-render on Theme change
- importSource cannot be set when runtime is classic. Using Expo Blank Typescript template HOT 4
- Checkbox is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluentui-react-native.