Skip to content

Instantly share code, notes, and snippets.

@IntegerMan IntegerMan/Logic3.js
Created Oct 27, 2019

Embed
What would you like to do?
function addTestCase() {
const textBox = document.getElementById('txtTestName');
const testCaseName = textBox.value;
if (testCaseName) {
const testCase = new TestCase(testCaseName, nextTestCaseId++);
testCases.push(testCase);
updateTestCases();
textBox.value = '';
} else {
alert('You must enter a test case name');
}
}
function passTestCase(id) {
const testcase = findTestCaseById(id);
testcase.isPassing = true;
updateTestCases();
}
function failTestCase(id) {
const testCase = findTestCaseById(id);
testcase.isPassing = false;
updateTestCases();
}
function deleteTestCase(id) {
const testcase = findTestCaseById(id);
const index = this.testCases.indexOf(testcase);
this.testCases.splice(index, 1);
updateTestCases();
}
function findTestCaseById(id) {
for (testcase of this.testCases) {
if (testcase.id === id) return testcase;
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.