-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
86 lines (76 loc) · 2.99 KB
/
test.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
<html>
<head>
<title>YQL: Unit Tests</title>
<link rel="stylesheet" href="assets/style.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8" src="assets/uri.js"></script>
<script type="text/javascript" charset="utf-8" src="assets/yql.js"></script>
<script type="text/javascript" charset="utf-8" src="assets/yql_test.js"></script>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
</head>
<body>
<div id="head">
<a href="http://prototype.corp.yahoo.com" id="logo">Yahoo! Prototyping</a>
<h1>YQL: Unit Tests</h1>
</div>
<div id="body" style="overflow:auto;">
<div id="top">
<form method="GET">
<input type="text" value="" name="host" id="host" style="width:175px; background:Silver;" />
Env: <input type="text" value="" name="env" id="env" style="width:300px" />
<button>Get Tables</button>
</form>
</div>
<div id="meat">
<div id="yqlTables">
<p>Click on a table name to run tests for that table.</p>
<ul></ul>
<small>Click "Get Tables" above to load the tables for a YQL env</small>
</div>
<div id="tests"></div>
</div>
</div>
</body>
<script type="text/javascript" charset="utf-8">
function getTables(){
YQL._env = $('#env').val();
YQL._host = $('#host').val() || YQL._host;
// Query YQL for all of the tables in the environment, then
// display them on the page
YQL.query('use "http://fightinjoe.com/yql_test/yql.scrapeEnv.xml" as t; select * from t where file="'+YQL._env+'"', function(data){
var tables = data.query.results.table,
tablesElt = $('#yqlTables ul');
// if there is only one table, wrap it in an array
if(!tables.length) tables = [tables];
for(var i=0;i<tables.length;i++) {
var link = $('<a href="#" tableName="'+tables[i].content+'">'+ tables[i].content +'</a>');
link.click(function(){
var table = $(this).attr('tableName');
YQLTests.runTestsForTable(table);
uri.anchor = uri.anchor ? uri.anchor+','+table : table;
document.location.href = uri.to_s();
return false;
});
tablesElt.append(link); link.wrap('<li />');
}
});
}
var uri;
jQuery(document).ready(function(){
// load the tables if there is an ?env present
uri = new URI(document.location.href); uri.params = uri.queryParams();
YQL._host = uri.params.host || YQL._host;
YQL._env = uri.params.env || 'http://fightinjoe.com/yql_test/tables.env';
jQuery('#env').val( YQL._env ); jQuery('#host').val( YQL._host );
if(uri.params.env) {
getTables();
if(uri.anchor) {
var anchors = uri.anchor.split(',')
for(var anchor in anchors) {
anchor = unescape(anchors[anchor]);
YQLTests.runTestsForTable(anchor);
}
}
}
});
</script>
</html>