Remove legacy renderBooleans prop (#5483)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-06-02 08:59:23 -04:00
1 parent b86d409c92
commit d4fbab7176
11 files changed
+564 -66

No files matched your search

@@ -1,23 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import React from "react";
import { displayBooleans } from "../display-booleans";
describe("displayBooleans tests", () => {
it("should not do anything to div's if shouldShow is false", () => {
expect(displayBooleans(false, <div></div>)).toStrictEqual(<div></div>);
});
it("should not do anything to booleans's if shouldShow is false", () => {
expect(displayBooleans(false, true)).toStrictEqual(true);
expect(displayBooleans(false, false)).toStrictEqual(false);
});
it("should stringify booleans when shouldShow is true", () => {
expect(displayBooleans(true, true)).toStrictEqual("true");
expect(displayBooleans(true, false)).toStrictEqual("false");
});
});
-20
View File
@@ -1,20 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type React from "react";
export function displayBooleans(shouldShow: boolean | undefined, from: React.ReactNode): React.ReactNode {
if (shouldShow) {
if (typeof from === "boolean") {
return from.toString();
}
if (Array.isArray(from)) {
return from.map(node => displayBooleans(shouldShow, node));
}
}
return from;
}
-1
View File
@@ -9,7 +9,6 @@ export * from "../../common/event-emitter";
export * from "./cssNames";
export * from "./cssVar";
export * from "./display-booleans";
export * from "./display-mode";
export * from "./interval";
export * from "./isMiddleClick";