-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrunfunctions.js
114 lines (95 loc) · 4.25 KB
/
runfunctions.js
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
testresults = new Array();
cTestname = 0;
cTitle = 1;
cFlags = 2;
cRef = 3;
cAssert = 4;
_browsertype = '';
function setTest (newptr, base) {
// sets up the runner page to display a test
// newptr, integer, points into tests array index
ptr = newptr;
document.getElementById('selector').value = ptr;
document.getElementById('testframe').src = base+'/'+tests[newptr][cTestname];
document.getElementById('title').innerHTML = tests[newptr][cTitle];
var flags = tests[newptr][cFlags].split(' ');
var flagoutput = '';
for (var f=0;f<flags.length;f++) {
switch (flags[f]) {
case 'http': flagoutput += '<li>HTTP headers.</li>'; break;
case 'dom': flagoutput += '<li>JavaScript and the DOM.</li>'; break;
case 'font': flagoutput += '<li>A specific font.</li>'; break;
case ':lang': flagoutput += '<li>CSS :lang support.</li>'; break;
case 'lang|=': flagoutput += '<li>CSS lang|= support.</li>'; break;
case 'start': flagoutput += '<li>Support for start attribute.</li>'; break;
}
}
if (flagoutput != '') {
document.getElementById('prerequisites').innerHTML = 'Requires: <ul>'+flagoutput+'</ul>';
document.getElementById('prerequisites').style.borderTopColor = 'orange';
document.getElementById('prerequisites').style.borderBottomColor = 'orange';
}
else {
document.getElementById('prerequisites').innerHTML = '';
document.getElementById('prerequisites').style.borderTopColor = 'white';
document.getElementById('prerequisites').style.borderBottomColor = 'white';
}
document.getElementById('speclink').href = tests[newptr][cRef];
document.getElementById('assertion').innerHTML = tests[newptr][cAssert];
if (testresults[tests[newptr][cTestname]] && testresults[tests[newptr][cTestname]][0].status) document.getElementById('status').className = testresults[tests[newptr][cTestname]][0].status
else document.getElementById('status').className = ''
if (testresults[tests[newptr][cTestname]] && testresults[tests[newptr][cTestname]][0].notes) document.getElementById('notes').value = testresults[tests[newptr][cTestname]][0].notes
else document.getElementById('notes').value = ''
//document.getElementById('detailedresults').href = 'http://w3c-test.org/framework/details/'+base+'/'+tests[newptr][0];
}
function getNotes () {
var notes = document.getElementById('notes').value
if (typeof notes === 'undefined') notes = ''
document.getElementById('notes').value = ''
return notes
}
function adddata (testname, result, notes) {
var currentdate = new Date();
var datetime = currentdate.getDate() + "-"
+ (currentdate.getMonth()+1) + "-"
+ currentdate.getFullYear() + " "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
if (testresults[testname] ) {
//testresults[testname][testresults[testname].length] = { browser: _browsertype, status: result, ua: navigator.userAgent, date: datetime, 'notes':notes }
testresults[testname][0] = { browser: _browsertype, status: result, ua: navigator.userAgent, date: datetime, 'notes':notes }
}
else {
testresults[testname] = new Array();
testresults[testname][testresults[testname].length] = { browser: _browsertype, status: result, ua: navigator.userAgent, date: datetime, 'notes':notes }
}
}
function setUpScoring () {
document.getElementById('scoring').style.display = "block";
document.getElementById('resultsButton').style.display = "block";
document.getElementById('notes').style.display = "block";
}
function dump () {
var out = 'var newresults = {\n\n'; tfirst = true;
for (var t in testresults) {
if (! tfirst) { out += ',\n'; } else { out += '\n'; tfirst = false; }
out += "'"+t+"': [";
rfirst = true;
for (r=0;r<testresults[t].length;r++) {
if (! rfirst) { out += ', '; } else { rfirst = false; }
out += '\n\t{';
ifirst = true;
for (i in testresults[t][r]) {
if (! ifirst) { out += ', '; } else { ifirst = false; }
out += i+':' + "'"+testresults[t][r][i]+"'";
}
out += ' }';
}
out += "\n\t]";
}
document.getElementById('testdetail').value = out+'\n}';
document.getElementById('testdetail').style.display = 'block';
document.getElementById('testdetail').focus();
document.getElementById('testdetail').select();
}