зеркало из https://github.com/mozilla/gecko-dev.git
Bug 378893, actully add the xul template test files
This commit is contained in:
Родитель
5c40400d76
Коммит
13f2fd1f72
|
@ -0,0 +1,224 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:NC="http://home.netscape.com/NC-rdf#"
|
||||
xmlns:ANIMALS="http://www.some-fictitious-zoo.com/rdf#">
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<ANIMALS:name>Arachnids</ANIMALS:name>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/arachnids/tarantula" ANIMALS:specimens="3">
|
||||
<ANIMALS:name>Tarantula</ANIMALS:name>
|
||||
<ANIMALS:species>Avicularia avicularia</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/birds">
|
||||
<ANIMALS:name>Birds</ANIMALS:name>
|
||||
<ANIMALS:keeper resource="http://www.some-fictitious-zoo.com/humans/sarah"/>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/birds/emu" ANIMALS:specimens="12">
|
||||
<ANIMALS:name>Emu</ANIMALS:name>
|
||||
<ANIMALS:species>Dromaius novaehollandiae</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/birds/barnowl" ANIMALS:specimens="4">
|
||||
<ANIMALS:name>Barn Owl</ANIMALS:name>
|
||||
<ANIMALS:species>Tyto alba</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/birds/raven" ANIMALS:specimens="0">
|
||||
<ANIMALS:name>Raven</ANIMALS:name>
|
||||
<ANIMALS:species>Corvus corax</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/crustaceans">
|
||||
<ANIMALS:name>Crustaceans</ANIMALS:name>
|
||||
<ANIMALS:keeper resource="http://www.some-fictitious-zoo.com/humans/robert"/>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/fish">
|
||||
<ANIMALS:name>Fish</ANIMALS:name>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/fish/cod" ANIMALS:specimens="0">
|
||||
<ANIMALS:name>Cod</ANIMALS:name>
|
||||
<ANIMALS:species>Gadus morhua</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/fish/swordfish" ANIMALS:specimens="3">
|
||||
<ANIMALS:name>Swordfish</ANIMALS:name>
|
||||
<ANIMALS:species>Xiphias gladius</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/mammals">
|
||||
<ANIMALS:name>Mammals</ANIMALS:name>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/lion">
|
||||
<ANIMALS:name>Lion</ANIMALS:name>
|
||||
<ANIMALS:species>Panthera leo</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">4</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>4</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/hippopotamus">
|
||||
<ANIMALS:name>HIPPOPOTAMUS</ANIMALS:name>
|
||||
<ANIMALS:species>Hippopotamus amphibius</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">2</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>2</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/africanelephant">
|
||||
<ANIMALS:name>African Elephant</ANIMALS:name>
|
||||
<ANIMALS:species>Loxodonta africana</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">14</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>14</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/llama">
|
||||
<ANIMALS:name>LLAMA</ANIMALS:name>
|
||||
<ANIMALS:species>Lama glama</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">5</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>5</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/polarbear">
|
||||
<ANIMALS:name>Polar Bear</ANIMALS:name>
|
||||
<ANIMALS:species>Thalarctos maritimus</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">20</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>20</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/aardvark">
|
||||
<ANIMALS:name>aardvark</ANIMALS:name>
|
||||
<ANIMALS:species>Orycteropus afer</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">2</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>2</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">
|
||||
<ANIMALS:name>Nine-banded Armadillo</ANIMALS:name>
|
||||
<ANIMALS:species>Dasypus novemcinctus</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">1</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>1</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/mammals/gorilla">
|
||||
<ANIMALS:name>Gorilla</ANIMALS:name>
|
||||
<ANIMALS:species>Gorilla gorilla</ANIMALS:species>
|
||||
<ANIMALS:specimens NC:parseType="Integer">7</ANIMALS:specimens>
|
||||
<ANIMALS:specimensAsString>7</ANIMALS:specimensAsString>
|
||||
</RDF:Description>
|
||||
|
||||
<ANIMALS:Class RDF:about="http://www.some-fictitious-zoo.com/reptiles">
|
||||
<ANIMALS:name>Reptiles</ANIMALS:name>
|
||||
<ANIMALS:keeper resource="http://www.some-fictitious-zoo.com/humans/robert"/>
|
||||
</ANIMALS:Class>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/reptiles/anaconda" ANIMALS:specimens="1">
|
||||
<ANIMALS:name>Anaconda</ANIMALS:name>
|
||||
<ANIMALS:species>Eunectes murinus</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/reptiles/chameleon" ANIMALS:specimens="2">
|
||||
<ANIMALS:name>Chameleon</ANIMALS:name>
|
||||
<ANIMALS:species>Chamaeleo chamaelon</ANIMALS:species>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/some-animals" ANIMALS:name="Zoo Animals">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/arachnids"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/all-animals" ANIMALS:name="Zoo Animals">
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
|
||||
</RDF:Seq>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/birds">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/emu"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/barnowl"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/raven"/>
|
||||
</RDF:Seq>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/crustaceans"/>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/fish">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/fish/cod"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/fish/swordfish"/>
|
||||
</RDF:Seq>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/mammals">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/lion"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/hippopotamus"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/africanelephant"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/llama"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/polarbear"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/aardvark"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/gorilla"/>
|
||||
</RDF:Seq>
|
||||
</RDF:li>
|
||||
<RDF:li>
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/reptiles">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/reptiles/anaconda"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/reptiles/chameleon"/>
|
||||
</RDF:Seq>
|
||||
</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/humans" ANIMALS:name="Humans">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/humans/sarah"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/humans/robert"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/sarahs-pets" ANIMALS:name="Sarah's Pets">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/emu"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/roberts-pets" ANIMALS:name="Robert's Pets">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/reptiles/chameleon"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/llama"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/humans/sarah" ANIMALS:name="Sarah">
|
||||
<ANIMALS:pets resource="http://www.some-fictitious-zoo.com/sarahs-pets"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/birds/emu"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/mammals/polarbear"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
|
||||
<ANIMALS:description>
|
||||
Sarah became caretaker of the Fictitious Zoo's emu exhibit in 2001. With so
|
||||
many emus living there, she has a lot to do!
|
||||
</ANIMALS:description>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description RDF:about="http://www.some-fictitious-zoo.com/humans/robert" ANIMALS:name="Robert">
|
||||
<ANIMALS:pets resource="http://www.some-fictitious-zoo.com/roberts-pets"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/reptiles/anaconda"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/reptiles/chameleon"/>
|
||||
<ANIMALS:favoriteAnimal resource="http://www.some-fictitious-zoo.com/mammals/africanelephant"/>
|
||||
<ANIMALS:description>
|
||||
Robert helps visitors to the Fictitious Zoo's reptile pavilion learn
|
||||
more about some of the more unusual creatures that live there.
|
||||
</ANIMALS:description>
|
||||
<ANIMALS:lastName>Sanderson</ANIMALS:lastName>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/marked" ANIMALS:name="Marked">
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/humans/sarah"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/crustaceans"/>
|
||||
<RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/emu"/>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
Двоичный файл не отображается.
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<zoo>
|
||||
<class>
|
||||
<name>Reptiles</name>
|
||||
<species id="Chamaeleo chamaelon" name="Chameleon" specimens="2"/>
|
||||
</class>
|
||||
<class>
|
||||
<name>Birds</name>
|
||||
<species id="Dromaius novaehollandiae" name="Emu" specimens="12"/>
|
||||
<species id="Tyto alba" name="Barn Owl" specimens="4"/>
|
||||
<species id="Corvus corax" name="Raven" specimens="0"/>
|
||||
<location>Aviary</location>
|
||||
</class>
|
||||
</zoo>
|
|
@ -0,0 +1,390 @@
|
|||
/**
|
||||
* This script is used for testing XUL templates. Call test_template within
|
||||
* a load event handler.
|
||||
*
|
||||
* A test should have a root node with the datasources attribute with the
|
||||
* id 'root', and a few global variables defined in the test's XUL file:
|
||||
*
|
||||
* testid: the testid, used when outputting test results
|
||||
* expectedOutput: e4x data containing the expected output. It can optionally
|
||||
* be enclosed in an <output> element as most tests generate
|
||||
* more than one node of output.
|
||||
* isTreeBuilder: true for dont-build-content trees, false otherwise
|
||||
* queryType: 'rdf', 'xml', etc.
|
||||
* needsOpen: true for menu tests where the root menu must be opened before
|
||||
* comparing results
|
||||
* notWorkingYet: true if this test isn't working yet, outputs todo results
|
||||
* notWorkingYetDynamic: true if the dynamic changes portion of the test
|
||||
* isn't working yet, outputs todo results
|
||||
* changes: an array of functions to perform in sequence to test dynamic changes
|
||||
* to the datasource.
|
||||
*
|
||||
* If the <output> element has an unordered attribute set to true, the
|
||||
* children within it must all appear to match, but may appear in any order.
|
||||
* If the unordered attribute is not set, the children must appear in the same
|
||||
* order.
|
||||
*
|
||||
* If the 'changes' array is used, it should be an array of functions. Each
|
||||
* function will be called in order and a comparison of the output will be
|
||||
* performed. This allows changes to be made to the datasource to ensure that
|
||||
* the generated template output has been updated. Within the expected output
|
||||
* e4x data, the step attribute may be set to a number on an element to
|
||||
* indicate that an element only applies before or after a particular change.
|
||||
* If step is set to a positive number, that element will only exist after
|
||||
* that step in the list of changes made. If step is set to a negative number,
|
||||
* that element will only exist until that step. Steps are numbered starting
|
||||
* at 1. For example:
|
||||
* <label value="Cat"/>
|
||||
* <label step="2" value="Dog"/>
|
||||
* <label step="-5" value="Mouse"/>
|
||||
* The first element will always exist. The second element will only appear
|
||||
* after the second change is made. The third element will only appear until
|
||||
* the fifth change and it will no longer be present at later steps.
|
||||
*
|
||||
* If the anyid attribute is set to true on an element in the expected output,
|
||||
* then the value of the id attribute on that element is not compared for a
|
||||
* match. This is used, for example, for xml datasources, where the ids set on
|
||||
* the generated output are pseudo-random.
|
||||
*/
|
||||
|
||||
const ZOO_NS = "http://www.some-fictitious-zoo.com/";
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const debug = false;
|
||||
|
||||
try {
|
||||
const RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
const ContainerUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].
|
||||
getService(Components.interfaces.nsIRDFContainerUtils);
|
||||
} catch(ex) { }
|
||||
|
||||
function test_template()
|
||||
{
|
||||
var root = document.getElementById("root");
|
||||
|
||||
var ds;
|
||||
if (queryType == "rdf" && RDF) {
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var baseURI = ioService.newURI(document.location, null, null);
|
||||
baseURI = baseURI.resolve(root.getAttribute("datasources"));
|
||||
var newuri = ioService.newURI(baseURI, null, null).spec;
|
||||
ds = RDF.GetDataSourceBlocking(newuri);
|
||||
}
|
||||
|
||||
// open menus if necessary
|
||||
if (needsOpen)
|
||||
root.open = true;
|
||||
|
||||
checkResults(root, 0);
|
||||
|
||||
if (changes.length) {
|
||||
var usedds = ds;
|
||||
// within these chrome tests, RDF datasources won't be modifiable unless
|
||||
// an in-memory datasource is used instead. Call copyRDFDataSource to
|
||||
// copy the datasource.
|
||||
if (queryType == "rdf")
|
||||
usedds = copyRDFDataSource(root, ds);
|
||||
if (needsOpen)
|
||||
root.open = true;
|
||||
setTimeout(iterateChanged, 0, root, usedds);
|
||||
}
|
||||
else {
|
||||
if (needsOpen)
|
||||
root.open = false;
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function iterateChanged(root, ds)
|
||||
{
|
||||
for (var c = 0; c < changes.length; c++) {
|
||||
changes[c](ds, root);
|
||||
checkResults(root, c + 1);
|
||||
}
|
||||
|
||||
if (needsOpen)
|
||||
root.open = false;
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function checkResults(root, step)
|
||||
{
|
||||
var output = expectedOutput.copy();
|
||||
setForCurrentStep(output, step);
|
||||
|
||||
var error;
|
||||
var actualoutput = root;
|
||||
if (isTreeBuilder) {
|
||||
// convert the tree's view data into the equivalent DOM structure
|
||||
// for easier comparison
|
||||
actualoutput = treeViewToDOM(root);
|
||||
error = compareOutput(actualoutput, output.treechildren, false);
|
||||
}
|
||||
else {
|
||||
error = compareOutput(actualoutput, output, true);
|
||||
}
|
||||
|
||||
var adjtestid = testid;
|
||||
if (step > 0)
|
||||
adjtestid += " dynamic step " + step;
|
||||
|
||||
if (debug) {
|
||||
// for debugging, serialize the XML output
|
||||
var serializedXML = "";
|
||||
var rootNodes = actualoutput.childNodes;
|
||||
for (var n = 0; n < rootNodes.length; n++) {
|
||||
var node = rootNodes[n];
|
||||
if (node.localName != "template")
|
||||
serializedXML += ((new XMLSerializer()).serializeToString(node));
|
||||
}
|
||||
|
||||
// remove the XUL namespace declarations to make the output more readable
|
||||
const nsrepl = new RegExp("xmlns=\"" + XUL_NS + "\" ", "g");
|
||||
dump("-------- " + adjtestid + " " + error + ":\n" +
|
||||
serializedXML.replace(nsrepl, "") + "\n");
|
||||
}
|
||||
|
||||
if ((step == 0 && notWorkingYet) || (step > 0 && notWorkingYetDynamic))
|
||||
todo(false, adjtestid);
|
||||
else
|
||||
ok(!error, adjtestid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the expected output to acccount for any step attributes.
|
||||
*/
|
||||
function setForCurrentStep(content, currentStep)
|
||||
{
|
||||
var todelete = [];
|
||||
for each (var child in content) {
|
||||
var stepstr = child.@step.toString();
|
||||
var stepsarr = stepstr.split(",");
|
||||
for (var s = 0; s < stepsarr.length; s++) {
|
||||
var step = parseInt(stepsarr[s]);
|
||||
if ((step > 0 && step > currentStep) ||
|
||||
(step < 0 && -step <= currentStep)) {
|
||||
todelete.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete node using this bizarre syntax, because e4x has a non-sensical api
|
||||
for (var d = 0; d < todelete.length; d++)
|
||||
delete content.*[todelete[d].childIndex()];
|
||||
|
||||
for each (var child in content) {
|
||||
delete child.@step;
|
||||
setForCurrentStep(child, currentStep);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the 'actual' DOM output with the 'expected' output. This function
|
||||
* is called recursively, with isroot true if actual refers to the root of the
|
||||
* template. Returns a null string if they are equal and an error string if
|
||||
* they are not equal. This function is called recursively as it iterates
|
||||
* through each node in the DOM tree.
|
||||
*/
|
||||
function compareOutput(actual, expected, isroot)
|
||||
{
|
||||
// The expected output may be enclosed in an <output> element if it contains
|
||||
// several nodes. However, the <output> element may be omitted if there is
|
||||
// only one node.
|
||||
if (expected.localName() != "output" && isroot) {
|
||||
// If there is no <output> element then only one node should have been
|
||||
// generated by the template. The number of children should be one
|
||||
// <template> node and one generated node.
|
||||
if (actual.childNodes.length != 2)
|
||||
return "incorrect child node count of root " +
|
||||
(actual.childNodes.length - 1) + " expected 1";
|
||||
return compareOutput(actual.lastChild, expected, false);
|
||||
}
|
||||
|
||||
var t;
|
||||
|
||||
// compare text nodes
|
||||
if (expected.nodeKind() == "text") {
|
||||
if (actual.nodeValue != expected.toString())
|
||||
return "Text " + actual.nodeValue + " doesn't match " + expected.toString();
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!isroot) {
|
||||
var anyid = false;
|
||||
// make sure that the tags match
|
||||
if (actual.localName != expected.localName())
|
||||
return "Tag name " + expected.localName() + " not found";
|
||||
|
||||
// loop through the attributes in the expected node and compare their
|
||||
// values with the corresponding attribute on the actual node
|
||||
|
||||
var expectedAttrs = expected.attributes();
|
||||
for (var a = 0; a < expectedAttrs.length(); a++) {
|
||||
var attr = expectedAttrs[a];
|
||||
expectedAttrs.length(); // not having this causes a script error
|
||||
var expectval = "" + attr;
|
||||
// skip checking the id when anyid="true", however make sure to
|
||||
// ensure that the id is actually present.
|
||||
if (attr.name() == "anyid" && expectval == "true") {
|
||||
anyid = true;
|
||||
if (!actual.hasAttribute("id"))
|
||||
return "expected id attribute";
|
||||
}
|
||||
else if (actual.getAttribute(attr.name()) != expectval) {
|
||||
return "attribute " + attr.name() + " is '" +
|
||||
actual.getAttribute(attr.name()) + "' instead of '" + expectval + "'";
|
||||
}
|
||||
}
|
||||
|
||||
// now loop through the actual attributes and make sure that there aren't
|
||||
// any extra attributes that weren't expected
|
||||
var length = actual.attributes.length;
|
||||
for (t = 0; t < length; t++) {
|
||||
var aattr = actual.attributes[t];
|
||||
var expectval = "" + expected.@[aattr.name];
|
||||
// ignore some attributes that don't matter
|
||||
if (expectval != actual.getAttribute(aattr.name) &&
|
||||
aattr.name != "staticHint" && aattr.name != "xmlns" &&
|
||||
(aattr.name != "id" || !anyid))
|
||||
return "extra attribute " + aattr.name;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that the node has the right number of children. Subtract one for
|
||||
// the root node to account for the <template> node.
|
||||
length = actual.childNodes.length - (isroot ? 1 : 0);
|
||||
if (length != expected.children().length())
|
||||
return "incorrect child node count of " + actual.localName + " " + length +
|
||||
" expected " + expected.children().length();
|
||||
|
||||
// if <output unordered="true"> is used, then the child nodes may be in any order
|
||||
var unordered = (expected.localName() == "output" && expected.@unordered == "true");
|
||||
|
||||
// next, loop over the children and call compareOutput recursively on each one
|
||||
var adj = 0;
|
||||
for (t = 0; t < actual.childNodes.length; t++) {
|
||||
var actualnode = actual.childNodes[t];
|
||||
// skip the <template> element, and add one to the indices when looking
|
||||
// at the later nodes to account for it
|
||||
if (isroot && actualnode.localName == "template") {
|
||||
adj++;
|
||||
}
|
||||
else {
|
||||
var output = "unexpected";
|
||||
if (unordered) {
|
||||
var expectedChildren = expected.children();
|
||||
for (var e = 0; e < expectedChildren.length(); e++) {
|
||||
output = compareOutput(actualnode, expectedChildren[e], false);
|
||||
if (!output)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
output = compareOutput(actualnode, expected.children()[t - adj], false);
|
||||
}
|
||||
|
||||
// an error was returned, so return early
|
||||
if (output)
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
* copy the datasource into an in-memory datasource so that it can be modified
|
||||
*/
|
||||
function copyRDFDataSource(root, sourceds)
|
||||
{
|
||||
var sourceds;
|
||||
var dsourcesArr = [];
|
||||
var composite = root.database;
|
||||
var dsources = composite.GetDataSources();
|
||||
while (dsources.hasMoreElements()) {
|
||||
sourceds = dsources.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
dsourcesArr.push(sourceds);
|
||||
}
|
||||
|
||||
for (var d = 0; d < dsourcesArr.length; d++)
|
||||
composite.RemoveDataSource(dsourcesArr[d]);
|
||||
|
||||
var newds = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].
|
||||
createInstance(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
var sourcelist = sourceds.GetAllResources();
|
||||
while (sourcelist.hasMoreElements()) {
|
||||
var source = sourcelist.getNext();
|
||||
var props = sourceds.ArcLabelsOut(source);
|
||||
while (props.hasMoreElements()) {
|
||||
var prop = props.getNext();
|
||||
if (prop instanceof Components.interfaces.nsIRDFResource) {
|
||||
var targets = sourceds.GetTargets(source, prop, true);
|
||||
while (targets.hasMoreElements())
|
||||
newds.Assert(source, prop, targets.getNext(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
composite.AddDataSource(newds);
|
||||
root.builder.rebuild();
|
||||
|
||||
return newds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a tree view (nsITreeView) into the equivalent DOM tree.
|
||||
* Returns the treechildren
|
||||
*/
|
||||
function treeViewToDOM(tree)
|
||||
{
|
||||
var treechildren = document.createElement("treechildren");
|
||||
|
||||
if (tree.view)
|
||||
treeViewToDOMInner(tree.columns, treechildren, tree.view, tree.builder, 0, 0);
|
||||
|
||||
return treechildren;
|
||||
}
|
||||
|
||||
function treeViewToDOMInner(columns, treechildren, view, builder, start, level)
|
||||
{
|
||||
var end = view.rowCount;
|
||||
|
||||
for (var i = start; i < end; i++) {
|
||||
if (view.getLevel(i) < level)
|
||||
return i - 1;
|
||||
|
||||
var id = builder ? builder.getResourceAtIndex(i).Value : "id" + i;
|
||||
var item = document.createElement("treeitem");
|
||||
item.setAttribute("id", id);
|
||||
treechildren.appendChild(item);
|
||||
|
||||
var row = document.createElement("treerow");
|
||||
item.appendChild(row);
|
||||
|
||||
for (var c = 0; c < columns.length; c++) {
|
||||
var cell = document.createElement("treecell");
|
||||
var label = view.getCellText(i, columns[c]);
|
||||
if (label)
|
||||
cell.setAttribute("label", label);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
|
||||
if (view.isContainer(i)) {
|
||||
item.setAttribute("container", "true");
|
||||
item.setAttribute("empty", view.isContainerEmpty(i) ? "true" : "false");
|
||||
|
||||
if (!view.isContainerEmpty(i) && view.isContainerOpen(i)) {
|
||||
item.setAttribute("open", "true");
|
||||
|
||||
var innertreechildren = document.createElement("treechildren");
|
||||
item.appendChild(innertreechildren);
|
||||
|
||||
i = treeViewToDOMInner(columns, innertreechildren, view, builder, i + 1, level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
bindings - extended syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="bindings - extended syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-2" id="http://www.some-fictitious-zoo.com/humans/sarah" value="Sarah "/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/humans/sarah" value="Sarah Yarmouth"/>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert Sanderson"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert "/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Sanderson'), true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'humans/sarah'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Yarmouth'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<bindings>
|
||||
<binding subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#lastName" object="?lastname"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<label uri="?child" value="?name ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
bindings - multiple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="bindings - multiple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false" label="Arachnids "/>
|
||||
<button step="-2" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false" label="Birds Sarah "/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false" label="Birds Sarah Yarmouth"/>
|
||||
<button step="-1" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" label="Crustaceans Robert Sanderson"/>
|
||||
<button step="1" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" label="Crustaceans Robert "/>
|
||||
<button id="http://www.some-fictitious-zoo.com/fish" container="true" empty="false" label="Fish "/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" label="Mammals "/>
|
||||
<button step="-1" id="http://www.some-fictitious-zoo.com/reptiles" container="true" empty="false" label="Reptiles Robert Sanderson"/>
|
||||
<button step="1" id="http://www.some-fictitious-zoo.com/reptiles" container="true" empty="false" label="Reptiles Robert "/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Sanderson'), true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'humans/sarah'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Yarmouth'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
</query>
|
||||
<rule>
|
||||
<bindings>
|
||||
<binding subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#keeper" object="?keeper"/>
|
||||
<binding subject="?keeper" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?keepername"/>
|
||||
<binding subject="?keeper" predicate="http://www.some-fictitious-zoo.com/rdf#lastName" object="?lastname"/>
|
||||
<binding subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<button uri="?child" label="?name ?keepername ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
bindings - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="bindings - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-2" id="http://www.some-fictitious-zoo.com/humans/sarah" value="First Name: Sarah Last Name: "/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/humans/sarah" value="First Name: Sarah Last Name: Yarmouth"/>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/humans/robert" value="First Name: Robert Last Name: Sanderson"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/humans/robert" value="First Name: Robert Last Name: "/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Sanderson'), true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'humans/sarah'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#lastName'),
|
||||
RDF.GetLiteral('Yarmouth'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule id="rule">
|
||||
<bindings id="bindings">
|
||||
<binding subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#lastName" object="?lastname"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<label uri="?child" value="First Name: ?name Last Name: ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
bindings - reversed
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="bindings - reversed";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/sarah" value="First Name: Sarah Last Name: "/>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/robert" value="First Name: Robert Last Name: "/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule id="rule">
|
||||
<bindings id="bindings">
|
||||
<binding subject="?lastname" predicate="http://www.some-fictitious-zoo.com/rdf#lastName" object="?child"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<label uri="?child" value="First Name: ?name Last Name: ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
bindings - same as triple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="bindings - same as triple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/sarah" value="First Name: Sarah Last Name: "/>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/robert" value="First Name: Robert Last Name: "/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule id="rule">
|
||||
<bindings id="bindings">
|
||||
<binding subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<label uri="?child" value="First Name: ?name Last Name: ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
container and member variable changed
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="container and member variable changed";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button step="3" id="http://www.some-fictitious-zoo.com/birds/wren" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/wren"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/emu"/>
|
||||
<button step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/barnowl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/raven"/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/archaeopteryx"/>
|
||||
<button step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="http://www.some-fictitious-zoo.com/birds http://www.some-fictitious-zoo.com/birds/emperorpenguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template container="?parent" member="?child">
|
||||
<rule>
|
||||
<button uri="?" label="?parent ?child"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
container variable changed
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="container variable changed";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="http://www.some-fictitious-zoo.com/birds "/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="http://www.some-fictitious-zoo.com/birds "/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="http://www.some-fictitious-zoo.com/birds "/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template container="?parent">
|
||||
<rule>
|
||||
<button uri="?" label="?parent ?child"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
containment attribute
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="containment attribute";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<checkbox step="-1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" label="Tarantula"/>
|
||||
<checkbox step="2" id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/reptiles/anaconda" label="Anaconda"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/reptiles/chameleon" label="Chameleon"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#favoriteAnimal'),
|
||||
RDF.GetResource(ZOO_NS + 'arachnids/tarantula'), true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#favoriteAnimal'),
|
||||
RDF.GetResource(ZOO_NS + 'mammals/lion'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert" containment="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?child" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
default container variable is ?uri
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="default container variable is ?uri";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="http://www.some-fictitious-zoo.com/birds"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="http://www.some-fictitious-zoo.com/birds"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="http://www.some-fictitious-zoo.com/birds"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<rule>
|
||||
<button uri="?uri" label="?uri"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax - empty conditions
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax - empty conditions";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions"/>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax - other ref variable
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax - other ref variable";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax, remove unmatched
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax, remove unmatched";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert Sanderson"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?human"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#lastName" object="?lastname"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?human" value="?name ?lastname"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax - simple variable substitution
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax - simple variable substitution";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value=""/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax - two rules recurse
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax - two rules recurse";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<vbox id="http://www.some-fictitious-zoo.com/humans/sarah">
|
||||
<label value="The favorite animals of Sarah"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" class="indent" value="Emu which belongs to the class Birds"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" class="indent" value="Polar Bear which belongs to the class Mammals"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" class="indent" value="Tarantula which belongs to the class Arachnids"/>
|
||||
</vbox>
|
||||
<vbox id="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<label value="The favorite animals of Robert"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" class="indent" value="Tarantula which belongs to the class Arachnids"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" class="indent" value="Anaconda which belongs to the class Reptiles"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" class="indent" value="Chameleon which belongs to the class Reptiles"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" class="indent" value="African Elephant which belongs to the class Mammals"/>
|
||||
</vbox>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<vbox uri="?child">
|
||||
<label value="The favorite animals of ?name"/>
|
||||
</vbox>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<member container="?animalClass" child="?child"/>
|
||||
<triple subject="?animalClass" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="http://www.some-fictitious-zoo.com/rdf#Class"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animalClass" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?animalClassName"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<label uri="?child" class="indent" value="?name which belongs to the class ?animalClassName"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended syntax using an intervening container
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended syntax using an intervening container";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<groupbox>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
</groupbox>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<groupbox>
|
||||
<label uri="?animal" value="?name"/>
|
||||
</groupbox>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
extended variable substitution
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="extended variable substitution";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula? - TarantulaTarantula^ Test"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name^?? ?name?name - ?name^?name^^ Test"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
grid element
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="grid element";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="The coolest animal is: Wren"/>
|
||||
<row id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
<label value="Birds"/>
|
||||
</row>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="The coolest animal is: Barn Owl"/>
|
||||
<row id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
<label value="Birds"/>
|
||||
</row>
|
||||
<row step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
|
||||
<label value="Archaeopteryx"/>
|
||||
<label value="Birds"/>
|
||||
</row>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="The coolest animal is: Emperor Penguin"/>
|
||||
</rows>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<template>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?classname"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?name" rel="equals" value="Raven" negate="true"/>
|
||||
<where subject="?name" rel="contains" value="n"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<rows>
|
||||
<label uri="?child" value="The coolest animal is: ?name"/>
|
||||
</rows>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<action>
|
||||
<rows>
|
||||
<row uri="?child">
|
||||
<label value="?name"/>
|
||||
<label value="?classname"/>
|
||||
</row>
|
||||
</rows>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</grid>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
html element - extended syntax with binding
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="html element - extended syntax with binding";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/lion" title="Lion">
|
||||
<html:em step="-2">4</html:em>
|
||||
<html:em step="2">9</html:em>
|
||||
</html:div>
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" title="HIPPOPOTAMUS">
|
||||
<html:em>2</html:em>
|
||||
</html:div>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant">
|
||||
African Elephant
|
||||
<html:span title="14"/>
|
||||
</html:p>
|
||||
<html:p step="4" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee">
|
||||
Chimpanzee
|
||||
<html:span step="-5"/>
|
||||
<html:span step="5" title="3"/>
|
||||
</html:p>
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/llama" title="LLAMA">
|
||||
<html:em>5</html:em>
|
||||
</html:div>
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/polarbear" title="Polar Bear">
|
||||
<html:em step="-1">20</html:em>
|
||||
<html:em step="1">5</html:em>
|
||||
</html:div>
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/aardvark" title="aardvark">
|
||||
<html:em>2</html:em>
|
||||
</html:div>
|
||||
<html:p step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">
|
||||
Nine-banded Armadillo
|
||||
<html:span title="1"/>
|
||||
</html:p>
|
||||
<html:div id="http://www.some-fictitious-zoo.com/mammals/gorilla" title="Gorilla">
|
||||
<html:em>7</html:em>
|
||||
</html:div>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('5'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('9'));
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('7', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Nine-banded Armadillo'), true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Chimpanzee'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
RDF.GetLiteral('3'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><rule><conditions><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/><where subject="?name" rel="contains" value="an"/></conditions><bindings><binding subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></bindings><action><p xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/><span title="?specimens"/></p></action></rule><rule><conditions><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/></conditions><bindings><binding subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></bindings><action><div xmlns="http://www.w3.org/1999/xhtml" uri="?animal" title="?name"><em><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?specimens"/></em></div></action></rule></template></div>
|
||||
</window>
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
html element - query syntax recursive
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="html element - query syntax recursive";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<html:strong id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">Arachnids</html:strong>
|
||||
<html:strong step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
Birds
|
||||
<html:span id="http://www.some-fictitious-zoo.com/birds/barnowl">Barn Owl</html:span>
|
||||
</html:strong>
|
||||
<html:strong step="1" id="http://www.some-fictitious-zoo.com/insects">Insects</html:strong>
|
||||
<html:strong id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
|
||||
Mammals
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span>
|
||||
<html:span step="2" id="http://www.some-fictitious-zoo.com/mammals/koala">Koala</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/gorilla">Gorilla</html:span>
|
||||
</html:strong>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'insects');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Insects'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
container.InsertElementAt(newnode, '3', true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Birds'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><query><content uri="?uri"/><member container="?uri" child="?child"/><triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/></query><rule><conditions><where subject="?name" rel="endswith" multiple="true" value="mals,ects,nids,irds"/></conditions><action><strong xmlns="http://www.w3.org/1999/xhtml" uri="?child"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></strong></action></rule><rule><conditions><where subject="?uri" rel="equals" negate="true" value="http://www.some-fictitious-zoo.com/all-animals"/><where subject="?name" rel="contains" ignorecase="true" value="o"/></conditions><action><span xmlns="http://www.w3.org/1999/xhtml" uri="?child"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></span></action></rule></template></div>
|
||||
</window>
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
html element - query syntax with multiple rules
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="html element - query syntax with multiple rules";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = true;
|
||||
var notWorkingYetDynamic = true;
|
||||
var expectedOutput =
|
||||
<output xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<html:span step="-2" id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span>
|
||||
<vbox>
|
||||
<html:p step="2" id="http://www.some-fictitious-zoo.com/mammals/lion">
|
||||
<html:span title="Lion"/>
|
||||
</html:p>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant">
|
||||
<html:span title="African Elephant"/>
|
||||
</html:p>
|
||||
<html:p step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">
|
||||
<html:span title="Polar Bear"/>
|
||||
</html:p>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/mammals/gorilla">
|
||||
<html:span title="Gorilla"/>
|
||||
</html:p>
|
||||
</vbox>
|
||||
<html:span step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee">Chimpanzee</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/llama">LLAMA</html:span>
|
||||
<html:span step="1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span>
|
||||
<html:span id="http://www.some-fictitious-zoo.com/mammals/aardvark">aardvark</html:span>
|
||||
<html:span step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('5'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('9'));
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('7', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Nine-banded Armadillo'), true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Chimpanzee'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
RDF.GetLiteral('3'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><query><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></query><rule><conditions id="conditions"><where subject="?specimens" rel="greater" value="6"/></conditions><action><vbox><p xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><span title="?name"/></p></vbox></action></rule><rule><action><span xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></span></action></rule></template></div>
|
||||
</window>
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
html element - simple syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="html element - simple syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<html:p step="3" id="http://www.some-fictitious-zoo.com/birds/wren" title="Wren"/>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/birds/emu" title="Emu"/>
|
||||
<html:p step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" title="Barn Owl"/>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/birds/raven" title="Raven"/>
|
||||
<html:p step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" title="Archaeopteryx"/>
|
||||
<html:p step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" title="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><p xmlns="http://www.w3.org/1999/xhtml" uri="rdf:*" title="rdf:http://www.some-fictitious-zoo.com/rdf#name"/></template></div>
|
||||
</window>
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
html element - simple syntax using a textnode
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="html element - simple syntax using a textnode";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<html:p step="3" id="http://www.some-fictitious-zoo.com/birds/wren">Wren</html:p>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/birds/emu">Emu</html:p>
|
||||
<html:p step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">Barn Owl</html:p>
|
||||
<html:p id="http://www.some-fictitious-zoo.com/birds/raven">Raven</html:p>
|
||||
<html:p step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">Archaeopteryx</html:p>
|
||||
<html:p step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">Emperor Penguin</html:p>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><p xmlns="http://www.w3.org/1999/xhtml" uri="rdf:*"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/></p></template></div>
|
||||
</window>
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
listbox element
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="listbox element";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<listcols>
|
||||
<listcol flex="1"/>
|
||||
<listcol flex="1"/>
|
||||
</listcols>
|
||||
<listitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
|
||||
<listcell label="Wren"/>
|
||||
<listcell label=""/>
|
||||
</listitem>
|
||||
<listitem id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<listcell label="Emu"/>
|
||||
<listcell label="Dromaius novaehollandiae"/>
|
||||
</listitem>
|
||||
<listitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<listcell label="Barn Owl"/>
|
||||
<listcell label="Tyto alba"/>
|
||||
</listitem>
|
||||
<listitem id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<listcell label="Raven"/>
|
||||
<listcell label="Corvus corax"/>
|
||||
</listitem>
|
||||
<listitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
|
||||
<listcell label="Archaeopteryx"/>
|
||||
<listcell label=""/>
|
||||
</listitem>
|
||||
<listitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
|
||||
<listcell label="Emperor Penguin"/>
|
||||
<listcell label=""/>
|
||||
</listitem>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<listcols>
|
||||
<listcol flex="1"/>
|
||||
<listcol flex="1"/>
|
||||
</listcols>
|
||||
<template>
|
||||
<listitem uri="rdf:*">
|
||||
<listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
<listcell label="rdf:http://www.some-fictitious-zoo.com/rdf#species"/>
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
literal as member
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="literal as member";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?name" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
member variable changed
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="member variable changed";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="http://www.some-fictitious-zoo.com/birds/emu Emu"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="http://www.some-fictitious-zoo.com/birds/barnowl Barn Owl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="http://www.some-fictitious-zoo.com/birds/raven Raven"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template member="?child">
|
||||
<rule>
|
||||
<button uri="?child" label="?child rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
member variable substitution
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="member variable substitution";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?animal"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
menu element
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="menu element";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = true;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<menupopup>
|
||||
<menuitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren" label="Wren"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<menuitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<menuitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="Archaeopteryx"/>
|
||||
<menuitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="Emperor Penguin"/>
|
||||
</menupopup>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" type="menu" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<menupopup>
|
||||
<menuitem uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</menupopup>
|
||||
</template>
|
||||
</button>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
menu element recursive
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="menu element recursive";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = true;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<menupopup>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/arachnids" label="Arachnids" container="true" empty="false"/>
|
||||
<menu step="-2" id="http://www.some-fictitious-zoo.com/birds" label="Birds" container="true" empty="false"/>
|
||||
<menu step="2" id="http://www.some-fictitious-zoo.com/birds" label="Birds" container="true" empty="false" open="true">
|
||||
<menupopup>
|
||||
<menuitem step="4" id="http://www.some-fictitious-zoo.com/birds/wren" label="Wren"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<menuitem step="-5" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<menuitem step="3" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="Archaeopteryx"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="Emperor Penguin"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/crustaceans" label="Crustaceans" container="true" empty="true"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/fish" label="Fish" container="true" empty="false"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/mammals" label="Mammals" container="true" empty="false"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/reptiles" label="Reptiles" container="true" empty="false"/>
|
||||
</menupopup>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
// nothing should change at this step as the submenu is not open
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
// open the submenu
|
||||
root.lastChild.firstChild.nextSibling.open = true;
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
root.lastChild.firstChild.nextSibling.open = true;
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
root.lastChild.firstChild.nextSibling.open = true;
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
root.lastChild.firstChild.nextSibling.open = true;
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" type="menu" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template>
|
||||
<rule iscontainer="true" zoo:name="Birds" xmlns:zoo="http://www.some-fictitious-zoo.com/rdf#">
|
||||
<menupopup>
|
||||
<menu uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule parent="button">
|
||||
<menupopup>
|
||||
<menuitem uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule parent="menu">
|
||||
<menupopup>
|
||||
<menuitem uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
</button>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
menulist element
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="$('root').selectedItem = null; test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="menulist element";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<menupopup>
|
||||
<menuitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren" label="Wren"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<menuitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<menuitem id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<menuitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="Archaeopteryx"/>
|
||||
<menuitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="Emperor Penguin"/>
|
||||
</menupopup>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<menulist xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<menupopup>
|
||||
<menuitem uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</menupopup>
|
||||
</template>
|
||||
</menulist>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
mixed syntax - iscontainer
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="mixed syntax - iscontainer";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/humans/sarah" label="Sarah"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" label="Mammals"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" label="Crustaceans"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/sarah'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#pets'),
|
||||
RDF.GetResource(ZOO_NS + 'sarahs-pets'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/marked" flags="dont-recurse">
|
||||
<template id="template">
|
||||
<rule id="rule1" iscontainer="true">
|
||||
<button uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?child" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
mixed syntax - iscontainer isempty
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="mixed syntax - iscontainer isempty";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/humans/sarah" label="Sarah"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" label="Mammals"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" value="Crustaceans"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/marked" flags="dont-recurse">
|
||||
<template id="template">
|
||||
<rule id="rule1" iscontainer="true" isempty="true">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?child" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
mixed syntax - isempty
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="mixed syntax - isempty";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/sarah" value="Sarah"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" label="Mammals"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" value="Crustaceans"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/marked" flags="dont-recurse">
|
||||
<template id="template">
|
||||
<rule id="rule1" isempty="true">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?child" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
no action
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="no action";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<button uri="?child" label="?name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
no action uri attribute
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="no action uri attribute";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label value="Tarantula"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
parent - conditions
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="parent - conditions";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<box step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<label value="Birds"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
</box>
|
||||
<box step="1" id="http://www.some-fictitious-zoo.com/insects">
|
||||
<label value="Insects"/>
|
||||
</box>
|
||||
<box id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
|
||||
<label value="Crustaceans"/>
|
||||
</box>
|
||||
<box id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
|
||||
<label value="Mammals"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" label="Koala"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" label="Nine-banded Armadillo"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</box>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'insects');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Insects'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
container.InsertElementAt(newnode, '3', true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Birds'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?parent"/>
|
||||
<triple subject="?parent" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions parent="box">
|
||||
<where subject="?name" rel="contains" value="a"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<button uri="?parent" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?name" rel="equals" multiple="true" value="Mammals,Crustaceans,Birds,Insects"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<box uri="?parent">
|
||||
<label value="?name"/>
|
||||
</box>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
parent - content tag
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="parent - content tag";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<groupbox step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<caption value="Birds"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
</groupbox>
|
||||
<groupbox step="1" id="http://www.some-fictitious-zoo.com/insects">
|
||||
<caption value="Insects"/>
|
||||
</groupbox>
|
||||
<groupbox id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
|
||||
<caption value="Crustaceans"/>
|
||||
</groupbox>
|
||||
<groupbox id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
|
||||
<caption value="Mammals"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<checkbox step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" label="Koala"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" label="Nine-banded Armadillo"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</groupbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'insects');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Insects'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
container.InsertElementAt(newnode, '3', true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Birds'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri" tag="groupbox"/>
|
||||
<member container="?uri" child="?parent"/>
|
||||
<triple subject="?parent" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<where subject="?name" rel="contains" value="a"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?parent" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?parent"/>
|
||||
<triple subject="?parent" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<where subject="?name" rel="equals" multiple="true" value="Mammals,Crustaceans,Birds,Insects"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<groupbox uri="?parent">
|
||||
<caption value="?name"/>
|
||||
</groupbox>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
parent - simple syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="parent - simple syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<label value="Birds"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
</hbox>
|
||||
<hbox step="1" id="http://www.some-fictitious-zoo.com/insects">
|
||||
<label value="Insects"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
|
||||
<label value="Crustaceans"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
|
||||
<label value="Mammals"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" label="Koala"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" label="Nine-banded Armadillo"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'insects');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Insects'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
container.InsertElementAt(newnode, '3', true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'all-animals'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Birds'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template member="?parent">
|
||||
<rule parent="hbox">
|
||||
<button uri="?parent" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?parent"/>
|
||||
<triple subject="?parent" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<where subject="?name" rel="equals" multiple="true" value="Mammals,Crustaceans,Birds,Insects"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<hbox uri="?parent">
|
||||
<label value="?name"/>
|
||||
</hbox>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - 3 triples
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - 3 triples";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Robert likes Tarantulas"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Robert likes Anacondas"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Robert likes Chameleons"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="Robert likes African Elephants"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?humanname"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?favoriteAnimal"/>
|
||||
<triple subject="?favoriteAnimal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?animalname"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions"/>
|
||||
<action>
|
||||
<label uri="?favoriteAnimal" value="?humanname likes ?animalname^s"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - 3 triples - where contains
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - 3 triples - where contains";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Robert likes Tarantulas"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="Robert likes African Elephants"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="Robert likes African Elephants"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Arctic Hare'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Zebra'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('4', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 6
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
|
||||
RDF.GetLiteral('8'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?humanname"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?favoriteAnimal"/>
|
||||
<triple subject="?favoriteAnimal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?animalname"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions">
|
||||
<where subject="?favoriteAnimal" rel="contains" value="ant"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<label uri="?favoriteAnimal" value="?humanname likes ?animalname^s"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - member, 3 triples - where equals
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - member, 3 triples - where equals";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Sarah likes Emus"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Sarah likes Polar Bears"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?human"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?humanname"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?favoriteAnimal"/>
|
||||
<triple subject="?favoriteAnimal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?animalname"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions">
|
||||
<where subject="?humanname" rel="equals" value="Sarah"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<label uri="?favoriteAnimal" value="?humanname likes ?animalname^s"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - member and two triples
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - member and two triples";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?human"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - member, triple, member, triple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - member, triple, member, triple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/sarah'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#pets'),
|
||||
RDF.GetResource(ZOO_NS + 'sarahs-pets'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?human"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#pets" object="?pets"/>
|
||||
<member container="?pets" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - resource match
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - resource match";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false" value="Arachnids"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false" value="Birds"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" value="Crustaceans"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/fish" container="true" empty="false" value="Fish"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" value="Mammals"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles" container="true" empty="false" value="Reptiles"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="http://www.some-fictitious-zoo.com/rdf#Class"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - reverse triple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - reverse triple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles" container="true" empty="false" value="Reptiles"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true" value="Crustaceans"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#keeper" object="?uri"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - self with triple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - self with triple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" value="Mammals"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
|
||||
<template>
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action>
|
||||
<label uri="?uri" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
queryset - one
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="queryset - one";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button step="3" id="http://www.some-fictitious-zoo.com/birds/wren" label="Wren"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<button step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="Archaeopteryx"/>
|
||||
<button step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<queryset>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action>
|
||||
<button uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</queryset>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
queryset - two
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="queryset - two";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button step="3" id="http://www.some-fictitious-zoo.com/birds/wren" label="Wren"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<checkbox step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<button step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" label="Archaeopteryx"/>
|
||||
<button step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" label="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<queryset>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="Barn Owl"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action>
|
||||
<checkbox uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</queryset>
|
||||
<queryset>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action>
|
||||
<button uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</queryset>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,150 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
queryset - two with condition
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="queryset - two with condition";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox step="-6" id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
<label value="Dromaius novaehollandiae"/>
|
||||
</hbox>
|
||||
<button step="6" id="http://www.some-fictitious-zoo.com/birds/emu" label="No Emus Currently"/>
|
||||
<hbox step="3" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
|
||||
<label value="Archaeopteryx"/>
|
||||
<label value="Archaeopteryx lithographica"/>
|
||||
</hbox>
|
||||
<hbox step="-2" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
<label value="Tyto alba"/>
|
||||
</hbox>
|
||||
<button step="-5" id="http://www.some-fictitious-zoo.com/birds/raven" label="No Ravens Currently"/>
|
||||
<hbox step="5" id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label step="-7" value="Raven"/>
|
||||
<label step="7" value="Crow"/>
|
||||
<label value="Corvus corax"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '2', true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#species'),
|
||||
RDF.GetLiteral('Archaeopteryx lithographica'), true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
RDF.GetLiteral('5'), true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/raven');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/raven'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('2'));
|
||||
},
|
||||
// step 6
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/emu');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/emu'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('0'));
|
||||
},
|
||||
// step 7
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/raven');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/raven'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Crow'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<queryset>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?specimens" rel="equals" value="0"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<button uri="?child" label="No ?name^s Currently"/>
|
||||
</action>
|
||||
</rule>
|
||||
</queryset>
|
||||
<queryset>
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#species" object="?species"/>
|
||||
</query>
|
||||
<action>
|
||||
<hbox uri="?child">
|
||||
<label value="?name^?unknown"/>
|
||||
<label value="?species^?specimens"/>
|
||||
</hbox>
|
||||
</action>
|
||||
</queryset>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Hairy Spider"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query syntax - multiple rules
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query syntax - multiple rules";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-2" id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<checkbox step="2" id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee" value="Chimpanzee"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<checkbox step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('5'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('9'));
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('7', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Nine-banded Armadillo'), true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Chimpanzee'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
RDF.GetLiteral('3'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions">
|
||||
<where subject="?specimens" rel="greater" value="6"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule id="rule2">
|
||||
<action>
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query syntax - multiple rules first condition all
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query syntax - multiple rules first condition all";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" label="Nine-banded Armadillo"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<where subject="?animal" rel="contains" value="zoo"/>
|
||||
<action>
|
||||
<checkbox uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule id="rule2">
|
||||
<conditions>
|
||||
<where subject="?name" rel="contains" value="an"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query syntax - multiple rules two conditions
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query syntax - multiple rules two conditions";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<checkbox step="2" id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee" value="Chimpanzee"/>
|
||||
<checkbox step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
|
||||
<label step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<checkbox id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('5'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'mammals/lion');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
oldval, RDF.GetLiteral('9'));
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('7', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Nine-banded Armadillo'), true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Chimpanzee'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimens'),
|
||||
RDF.GetLiteral('3'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions">
|
||||
<where subject="?specimens" rel="greater" value="6"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<checkbox uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule id="rule2">
|
||||
<conditions>
|
||||
<where subject="?name" rel="contains" value="an"/>
|
||||
</conditions>
|
||||
<action>
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - triple and member merge
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - triple and member merge";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#pets" object="?pets"/>
|
||||
<member container="?pets" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - triple object to subject
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - triple object to subject";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = true;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/humans/sarah" value="Sarah"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
targetds.Unassert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#favoriteAnimal'),
|
||||
RDF.GetResource(ZOO_NS + 'arachnids/tarantula'), true);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'humans/robert'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#favoriteAnimal'),
|
||||
RDF.GetResource(ZOO_NS + 'mammals/lion'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids/tarantula">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?uri"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?humanname"/>
|
||||
</query>
|
||||
<action>
|
||||
<label uri="?human" value="?humanname"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - two members
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - two members";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/fish/cod" value="Cod"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/fish/swordfish" value="Swordfish"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?childone"/>
|
||||
<member container="?childone" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - two members filtered
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - two members filtered";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="Mammals"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?childone"/>
|
||||
<triple subject="?childone" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<member container="?childone" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="LLAMA"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - two triples
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - two triples";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - upwards member
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - upwards member";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/marked" container="true" empty="false" value="Marked"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false" value="Birds"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/sarahs-pets" container="true" empty="false" value="Sarah's Pets"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds/emu" flags="dont-recurse">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?child" child="?uri"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query - upwards member, triple and filtering triple
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query - upwards member, triple and filtering triple";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output unordered="true">
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans/robert">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<member container="?reptiles" child="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?reptiles" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="Reptiles"/>
|
||||
</query>
|
||||
,<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
query with empty conditions
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="query with empty conditions";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/mammals/zebra" value="Zebra"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" value="Koala"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/mammals/arctichare" value="Arctic Hare"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Arctic Hare'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Zebra'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('4', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 6
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
|
||||
RDF.GetLiteral('8'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions id="conditions"/>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
reference as member
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="reference as member";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false" value="Tarantula"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false" value="Hairy Spider"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<rule id="rule">
|
||||
<conditions id="conditions">
|
||||
<content uri="?start"/>
|
||||
<member container="?start" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?start" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
self generation - extended syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="self generation - extended syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Hairy Spider"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids/tarantula">
|
||||
<template id="template">
|
||||
<query>
|
||||
<content uri="?uri"/>
|
||||
</query>
|
||||
<rule>
|
||||
<bindings>
|
||||
<binding subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<label uri="?uri" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
self generation - simple syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="self generation - simple syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output/>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids/tarantula">
|
||||
<template id="template">
|
||||
<button uri="?" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax enclosed in a container
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax enclosed in a container";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<hbox>
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax enclosed in a container with a rule
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax enclosed in a container with a rule";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
</hbox>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<rule>
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax - filter
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax - filter";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template zoo:name="Barn Owl" xmlns:zoo="http://www.some-fictitious-zoo.com/rdf#">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax - filter with multiple rules
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax - filter with multiple rules";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<button step="4,-5" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Spooky Bird"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<button step="1,-3" id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Spooky Bird"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/syntheticbarnowl" value="Barn Owl"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/barnowl'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Spooky Bird'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/syntheticbarnowl');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '2', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/barnowl'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Barn Owl'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<rule zoo:name="Barn Owl" xmlns:zoo="http://www.some-fictitious-zoo.com/rdf#">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
<rule>
|
||||
<button uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax - filter with rule
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax - filter with rule";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox step="-1" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox step="5" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox step="2" id="http://www.some-fictitious-zoo.com/birds/syntheticbarnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/barnowl'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Spooky Bird'));
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/syntheticbarnowl');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('2', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '2', true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'birds/barnowl');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'birds/barnowl'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Barn Owl'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template>
|
||||
<rule zoo:name="Barn Owl" xmlns:zoo="http://www.some-fictitious-zoo.com/rdf#">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax iterating over a single value
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax iterating over a single value";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using an intervening container
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using an intervening container";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<groupbox>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
|
||||
</groupbox>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<groupbox>
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</groupbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using a textnode
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using a textnode";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<description step="3" id="http://www.some-fictitious-zoo.com/birds/wren">Wren</description>
|
||||
<description id="http://www.some-fictitious-zoo.com/birds/emu">Emu</description>
|
||||
<description step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">Barn Owl</description>
|
||||
<description id="http://www.some-fictitious-zoo.com/birds/raven">Raven</description>
|
||||
<description step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">Archaeopteryx</description>
|
||||
<description step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">Emperor Penguin</description>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<description uri="rdf:*"><textnode value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/></description>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using container as the generation element
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using container as the generation element";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
|
||||
<label value="Wren"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
</hbox>
|
||||
<hbox step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
</hbox>
|
||||
<hbox step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
|
||||
<label value="Archaeopteryx"/>
|
||||
</hbox>
|
||||
<hbox step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
|
||||
<label value="Emperor Penguin"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using dont-recurse
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using dont-recurse";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">
|
||||
<label value="Arachnids"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<label value="Birds"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/some-animals" flags="dont-recurse">
|
||||
<template id="template">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using recursive generation
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using recursive generation";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">
|
||||
<label value="Arachnids"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/arachnids/tarantula">
|
||||
<label value="Tarantula"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<label value="Birds"/>
|
||||
<hbox step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
|
||||
<label value="Wren"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
</hbox>
|
||||
<hbox step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
</hbox>
|
||||
<hbox step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
|
||||
<label value="Archaeopteryx"/>
|
||||
</hbox>
|
||||
<hbox step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
|
||||
<label value="Emperor Penguin"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Emperor Penguin'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Archaeopteryx'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Wren'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'birds'));
|
||||
var removednode = container.RemoveElementAt('3', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Barn Owl'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/some-animals">
|
||||
<template id="template">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax using recursive generation again
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax using recursive generation again";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">
|
||||
<label value="Arachnids"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/arachnids/tarantula">
|
||||
<label value="Tarantula"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
|
||||
<label value="Birds"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/some-animals">
|
||||
<template id="template">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple syntax with two variables used
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple syntax with two variables used";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/emu">
|
||||
<label value="Emu"/>
|
||||
<label value="12"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/barnowl">
|
||||
<label value="Barn Owl"/>
|
||||
<label value="4"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/birds/raven">
|
||||
<label value="Raven"/>
|
||||
<label value="0"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
|
||||
<template id="template">
|
||||
<hbox uri="rdf:*">
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
<label value="rdf:http://www.some-fictitious-zoo.com/rdf#specimens"/>
|
||||
</hbox>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - carets at beginning and end
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - carets at beginning and end";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="^^Before Tarantula^"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="^^Before rdf:http://www.some-fictitious-zoo.com/rdf#name^^"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - caret substitution
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - caret substitution";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula^ and^^ lots ^ more"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name^^ and^^ lots ^ more"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - no variable
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - no variable";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="Name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - question mark as part of variable
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - question mark as part of variable";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name is "/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="Name is rdf:http://www.some-fictitious-zoo.com/rdf#name?"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - question mark substitution
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - question mark substitution";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Are you a Tarantula ?"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Are you a Hairy Spider ?"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="Are you a rdf:http://www.some-fictitious-zoo.com/rdf#name ?sample ??"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - text and variable
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - text and variable";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="-1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name is Tarantula the Spider"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name is Hairy Spider the Spider"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var subject = RDF.GetResource(ZOO_NS + 'arachnids/tarantula');
|
||||
var predicate = RDF.GetResource(ZOO_NS + 'rdf#name');
|
||||
var oldval = targetds.GetTarget(subject, predicate, true);
|
||||
targetds.Change(RDF.GetResource(ZOO_NS + 'arachnids/tarantula'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
oldval, RDF.GetLiteral('Hairy Spider'));
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="Name is rdf:http://www.some-fictitious-zoo.com/rdf#name the Spider"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - variable and text concatenated
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - variable and text concatenated";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="The Tarantula's Nest"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="The rdf:http://www.some-fictitious-zoo.com/rdf#name^'s Nest"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
simple variable substitution - variables concatenated
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="simple variable substitution - variables concatenated";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula3"/>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/arachnids">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name^rdf:http://www.some-fictitious-zoo.com/rdf#specimens"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort ascending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort ascending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/mammals/arctichare" value="Arctic Hare"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" value="Koala"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/mammals/zebra" value="Zebra"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Arctic Hare'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Zebra'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('4', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 6
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
|
||||
RDF.GetLiteral('8'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sort="?name" sortDirection="ascending">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort ascending two rules - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort ascending two rules - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortDirection="ascending" sort="?specimens ?name" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?name" rel="contains" value="o"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<action>
|
||||
<button uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort ascending two rules with container - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort ascending two rules with container - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">
|
||||
<label value="Nine-banded Armadillo"/>
|
||||
</hbox>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/lion">
|
||||
<label value="Lion"/>
|
||||
</hbox>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/gorilla">
|
||||
<label value="Gorilla"/>
|
||||
</hbox>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/polarbear">
|
||||
<label value="Polar Bear"/>
|
||||
</hbox>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortDirection="ascending" sort="?specimens ?name" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?name" rel="contains" value="o"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<hbox uri="?animal">
|
||||
<label value="?name"/>
|
||||
</hbox>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<action>
|
||||
<button uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort ascending two rules with different container - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort ascending two rules with different container - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<vbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">
|
||||
<label value="Nine-banded Armadillo"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/lion">
|
||||
<label value="Lion"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/gorilla">
|
||||
<label value="Gorilla"/>
|
||||
</hbox>
|
||||
<hbox id="http://www.some-fictitious-zoo.com/mammals/polarbear">
|
||||
<label value="Polar Bear"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
|
||||
<button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortDirection="ascending" sort="?specimens ?name" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/>
|
||||
</query>
|
||||
<rule>
|
||||
<conditions>
|
||||
<where subject="?name" rel="contains" value="o"/>
|
||||
</conditions>
|
||||
<action id="action">
|
||||
<vbox>
|
||||
<hbox uri="?animal">
|
||||
<label value="?name"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</action>
|
||||
</rule>
|
||||
<rule>
|
||||
<action>
|
||||
<button uri="?animal" label="?name"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort descending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort descending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label step="3" id="http://www.some-fictitious-zoo.com/mammals/zebra" value="Zebra"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" value="Koala"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label step="1" id="http://www.some-fictitious-zoo.com/mammals/arctichare" value="Arctic Hare"/>
|
||||
<label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
</output>;
|
||||
|
||||
var changes = [
|
||||
// step 1
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Arctic Hare'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 2
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Koala'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '4', true);
|
||||
},
|
||||
// step 3
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('Zebra'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.InsertElementAt(newnode, '1', true);
|
||||
},
|
||||
// step 4
|
||||
function(targetds, root) {
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
var removednode = container.RemoveElementAt('4', true);
|
||||
targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
},
|
||||
// step 5
|
||||
function(targetds, root) {
|
||||
var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant');
|
||||
targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
|
||||
RDF.GetLiteral('African Elephant'), true);
|
||||
var container = ContainerUtils.MakeSeq(targetds,
|
||||
RDF.GetResource(ZOO_NS + 'mammals'));
|
||||
container.AppendElement(newnode);
|
||||
},
|
||||
// step 6
|
||||
function(targetds, root) {
|
||||
targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'),
|
||||
RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'),
|
||||
RDF.GetLiteral('8'), true);
|
||||
}
|
||||
];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sort="?name" sortDirection="descending">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sort query - member and two triples
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sort query - member and two triples";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/humans" sortDirection="ascending" sort="?name" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?human"/>
|
||||
<triple subject="?human" predicate="http://www.some-fictitious-zoo.com/rdf#favoriteAnimal" object="?child"/>
|
||||
<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action>
|
||||
<label uri="?child" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sortResource2 descending - simple syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sortResource2 descending - simple syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortDirection="descending" sort="http://www.some-fictitious-zoo.com/rdf#specimens http://www.some-fictitious-zoo.com/rdf#name" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sortResource2 set to predicate ascending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sortResource2 set to predicate ascending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortDirection="ascending" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sortResource2 set to predicate descending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sortResource2 set to predicate descending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortResource="http://www.some-fictitious-zoo.com/rdf#specimens" sortDirection="descending" sortResource2="http://www.some-fictitious-zoo.com/rdf#name">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sortResource ascending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sortResource ascending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortResource="?name" sortDirection="ascending">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
|
||||
<!--
|
||||
sortResource descending - query syntax
|
||||
-->
|
||||
|
||||
<window title="XUL Template Tests" width="500" height="600"
|
||||
onload="test_template();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||
|
||||
<script src="templates_shared.js"/>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testid ="sortResource descending - query syntax";
|
||||
var queryType = "rdf";
|
||||
var isTreeBuilder = false;
|
||||
var needsOpen = false;
|
||||
var notWorkingYet = false;
|
||||
var notWorkingYetDynamic = false;
|
||||
var expectedOutput =
|
||||
<output>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
|
||||
<label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
|
||||
</output>;
|
||||
|
||||
var changes = [];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals" sortResource="?name" sortDirection="descending">
|
||||
<template id="template">
|
||||
<query id="query">
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?animal"/>
|
||||
<triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
|
||||
</query>
|
||||
<action id="action">
|
||||
<label uri="?animal" value="?name"/>
|
||||
</action>
|
||||
</template>
|
||||
</vbox>
|
||||
|
||||
</window>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче