diff --git a/src/components/common/Menu.js b/src/components/common/Menu.js index 93fa21d..e91332f 100644 --- a/src/components/common/Menu.js +++ b/src/components/common/Menu.js @@ -3,13 +3,12 @@ import Tooltip from '@material-ui/core/Tooltip'; import HelpIcon from '@material-ui/icons/Help'; import './Menu.scss' -const Menu = ({ title = "", description=[], onChange = (e) => console.log(e), entries = [] }) => { - console.log(description) - +const Menu = ({ title = "", description=[], onChange=(e) => console.log(e), entries = [] }) => { let tooltip = description.length === 0 ? null : ( - { - description.map(line => (
{line}
))} + description.map((line, index) => (
{line}
))} }>
@@ -21,7 +20,7 @@ const Menu = ({ title = "", description=[], onChange = (e) => console.log(e), en diff --git a/src/components/filters/test_filters.js b/src/components/filters/test_filters.js index f56518e..7e69e3f 100644 --- a/src/components/filters/test_filters.js +++ b/src/components/filters/test_filters.js @@ -44,11 +44,11 @@ export function filter_by_test_passed(current_state, all_data, value) { let new_state; switch (value) { - case 1: // Present only passing methods + case TEST_RESULT.PASS: console.info(`Filter all test methods that fail Index: ${value}, was chosen.`); new_state = test_filter(current_state, (edge) => edge.test_result) break; - case 2: // Present only failing methods + case TEST_RESULT.FAIL: console.info(`Filter all test methods that pass Index: ${value}, was chosen.`); new_state = test_filter(current_state, (edge) => !edge.test_result) break; @@ -165,3 +165,8 @@ export const TEST_TYPES = { INTEGRATION: 'Integration', SYSTEM: 'System', } + +export const TEST_RESULT = { + PASS: 'Only Pass', + FAIL: 'Only Fail' +} diff --git a/src/components/routes/TestMatrixView.js b/src/components/routes/TestMatrixView.js index 63e7b79..72e60d0 100644 --- a/src/components/routes/TestMatrixView.js +++ b/src/components/routes/TestMatrixView.js @@ -21,7 +21,7 @@ import ResultTextBox from '../common/ResultTextBox'; import './TestMatrixView.scss'; // Filter functions -import { filter_by_num_method_covered, filter_by_test_passed, filter_by_coexecuted_tests, filter_by_test_type, TEST_TYPES} from '../filters/test_filters'; +import { filter_by_num_method_covered, filter_by_test_passed, filter_by_coexecuted_tests, filter_by_test_type, TEST_TYPES, TEST_RESULT} from '../filters/test_filters'; import { filter_method_by_number_of_times_tested, filter_by_coexecuted_methods } from '../filters/method_filters'; import { process_data, FunctionMap } from '../filters/data_processor'; @@ -79,7 +79,7 @@ class TestMatrixView extends Component { return await json(`${API_ROOT}/commits/${project_name}`) .then(response => { let commits = response.commits.map(commit => { - return { value: commit.sha, display: commit.sha } + return { key: commit.id, value: commit.sha, display: commit.sha } }); return commits; }) @@ -89,7 +89,7 @@ class TestMatrixView extends Component { return await json(`${API_ROOT}/projects`) .then(response => { let projects = response.projects.map(project => { - return { value: project.project_name, display: project.project_name } + return { key: project.id, value: project.project_name}; }); return projects; @@ -222,9 +222,7 @@ class TestMatrixView extends Component { "- System: Only tests that cover methods across multiple packages." ]} onChange={(event) => { - const test_type = event.target.value; - console.log(event.target) let new_filter_map = new FunctionMap(current_filter_map); new_filter_map.add_function("filter_by_test_type", filter_by_test_type, test_type) @@ -233,17 +231,17 @@ class TestMatrixView extends Component { }) }} /> { - const index = parseInt(event.target.value); + onChange={(event, index) => { + const test_result = event.target.value; let new_filter_map = new FunctionMap(current_filter_map); - new_filter_map.add_function("filter_by_test_passed", filter_by_test_passed, index) + new_filter_map.add_function("filter_by_test_passed", filter_by_test_passed, test_result) this.setState({ history: this.state.history.concat(new_filter_map)