Created
October 27, 2019 01:53
-
-
Save IntegerMan/017c1f11802da7e25d41e885269abde3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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