[TestSuite] Show full test description on Test screen
This commit is contained in:
parent
619661e8f7
commit
591cf735d6
|
@ -51,33 +51,25 @@ class Test extends React.Component {
|
|||
setParams({ test });
|
||||
}
|
||||
|
||||
renderError() {
|
||||
const { test: { message } } = this.props;
|
||||
|
||||
if (message) {
|
||||
return (
|
||||
<ScrollView>
|
||||
<Text style={styles.codeHeader}>Test Error</Text>
|
||||
<Text style={styles.code}>
|
||||
<Text>{message}</Text>
|
||||
</Text>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const { test: { func, status, time } } = this.props;
|
||||
const { test: { message, description, func, status, time }, testContextName } = this.props;
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{Test.renderBanner({ status, time })}
|
||||
<View style={styles.content}>
|
||||
{this.renderError()}
|
||||
<Text style={styles.codeHeader}>Test Code Preview</Text>
|
||||
<View >
|
||||
<ScrollView>
|
||||
<Text style={styles.testLabel}>{testContextName}:</Text><Text style={styles.description}>{description}</Text>
|
||||
</ScrollView>
|
||||
<ScrollView>
|
||||
<Text style={styles.header}>Test Error</Text>
|
||||
<Text style={styles.code}>
|
||||
<Text>{message || 'None'}</Text>
|
||||
</Text>
|
||||
</ScrollView>
|
||||
<Text style={styles.header}>
|
||||
Test Code Preview
|
||||
</Text>
|
||||
<ScrollView>
|
||||
<Text style={styles.code}>
|
||||
{beautify(removeLastLine(removeFirstLine(func.toString())), { indent_size: 4, break_chained_methods: true })}
|
||||
|
@ -95,8 +87,11 @@ Test.propTypes = {
|
|||
time: PropTypes.number,
|
||||
message: PropTypes.string,
|
||||
func: PropTypes.function,
|
||||
description: PropTypes.string,
|
||||
}).isRequired,
|
||||
|
||||
testContextName: PropTypes.string,
|
||||
|
||||
navigation: PropTypes.shape({
|
||||
setParams: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
|
@ -107,27 +102,39 @@ const styles = StyleSheet.create({
|
|||
flex: 1,
|
||||
backgroundColor: '#ffffff',
|
||||
},
|
||||
content: {},
|
||||
code: {
|
||||
backgroundColor: '#3F373A',
|
||||
color: '#c3c3c3',
|
||||
padding: 5,
|
||||
fontSize: 12,
|
||||
},
|
||||
codeHeader: {
|
||||
header: {
|
||||
fontWeight: '600',
|
||||
fontSize: 18,
|
||||
backgroundColor: '#000',
|
||||
color: '#fff',
|
||||
padding: 5,
|
||||
},
|
||||
code: {
|
||||
backgroundColor: '#3F373A',
|
||||
color: '#c3c3c3',
|
||||
padding: 5,
|
||||
fontSize: 12,
|
||||
},
|
||||
description: {
|
||||
padding: 5,
|
||||
fontSize: 14,
|
||||
},
|
||||
testLabel: {
|
||||
fontWeight: '600',
|
||||
fontSize: 16
|
||||
}
|
||||
});
|
||||
|
||||
function select({ tests }, { navigation: { state: { params: { testId } } } }) {
|
||||
function select({ tests, testContexts }, { navigation: { state: { params: { testId } } } }) {
|
||||
const test = tests[testId];
|
||||
let testContext = testContexts[test.testContextId];
|
||||
|
||||
while(testContext.parentContextId && testContexts[testContext.parentContextId].parentContextId) {
|
||||
testContext = testContexts[testContext.parentContextId];
|
||||
}
|
||||
return {
|
||||
test,
|
||||
testContextName: testContext.name,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue