mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix LogBox.ignoreAllLogs used with no argument (#29310)
Summary: When you call `LogBox.ignoreAllLogs()` it should ignore logs. This fixes a bug that made this equivalent to `LogBox.ignoreAllLogs(false)` ## Changelog [General] [Fixed] - LogBox.ignoreAllLogs() should ignore logs Pull Request resolved: https://github.com/facebook/react-native/pull/29310 Test Plan: Added tests Reviewed By: TheSavior Differential Revision: D22448436 Pulled By: rickhanlonii fbshipit-source-id: 6ba12b9d9c1f29cf3ac503946ac5ca0097425a7a
This commit is contained in:
@@ -42,7 +42,7 @@ if (__DEV__) {
|
||||
},
|
||||
|
||||
ignoreAllLogs: (value?: ?boolean): void => {
|
||||
LogBoxData.setDisabled(!!value);
|
||||
LogBoxData.setDisabled(value == null ? true : value);
|
||||
},
|
||||
|
||||
uninstall: (): void => {
|
||||
|
||||
@@ -69,6 +69,30 @@ describe('LogBox', () => {
|
||||
expect(LogBoxData.isDisabled()).toBe(true);
|
||||
});
|
||||
|
||||
it('will not ignore logs for `ignoreAllLogs(false)`', () => {
|
||||
expect(LogBoxData.isDisabled()).toBe(false);
|
||||
|
||||
LogBox.install();
|
||||
|
||||
expect(LogBoxData.isDisabled()).toBe(false);
|
||||
|
||||
LogBox.ignoreAllLogs(false);
|
||||
|
||||
expect(LogBoxData.isDisabled()).toBe(false);
|
||||
});
|
||||
|
||||
it('will ignore logs for `ignoreAllLogs()`', () => {
|
||||
expect(LogBoxData.isDisabled()).toBe(false);
|
||||
|
||||
LogBox.install();
|
||||
|
||||
expect(LogBoxData.isDisabled()).toBe(false);
|
||||
|
||||
LogBox.ignoreAllLogs();
|
||||
|
||||
expect(LogBoxData.isDisabled()).toBe(true);
|
||||
});
|
||||
|
||||
it('registers warnings', () => {
|
||||
jest.mock('../Data/LogBoxData');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user