From 08ba8663f89d1c27642d55a1b2ba99b8c2ff4be2 Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Thu, 15 Jul 2021 23:25:03 -0700 Subject: [PATCH] Show test/expect information about an example or description Summary: Changelog: [Internal] - Allow for examples to define test steps and expectation Reviewed By: charlesbdudley Differential Revision: D29674189 fbshipit-source-id: ac62a634d0139d179408104479f88009237503e3 --- .../rn-tester/js/components/RNTTestDetails.js | 103 ++++++++++++++++++ .../js/components/RNTesterModuleContainer.js | 59 +++++----- .../js/examples/Animated/FadeInViewExample.js | 3 + packages/rn-tester/js/types/RNTesterTypes.js | 2 + 4 files changed, 141 insertions(+), 26 deletions(-) create mode 100644 packages/rn-tester/js/components/RNTTestDetails.js diff --git a/packages/rn-tester/js/components/RNTTestDetails.js b/packages/rn-tester/js/components/RNTTestDetails.js new file mode 100644 index 00000000000..7e901c57b15 --- /dev/null +++ b/packages/rn-tester/js/components/RNTTestDetails.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +import * as React from 'react'; +import {View, Text, StyleSheet, Button} from 'react-native'; +import {type RNTesterTheme} from './RNTesterTheme'; + +function RNTTestDetails({ + test, + description, + expect, + title, + theme, +}: { + test?: string, + description?: string, + expect?: string, + title: string, + theme: RNTesterTheme, +}): React.Node { + const [collapsed, setCollapsed] = React.useState(false); + + const content = + test != null ? ( + <> + + How to Test + {test} + + {expect != null && ( + + Expectation + {expect} + + )} + + ) : description != null ? ( + + Description + {description} + + ) : null; + + return ( + + + + {title} + + {content != null && ( +