Merge branch 'develop' of https://source.jalview.org/git/jalview.git into develop
[jalview.git] / examples / biojson-doc / tests / test.html
diff --git a/examples/biojson-doc/tests/test.html b/examples/biojson-doc/tests/test.html
new file mode 100755 (executable)
index 0000000..2cbbd50
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Docson Test</title>
+    <meta charset="utf-8">
+    <link rel="stylesheet" href="../css/docson.css">
+    <script src="../lib/require.js"></script></head>
+    <style>
+        body {
+            font-family: verdana, helvetica;
+        }
+    </style>
+</head>
+<body>
+<script charset="utf-8">
+    var tests = [ "invoice$Invoice", "enum", "schema","additionalProperties", "address", "fstab", "basic", "not", "oneOf", "anyOf", "allOf", "example2", "properties", "ref"]
+    require.config({ baseUrl: ".."});
+    require(["docson", "lib/jquery"], function(docson) {
+        docson.templateBaseUrl="../templates";
+        $(function() {
+            $.each(tests, function(k, test) {
+                var block = $("<div/>");
+                var segments = test.split("$");
+                $("body").append("<h2>"+segments[0]+"</h2>");
+                $("body").append(block);
+                $.get(segments[0]+".json").done(function(items) {
+                    $.each(items, function(k, item) {
+                        var element = $("<div/>");
+                        block.append(element);
+                        if(!item.schema.description) {
+                            item.schema.description = item.description;
+                        }
+                        docson.doc(element, item.schema, segments[1]);
+                    });
+                });
+            });
+        });
+    });
+</script>
+</body>
+</html>