List tests in test-suite index.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Sun, 07 Apr 2013 19:08:39 -0700
changeset 1567 d6eddedabe01
parent 1566 0fce3c4771d4
child 1568 6ddcd46bd552
List tests in test-suite index.
test-suite/config.ru
test-suite/index.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/config.ru	Sun Apr 07 19:08:39 2013 -0700
@@ -0,0 +1,15 @@
+#!/usr/bin/env rackup
+require 'sinatra'
+
+require 'sinatra/base'
+
+class MyApp < Sinatra::Base
+  set :static, true
+  set :root, File.expand_path("..", __FILE__)
+  set :public, File.expand_path("..", __FILE__)
+  get '/' do
+    "Hello World"
+  end
+end
+
+run MyApp
\ No newline at end of file
--- a/test-suite/index.html	Sun Apr 07 18:44:17 2013 -0700
+++ b/test-suite/index.html	Sun Apr 07 19:08:39 2013 -0700
@@ -5,8 +5,29 @@
   <title>JSON-LD - Test Suite</title>
   <link href="../site.css" rel="stylesheet" type="text/css" />
   <link rel="shortcut icon" href="../favicon.ico" />
+  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+  <script type="text/javascript" src="https://raw.github.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js"></script>
+  <script id="manifest" tile="application/ld+json" src="manifest.jsonld"></script>
+  <script id="manifest-template" type="text/x-handlebars-template">
+    <section>
+      <h3>{{name}}</h3>
+      <p>{{description}}</p>
+      <dl class="test-description">
+        {{#each sequence}}
+        <dt>Test {{number this}}: {{this.name}}</dt>
+        <dd>
+          {{#if this.purpose}}
+          <div>Purpose: {{this.purpose}}</div>
+          {{/if}}
+          <div>Test input: <a href="{{this.input}}">{{this.input}}</a></div>
+          <div>Expected output: <a href="{{this.input}}">{{this.input}}</a></div>
+        </dd>
+        {{/each}}
+      </dl>
+    </section>
+  </script>
 </head>
-<body>
+<body onload="load_manifests();">
   <div id="container">
      <div id="header">
         <span class="col">
@@ -81,5 +102,23 @@
         long-term goal of having a comprehensive test suite for JSON-LD can be achieved
         by the JSON-LD community.</p>
 </div></div></div>
+<div id="manifests" class="container">
+  <h2>Test Manifests</h2>
+</div>
 </body>
+<script type="text/javascript">
+function load_manifests() {
+  Handlebars.registerHelper('number', function(that) {
+    return that['@id'].substring(2);
+  });
+  var man_tmpl = Handlebars.compile($("#manifest-template").html());
+  $.getJSON($("#manifest").attr("src"), null, function(data, status) {
+    data.sequence.forEach(function(man) {
+      $.getJSON(man, null, function(data, status) {
+        $("#manifests").append($(man_tmpl(data)));
+      });
+    });
+  });
+}
+</script>
 </html>