-
Notifications
You must be signed in to change notification settings - Fork 10
/
git_github_spike.html
93 lines (72 loc) · 2.24 KB
/
git_github_spike.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!doctype html>
<html>
<head>
<title>Git/GitHub Spike</title>
<script>
var classMembers = new Array();
var testThis = "Test global variable. <br />\n";
function testAndShowResults()
{
var testFailed = false;
// STEP 1: ADD YOUR NAME TO EXPECTED RESULTS.
// RUN PROGRAM, WHICH SHOULD REPORT THAT TEST FAILED.
var expectedResults = new Array();
expectedResults.push("Alyce Brady");
// EXAMPLE: expectedResults.push("Charlie Brown");
for ( var i = 0; i < expectedResults.length; i++ )
{
if ( classMembers.indexOf(expectedResults[i]) == -1 )
{
testFailed = true;
}
}
var resultArea = document.getElementById("testResults");
resultArea.innerHTML += "Test " +
( testFailed ? "Failed" : "Succeeded" ) + "\n";
var expectedResultsArea = document.getElementById("expectedResults");
for ( var i = 0; i < expectedResults.length; i++ )
{
expectedResultsArea.innerHTML += expectedResults[i] + "<br />\n";
}
var actualResultsArea = document.getElementById("actualResults");
for ( var i = 0; i < classMembers.length; i++ )
{
actualResultsArea.innerHTML += classMembers[i] + "<br />\n";
}
}
function init_classMembers()
{
// STEP 2: ADD YOUR NAME TO CLASS MEMBERS ARRAY.
// RUN PROGRAM, WHICH SHOULD REPORT THAT TEST SUCCEEDED.
classMembers.push("Alyce Brady");
}
</script>
</head>
<body onload="init_classMembers()">
<h1>Git / GitHub Spike</h1>
<p>
<i>Note: this spike uses the JavaScript <span
class="code">indexOf</span> function for arrays, which is not
supported in Internet Explorer 8 and earlier according to
<a href="http://www.w3schools.com/jsref/jsref_indexof_array.asp">W3
Schools</a>.</i>
</p>
<form>
<p>
<input type="button" name="test" value="Run Test"
onclick="testAndShowResults();" />
</p>
</form>
<p id="testResults">
<strong>Test Results:</strong>
</p>
<blockquote>
<table>
<tr><th>Expected Results</th> <th width="10%"> </th>
<th>Actual Results</th></tr>
<tr><td id="expectedResults" valign="top"></td> <td> </td>
<td id="actualResults" valign="top"></td></tr>
</table>
</blockquote>
</body>
</html>