From 744e70e4d243c09d9d969ec3f915a278abe9457d Mon Sep 17 00:00:00 2001
From: Rachel Fenichel
Date: Mon, 12 Feb 2018 17:12:52 -0800
Subject: [PATCH] Split playground toolbox XML into typed and untyped examples.
---
tests/playground.html | 358 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 355 insertions(+), 3 deletions(-)
diff --git a/tests/playground.html b/tests/playground.html
index 8e63815ea..fb7859587 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -77,7 +77,7 @@ function start() {
document.forms.options.elements.dir.selectedIndex = Number(rtl);
var toolbox = getToolboxElement();
document.forms.options.elements.toolbox.selectedIndex =
- Number(toolbox.getElementsByTagName('category').length == 0);
+ getToolboxFormIndex(toolbox.id);
match = location.search.match(/side=([^&]+)/);
var side = match ? match[1] : 'start';
document.forms.options.elements.side.value = side;
@@ -137,7 +137,24 @@ function setBackgroundColor() {
function getToolboxElement() {
var match = location.search.match(/toolbox=([^&]+)/);
- return document.getElementById('toolbox-' + (match ? match[1] : 'categories'));
+ // Default to the basic toolbox with categories and untyped variables,
+ // but override that if the toolbox type is set in the URL.
+ var toolboxSuffix = (match ? match[1] : 'categories');
+ // The three possible values are: "simple", "categories",
+ // "categories-typed-variables".
+ return document.getElementById('toolbox-' + toolboxSuffix);
+}
+
+function getToolboxFormIndex(id) {
+ if (id == 'toolbox-categories') {
+ return 0;
+ } else if (id == 'toolbox-categories-typed-variables') {
+ return 1;
+ } else if (id == 'toolbox-simple') {
+ return 2;
+ }
+ // Didn't recognize it.
+ return 0;
}
function toXml() {
@@ -301,7 +318,8 @@ h1 {
+
+
+
@@ -367,6 +390,9 @@ h1 {
+
@@ -688,6 +714,332 @@ h1 {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ 10
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+
+
+ 9
+
+
+
+
+
+
+ 45
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+ 3.1
+
+
+
+
+
+
+
+ 64
+
+
+
+
+ 10
+
+
+
+
+
+
+ 50
+
+
+
+
+ 1
+
+
+
+
+ 100
+
+
+
+
+
+
+ 1
+
+
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text
+
+
+
+
+ abc
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ ,
+
+
+
+
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+ 50
+
+
+
+
+ 0
+
+
+
+
+
+
+ #ff0000
+
+
+
+
+ #3333ff
+
+
+
+
+ 0.5
+
+
+
+
+