Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 27, 2019 01:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save IntegerMan/017c1f11802da7e25d41e885269abde3 to your computer and use it in GitHub Desktop.
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