import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -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>

Binary file not shown.

View file

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!DOCTYPE zoo [
<!ATTLIST species id ID #REQUIRED>
]>
<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>

View file

@ -0,0 +1,263 @@
<?xml version="1.0" encoding="utf-8"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:row="http://dummy/rdf#" xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Bag about="urn:data:row">
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111110</row:id>
<row:title>FILE 1 -- A</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111111</row:id>
<row:title>FILE 1 -- B</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111110</row:id>
<row:title>FILE 1 -- C</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111111</row:id>
<row:title>FILE 1 -- D</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111112</row:id>
<row:title>FILE 1 -- E</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111110</row:id>
<row:title>FILE 1 -- F</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111114</row:id>
<row:title>FILE 1 -- G</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111111</row:id>
<row:title>FILE 1 -- H</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111118</row:id>
<row:title>FILE 1 -- I</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111116</row:id>
<row:title>FILE 1 -- J</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111110</row:id>
<row:title>FILE 1 -- K</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111119</row:id>
<row:title>FILE 1 -- L</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111116</row:id>
<row:title>FILE 1 -- M</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111111</row:id>
<row:title>FILE 1 -- N</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111113</row:id>
<row:title>FILE 1 -- O</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111111</row:id>
<row:title>FILE 1 -- P</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111117</row:id>
<row:title>FILE 1 -- Q</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111110</row:id>
<row:title>FILE 1 -- R</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111113</row:id>
<row:title>FILE 1 -- S</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111112</row:id>
<row:title>FILE 1 -- T</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111116</row:id>
<row:title>FILE 1 -- U</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111111</row:id>
<row:title>FILE 1 -- V</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111121</row:id>
<row:title>FILE 1 -- W</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111114</row:id>
<row:title>FILE 1 -- X</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111122</row:id>
<row:title>FILE 1 -- Y</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111113</row:id>
<row:title>FILE 1 -- Z</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111119</row:id>
<row:title>FILE 1 -- AA</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111117</row:id>
<row:title>FILE 1 -- BB</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111117</row:id>
<row:title>FILE 1 -- CC</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111117</row:id>
<row:title>FILE 1 -- DD</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111116</row:id>
<row:title>FILE 1 -- EE</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111124</row:id>
<row:title>FILE 1 -- FF</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111118</row:id>
<row:title>FILE 1 -- GG</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111117</row:id>
<row:title>FILE 1 -- HH</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111118</row:id>
<row:title>FILE 1 -- II</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111125</row:id>
<row:title>FILE 1 -- JJ</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111124</row:id>
<row:title>FILE 1 -- KK</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111132</row:id>
<row:title>FILE 1 -- LL</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111136</row:id>
<row:title>FILE 1 -- MM</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111123</row:id>
<row:title>FILE 1 -- NN</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111122</row:id>
<row:title>FILE 1 -- OO</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">111110</row:id>
<row:title>FILE 1 -- PP</row:title>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">1111116</row:id>
<row:title>FILE 1 -- QQ</row:title>
</RDF:Description>
</RDF:li>
</RDF:Bag>
</RDF:RDF>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:row="http://dummy/rdf#" xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Bag about="urn:data:row">
<RDF:li>
<RDF:Description>
<row:id NC:parseType="Integer">222220</row:id>
<row:title>FILE 2 -- A</row:title>
</RDF:Description>
</RDF:li>
</RDF:Bag>
</RDF:RDF>

View file

@ -0,0 +1,225 @@
[DEFAULT]
skip-if = os == 'android'
support-files =
animals.rdf
animals.sqlite
animals.xml
bug441785-1.rdf
bug441785-2.rdf
templates_shared.js
[test_bug329335.xul]
[test_bug330010.xul]
skip-if = os == "win"
support-files = file_bug330010.rdf
[test_bug397148.xul]
skip-if = true # Bug 879531
[test_bug441785.xul]
[test_bug476634.xul]
[test_sortservice.xul]
[test_tmpl_bindingsextendedsyntax.xul]
[test_tmpl_bindingsmultiple.xul]
[test_tmpl_bindingsquerysyntax.xul]
[test_tmpl_bindingsreversed.xul]
[test_tmpl_bindingssameastriple.xul]
[test_tmpl_containerandmembervariablechanged.xul]
[test_tmpl_containervariablechanged.xul]
[test_tmpl_containmentattribute.xul]
[test_tmpl_defaultcontainervariableisuri.xul]
[test_tmpl_errors.xul]
[test_tmpl_extendedsyntax.xul]
[test_tmpl_extendedsyntaxemptyconditions.xul]
[test_tmpl_extendedsyntaxotherrefvariable.xul]
[test_tmpl_extendedsyntaxremoveunmatched.xul]
[test_tmpl_extendedsyntaxsimplevariablesubstitution.xul]
[test_tmpl_extendedsyntaxtworulesrecurse.xul]
[test_tmpl_extendedsyntaxusinganinterveningcontainer.xul]
[test_tmpl_extendedvariablesubstitution.xul]
[test_tmpl_gridelement.xul]
[test_tmpl_htmlelementextendedsyntaxwithbinding.xul]
[test_tmpl_htmlelementquerysyntaxrecursive.xul]
[test_tmpl_htmlelementquerysyntaxwithmultiplerules.xul]
[test_tmpl_htmlelementsimplesyntax.xul]
[test_tmpl_htmlelementsimplesyntaxusingatextnode.xul]
[test_tmpl_invalidqp.xul]
[test_tmpl_listboxelement.xul]
[test_tmpl_literalasmember.xul]
[test_tmpl_membervariablechanged.xul]
[test_tmpl_membervariablesubstitution.xul]
[test_tmpl_menuelement.xul]
[test_tmpl_menuelementrecursive.xul]
[test_tmpl_menulistelement.xul]
[test_tmpl_mixedsyntaxiscontainer.xul]
[test_tmpl_mixedsyntaxiscontainerisempty.xul]
[test_tmpl_mixedsyntaxisempty.xul]
[test_tmpl_noaction.xul]
[test_tmpl_noactionuriattribute.xul]
[test_tmpl_parentconditions.xul]
[test_tmpl_parentcontenttag.xul]
[test_tmpl_parentsimplesyntax.xul]
[test_tmpl_query3triples.xul]
[test_tmpl_query3tripleswherecontains.xul]
[test_tmpl_querymember3tripleswhereequals.xul]
[test_tmpl_querymemberandtwotriples.xul]
[test_tmpl_querymembertriplemembertriple.xul]
[test_tmpl_queryresourcematch.xul]
[test_tmpl_queryreversetriple.xul]
[test_tmpl_queryselfwithtriple.xul]
[test_tmpl_querysetone.xul]
[test_tmpl_querysettwo.xul]
[test_tmpl_querysettwowithcondition.xul]
[test_tmpl_querysyntax.xul]
[test_tmpl_querysyntaxmultiplerules.xul]
[test_tmpl_querysyntaxmultiplerulesfirstconditionall.xul]
[test_tmpl_querysyntaxmultiplerulestwoconditions.xul]
[test_tmpl_querytripleandmembermerge.xul]
[test_tmpl_querytripleobjecttosubject.xul]
[test_tmpl_querytwomembers.xul]
[test_tmpl_querytwomembersfiltered.xul]
[test_tmpl_querytwotriples.xul]
[test_tmpl_queryupwardsmember.xul]
[test_tmpl_queryupwardsmembertripleandfilteringtriple.xul]
[test_tmpl_querywithemptyconditions.xul]
[test_tmpl_referenceasmember.xul]
[test_tmpl_regenerate.xul]
[test_tmpl_selfgenerationextendedsyntax.xul]
[test_tmpl_selfgenerationsimplesyntax.xul]
[test_tmpl_simplesyntaxenclosedinacontainer.xul]
[test_tmpl_simplesyntaxenclosedinacontainerwitharule.xul]
[test_tmpl_simplesyntaxfilter.xul]
[test_tmpl_simplesyntaxfilterwithmultiplerules.xul]
[test_tmpl_simplesyntaxfilterwithrule.xul]
[test_tmpl_simplesyntaxiteratingoverasinglevalue.xul]
[test_tmpl_simplesyntaxusinganinterveningcontainer.xul]
[test_tmpl_simplesyntaxusingatextnode.xul]
[test_tmpl_simplesyntaxusingcontainerasthegenerationelement.xul]
[test_tmpl_simplesyntaxusingdontrecurse.xul]
[test_tmpl_simplesyntaxusingrecursivegeneration.xul]
[test_tmpl_simplesyntaxusingrecursivegenerationagain.xul]
[test_tmpl_simplesyntaxwithtwovariablesused.xul]
[test_tmpl_simplevariablesubstitutioncaretsatbeginningandend.xul]
[test_tmpl_simplevariablesubstitutioncaretsubstitution.xul]
[test_tmpl_simplevariablesubstitutionnovariable.xul]
[test_tmpl_simplevariablesubstitutionquestionmarkaspartofvariable.xul]
[test_tmpl_simplevariablesubstitutionquestionmarksubstitution.xul]
[test_tmpl_simplevariablesubstitutiontextandvariable.xul]
[test_tmpl_simplevariablesubstitutionvariableandtextconcatenated.xul]
[test_tmpl_simplevariablesubstitutionvariablesconcatenated.xul]
[test_tmpl_sortascendinginteger.xul]
[test_tmpl_sortascendingquerysyntax.xul]
[test_tmpl_sortascendingtworulesquerysyntax.xul]
[test_tmpl_sortascendingtworuleswithcontainerquerysyntax.xul]
[test_tmpl_sortascendingtworuleswithdifferentcontainerquerysyntax.xul]
[test_tmpl_sortdescendingquerysyntax.xul]
[test_tmpl_sortquerymemberandtwotriples.xul]
[test_tmpl_sortresource2descendingsimplesyntax.xul]
[test_tmpl_sortresource2settopredicateascendingquerysyntax.xul]
[test_tmpl_sortresource2settopredicatedescendingquerysyntax.xul]
[test_tmpl_sortresourceascendingquerysyntax.xul]
[test_tmpl_sortresourcedescendingquerysyntax.xul]
[test_tmpl_sortresourcesettopredicateascendingquerysyntax.xul]
[test_tmpl_sortresourcesettopredicatedescendingquerysyntax.xul]
[test_tmpl_sorttworesourcesasstringsettopredicatedescendingquerysyntax.xul]
[test_tmpl_sorttworesourcessettopredicateascendingquerysyntax.xul]
[test_tmpl_sorttwovariablesascendingquerysyntax.xul]
[test_tmpl_sorttwovariablesascendingsimplesyntax.xul]
[test_tmpl_sorttwovariablesdescendingquerysyntax.xul]
[test_tmpl_sortunknownascendingquerysyntax.xul]
[test_tmpl_storage_bad_parameters.xul]
[test_tmpl_storage_bad_parameters_2.xul]
[test_tmpl_storage_bad_parameters_3.xul]
[test_tmpl_storage_baddatasource.xul]
[test_tmpl_storage_badquery.xul]
[test_tmpl_storage_dynamicparameters.xul]
[test_tmpl_storage_listbox.xul]
[test_tmpl_storage_multiqueries.xul]
[test_tmpl_storage_parameters.xul]
[test_tmpl_storage_rule.xul]
[test_tmpl_storage_simple.xul]
[test_tmpl_storage_sortintegerasc.xul]
[test_tmpl_storage_sortintegerdesc.xul]
[test_tmpl_storage_sortstringasc.xul]
[test_tmpl_storage_sortstringdesc.xul]
[test_tmpl_storage_tree.xul]
[test_tmpl_treeelementquerysyntax.xul]
[test_tmpl_treeelementquerysyntaxnotrecursive.xul]
[test_tmpl_treeelementquerysyntaxnotrecursivetreebuilder.xul]
[test_tmpl_treeelementquerysyntaxrecursive.xul]
[test_tmpl_treeelementquerysyntaxrecursivemultiplerules.xul]
[test_tmpl_treeelementquerysyntaxrecursivemultiplerulestreebuilder.xul]
[test_tmpl_treeelementquerysyntaxrecursivetreebuilder.xul]
[test_tmpl_treeelementquerysyntaxtreebuilder.xul]
[test_tmpl_treeelementsimplesyntaxnotrecursive.xul]
[test_tmpl_treeelementsimplesyntaxnotrecursivetreebuilder.xul]
[test_tmpl_treeelementsimplesyntaxrecursive.xul]
[test_tmpl_treeelementsimplesyntaxrecursivetreebuilder.xul]
[test_tmpl_treeelementtreecell.xul]
[test_tmpl_treeelementtreecellsortascending.xul]
[test_tmpl_treeelementtreecellsortascendingtreebuilder.xul]
[test_tmpl_treeelementtreecelltreebuilder.xul]
[test_tmpl_treeelementtreeitemonly.xul]
[test_tmpl_treeelementtreeitemsortascending.xul]
[test_tmpl_twogenerationnodes.xul]
[test_tmpl_whereafterignorecase.xul]
[test_tmpl_whereafterlowercase.xul]
[test_tmpl_whereafternegation.xul]
[test_tmpl_whereafteruppercase.xul]
[test_tmpl_wherebeforeignorecase.xul]
[test_tmpl_wherebeforelowercase.xul]
[test_tmpl_wherebeforenegation.xul]
[test_tmpl_wherebeforeuppercase.xul]
[test_tmpl_wherecontains.xul]
[test_tmpl_wherecontainsignorecase.xul]
[test_tmpl_wherecontainsnegation.xul]
[test_tmpl_wherecontainsnumber.xul]
[test_tmpl_wherecontainsnumberstring.xul]
[test_tmpl_wherecontainsresource.xul]
[test_tmpl_wherecontainstwo.xul]
[test_tmpl_whereendswith.xul]
[test_tmpl_whereendswithignorecase.xul]
[test_tmpl_whereendswithnegation.xul]
[test_tmpl_whereequals.xul]
[test_tmpl_whereequalsignorecase.xul]
[test_tmpl_whereequalsmultiple.xul]
[test_tmpl_whereequalsmultiplenegation.xul]
[test_tmpl_whereequalsmultiplenegationignorecase.xul]
[test_tmpl_whereequalsnegation.xul]
[test_tmpl_whereequalsnegationignorecase.xul]
[test_tmpl_whereequalsnegationwrongcase.xul]
[test_tmpl_whereequalsnumber.xul]
[test_tmpl_whereequalsothervariable.xul]
[test_tmpl_whereequalsresource.xul]
[test_tmpl_whereequalssamevariable.xul]
[test_tmpl_whereequalswrongcase.xul]
[test_tmpl_wheregreater.xul]
[test_tmpl_wheregreaternegation.xul]
[test_tmpl_wheregreaternegationstring.xul]
[test_tmpl_wheregreaterstring.xul]
[test_tmpl_whereless.xul]
[test_tmpl_wherelessnegation.xul]
[test_tmpl_wherelessnegationstring.xul]
[test_tmpl_wherelessstring.xul]
[test_tmpl_wherenorel.xul]
[test_tmpl_wherenosubject.xul]
[test_tmpl_wherenovalue.xul]
[test_tmpl_wherestartswith.xul]
[test_tmpl_wherestartswithignorecase.xul]
[test_tmpl_wherestartswithmultiple.xul]
[test_tmpl_wherestartswithnegation.xul]
[test_tmpl_wherestartswithunknownvariable.xul]
[test_tmpl_wherestartswithvariable.xul]
[test_tmpl_wheresubjectequalsvariable.xul]
[test_tmpl_wheresubjectstartswithvariable.xul]
[test_tmpl_xmlquerysimple.xul]
[test_tmpl_xmlquerywithassign.xul]
[test_tmpl_xmlquerywithassignmentandcondition.xul]
[test_tmpl_xmlquerywithassignmentandconditiondontrecurse.xul]
[test_tmpl_xmlquerywithbindinginbindings.xul]
[test_tmpl_xmlquerywithbindinginrule.xul]
[test_tmpl_xmlquerywithdifferentmember.xul]
[test_tmpl_xmlquerywithinlinedata.xul]
[test_tmpl_xmlquerywithinlinedatawithmultiplequeries.xul]
[test_tmpl_xmlquerywithmultiplequeries.xul]
[test_tmpl_xmlquerywithothertypes.xul]
[test_tmpl_xmlquerywithsort.xul]
[test_tmpl_xmlquerywithsortotherfield.xul]

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:s="urn:croczilla:xulsvg1:">
<rdf:Description about="urn:root">
<s:shapes>
<rdf:Bag>
<rdf:li>
<rdf:Description />
</rdf:li>
</rdf:Bag>
</s:shapes>
</rdf:Description>
</rdf:RDF>

View file

@ -0,0 +1,488 @@
/**
* 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
* XML, 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;
var expectedConsoleMessages = [];
var expectLoggedMessages = null;
function get_RDF() {
try {
return Components.classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
} catch (ex) { }
}
function get_ContainerUtils()
{
try {
return Components.classes["@mozilla.org/rdf/container-utils;1"].
getService(Components.interfaces.nsIRDFContainerUtils);
} catch(ex) { }
}
const RDF = get_RDF();
const ContainerUtils = get_ContainerUtils();
var xmlDoc;
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 src = window.location.href.replace(/test_tmpl.*xul/, "animals.rdf");
ds = RDF.GetDataSourceBlocking(src);
if (expectLoggedMessages) {
Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService).reset();
}
if (root.getAttribute("datasources") == "rdf:null")
root.setAttribute("datasources", "animals.rdf");
}
else if (queryType == "xml") {
var src = window.location.href.replace(/test_tmpl.*xul/, "animals.xml");
xmlDoc = new XMLHttpRequest();
xmlDoc.open("get", src, false);
xmlDoc.send(null);
}
// open menus if necessary
if (needsOpen)
root.open = true;
if (expectLoggedMessages)
expectLoggedMessages();
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;
if (expectedConsoleMessages.length)
compareConsoleMessages();
SimpleTest.finish();
}
}
function iterateChanged(root, ds)
{
Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService).reset();
for (var c = 0; c < changes.length; c++) {
changes[c](ds, root);
checkResults(root, c + 1);
}
if (needsOpen)
root.open = false;
if (expectedConsoleMessages.length)
compareConsoleMessages();
SimpleTest.finish();
}
function checkResults(root, step)
{
var output = expectedOutput.cloneNode(true);
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);
var treechildrenElements = [...output.children].filter((e) => e.localName === "treechildren");
error = compareOutput(actualoutput, treechildrenElements[0], false);
}
else {
error = compareOutput(actualoutput, output, true);
}
var adjtestid = testid;
if (step > 0)
adjtestid += " dynamic step " + step;
var stilltodo = ((step == 0 && notWorkingYet) || (step > 0 && notWorkingYetDynamic));
if (stilltodo)
todo(false, adjtestid);
else
ok(!error, adjtestid);
if ((!stilltodo && error) || 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");
serializedXML = serializedXML.replace(nsrepl, "");
if (debug)
dump("-------- " + adjtestid + " " + error + ":\n" + serializedXML + "\n");
if (!stilltodo && error)
is(serializedXML, "Same", "Error is: " + error);
}
}
/**
* Adjust the expected output to acccount for any step attributes.
*/
function setForCurrentStep(content, currentStep)
{
var todelete = [];
for (var child of content.childNodes) {
if (child.nodeType === Node.ELEMENT_NODE) {
var stepstr = child.getAttribute("step") || "";
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);
}
}
} else if (child.nodeType === Node.TEXT_NODE) {
// Drop empty text nodes.
if (child.nodeValue.trim() === "")
todelete.push(child);
}
}
for (var e of todelete)
content.removeChild(e);
for (var child of content.children) {
child.removeAttribute("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)
{
if (isroot && expected.localName != "data")
return "expected must be a <data> element";
var t;
// compare text nodes
if (expected.nodeType == Node.TEXT_NODE) {
if (actual.nodeValue !== expected.nodeValue.trim())
return "Text " + actual.nodeValue + " doesn't match " + expected.nodeValue;
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];
var expectval = attr.value;
// 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.getAttribute(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.childNodes.length)
return "incorrect child node count of " + actual.localName + " " + length +
" expected " + expected.childNodes.length;
// if <data unordered="true"> is used, then the child nodes may be in any order
var unordered = (expected.localName == "data" && expected.getAttribute("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.childNodes;
for (var e = 0; e < expectedChildren.length; e++) {
output = compareOutput(actualnode, expectedChildren[e], false);
if (!output)
break;
}
}
else {
output = compareOutput(actualnode, expected.childNodes[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 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;
}
function expectConsoleMessage(ref, id, isNew, isActive, extra)
{
var message = "In template with id root" +
(ref ? " using ref " + ref : "") + "\n " +
(isNew ? "New " : "Removed ") + (isActive ? "active" : "inactive") +
" result for query " + extra + ": " + id;
expectedConsoleMessages.push(message);
}
function compareConsoleMessages()
{
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService);
var messages = consoleService.getMessageArray() || [];
messages = messages.map(m => m.message);
// Copy to avoid modifying expectedConsoleMessages
var expect = expectedConsoleMessages.concat();
for (var m = 0; m < messages.length; m++) {
if (messages[m] == expect[0]) {
ok(true, "found message " + expect.shift());
}
}
if (expect.length != 0) {
ok(false, "failed to find expected console messages: " + expect);
}
}
function copyToProfile(filename)
{
if (Cc === undefined) {
var Cc = Components.classes;
var Ci = Components.interfaces;
}
var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://mochikit/content/chrome-harness.js");
var file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("ProfD", Ci.nsIFile);
file.append(filename);
var parentURI = getResolvedURI(getRootDirectory(window.location.href));
if (parentURI.JARFile) {
parentURI = extractJarToTmp(parentURI);
} else {
var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
getService(Ci.nsIFileProtocolHandler);
parentURI = fileHandler.getFileFromURLSpec(parentURI.spec);
}
parentURI = parentURI.QueryInterface(Ci.nsILocalFile);
parentURI.append(filename);
try {
var retVal = parentURI.copyToFollowingLinks(file.parent, filename);
} catch (ex) {
//ignore this error as the file could exist already
}
}

View file

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:svg="http://www.w3.org/2000/svg">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script>
SimpleTest.waitForExplicitFinish();
function init()
{
document.documentElement.appendChild(document.getElementById("svg"));
ok(true, "Didn't crash");
SimpleTest.finish();
}
window.addEventListener("load", init, false);
</script>
<svg:svg datasources="" id="svg"/>
</window>

View file

@ -0,0 +1,51 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="boom();">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="text/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function boom()
{
const RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
var src = window.location.href.replace(/test_bug330010.xul/, "file_bug330010.rdf");
var ds = RDF.GetDataSourceBlocking(src);
var s = document.getElementById("s");
s.setAttribute("datasources", "file_bug330010.rdf");
var x = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "hbox");
var generatedShape = s.childNodes[3];
generatedShape.appendChild(x);
document.documentElement.removeChild(document.getElementById("s"));
ok(true, "Didn't crash");
SimpleTest.finish();
}
]]>
</script>
<html:div datasources="rdf:null" ref="urn:root" flex="1" id="s">
<template>
<rule>
<conditions>
<content uri="?root"/>
<triple subject="?root"
predicate="urn:croczilla:xulsvg1:shapes"
object="?shapes"/>
<member container="?shapes" child="?shape" id="m"/>
</conditions>
<action>
<hbox id="p" uri="?shape" />
</action>
</rule>
</template>
</html:div>
</window>

View file

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" onload="boom();">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
function boom() {
ok(true, "Didn't crash");
SimpleTest.finish();
}
</script>
<html:span datasources="0" />
</window>

View file

@ -0,0 +1,148 @@
<?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"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree flex="20" id="t" ref="urn:data:row" datasources="rdf:null" seltype="single">
<treecols>
<treecol flex="1" id="id" label="id" sort="rdf:http://dummy/rdf#id" />
<splitter class="tree-splitter"/>
<treecol flex="1" id="title" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
</treecols>
<template>
<treechildren>
<treeitem uri="rdf:*" seltype="single">
<treerow >
<treecell label="rdf:http://dummy/rdf#id"/>
<treecell label="rdf:http://dummy/rdf#title"/>
</treerow>
</treeitem>
</treechildren>
</template>
</tree>
<tree flex="20" id="tc" ref="urn:data:row" datasources="rdf:null" seltype="single" flags="dont-build-content">
<treecols>
<treecol flex="1" id="idc" label="id" sort="rdf:http://dummy/rdf#id" />
<splitter class="tree-splitter"/>
<treecol flex="1" id="titlec" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
</treecols>
<template>
<treechildren>
<treeitem uri="rdf:*" seltype="single">
<treerow >
<treecell label="rdf:http://dummy/rdf#id"/>
<treecell label="rdf:http://dummy/rdf#title"/>
</treerow>
</treeitem>
</treechildren>
</template>
</tree>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/x-javascript">
<![CDATA[
var buildCount = 0;
SimpleTest.waitForExplicitFinish();
var TemplateBuilderListener = {
willRebuild: function(aBuilder) {
},
didRebuild: function(aBuilder) {
++buildCount;
var remove = false;
if (buildCount == 2) {
remove =true;
setTimeout(nextDataSource, 0);
} else if (buildCount == 4) {
remove = true;
setTimeout(continueTest, 0);
}
if (remove) {
var tree = document.getElementById('t');
var treec = document.getElementById('tc');
tree.builder.removeListener(TemplateBuilderListener);
treec.builder.removeListener(TemplateBuilderListener);
}
},
QueryInterface: function (aIID)
{
if (!aIID.equals(Components.interfaces.nsIXULBuilderListener) &&
!aIID.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
};
function runTest() {
var tree = document.getElementById('t');
var treec = document.getElementById('tc');
try {
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
var s1 = window.location.href.replace(/test_bug441785.xul/, "bug441785-1.rdf");
var ds1 = rdfService.GetDataSourceBlocking(s1);
var s2 = window.location.href.replace(/test_bug441785.xul/, "bug441785-2.rdf");
var ds2 = rdfService.GetDataSourceBlocking(s2);
} catch (ex) { }
tree.builder.addListener(TemplateBuilderListener);
treec.builder.addListener(TemplateBuilderListener);
tree.setAttribute('datasources', 'bug441785-1.rdf');
treec.setAttribute('datasources', 'bug441785-1.rdf');
}
var oldtreefirstrow, oldtreecfirstrow;
function nextDataSource()
{
var tree = document.getElementById('t');
var treec = document.getElementById('tc');
tree.treeBoxObject.scrollToRow(10);
treec.treeBoxObject.scrollToRow(10);
is(tree.treeBoxObject.getFirstVisibleRow(), 10, "first tree row count datasource 1");
is(treec.treeBoxObject.getFirstVisibleRow(), 10, "second tree row count datasource 1");
tree.builder.addListener(TemplateBuilderListener);
treec.builder.addListener(TemplateBuilderListener);
tree.setAttribute('datasources', 'bug441785-2.rdf');
treec.setAttribute('datasources', 'bug441785-2.rdf');
}
function continueTest() {
var tree = document.getElementById('t');
var treec = document.getElementById('tc');
is(tree.treeBoxObject.getFirstVisibleRow(), 0, "first tree row count datasource 2");
is(treec.treeBoxObject.getFirstVisibleRow(), 0, "second tree row count datasource 2");
try {
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect();
}
catch (e) { }
// Hit the bug, crash
// (not exactly the same kind of crash as 441785, but from the same cause)
tree.parentNode.removeChild(tree);
treec.parentNode.removeChild(treec);
SimpleTest.finish();
}
window.addEventListener("load", runTest, false);
]]>
</script>
</window>

View file

@ -0,0 +1,76 @@
<?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"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=476634
-->
<window title="Mozilla Bug 476634" onload="startup()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=304188">Mozilla Bug 476634</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<template id="test-template">
<query>SELECT id,value FROM test</query>
<action>
<label uri="?" id="?id" value="?value"/>
</action>
</template>
<vbox id="results-list" datasources="rdf:null" querytype="storage" ref="*"
template="test-template"/>
<script class="testbody" type="application/javascript">
<![CDATA[
function startup() {
var ss = Components.classes["@mozilla.org/storage/service;1"]
.getService(Components.interfaces.mozIStorageService);
var db = ss.openSpecialDatabase("memory");
db.createTable("test", "id TEXT, value INTEGER");
var stmt = db.createStatement("INSERT INTO test (id, value) VALUES (?,?)");
stmt.bindByIndex(0, "test1");
stmt.bindByIndex(1, 0);
stmt.execute();
stmt.bindByIndex(0, "test2");
stmt.bindByIndex(1, 2147483647);
stmt.execute();
stmt.bindByIndex(0, "test3");
stmt.bindByIndex(1, -2147483648);
stmt.execute();
stmt.bindByIndex(0, "test4");
stmt.bindByIndex(1, 0);
stmt.execute();
stmt.bindByIndex(0, "test5");
stmt.bindByIndex(1, 3147483647);
stmt.execute();
stmt.bindByIndex(0, "test6");
stmt.bindByIndex(1, -3147483648);
stmt.execute();
stmt.finalize();
var list = document.getElementById("results-list");
list.builder.datasource = db;
is(list.childNodes.length, 6, "Should be 6 generated elements");
is(list.childNodes[0].value, "0", "Should have seen the correct value");
is(list.childNodes[1].value, "2147483647", "Should have seen the correct value");
is(list.childNodes[2].value, "-2147483648", "Should have seen the correct value");
is(list.childNodes[3].value, "0", "Should have seen the correct value");
is(list.childNodes[4].value, "3147483647", "Should have seen the correct value");
is(list.childNodes[5].value, "-3147483648", "Should have seen the correct value");
}
]]>
</script>
</window>

View file

@ -0,0 +1,70 @@
<?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"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox id="box"/>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/x-javascript">
<![CDATA[
var tests = [
[["One", "Two", "Three", "Four"], "", "Four One Three Two"],
[["One", "Two", "Three", "Four"], "integer", "Four One Three Two"],
[["One", "Two", "Three", "Four"], "descending", "Two Three One Four"],
[["One", "Two", "Three", "Four"], "descending integer", "Two Three One Four"],
[["One", "Two", "Three", "Four"], "integer cat descending", "Two Three One Four"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "", "1 12 13 170 2 2 222 240 7 98"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer", "1 2 2 7 12 13 98 170 222 240"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "ascending integer", "1 2 2 7 12 13 98 170 222 240"],
[["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer descending", "240 222 170 98 13 12 7 2 2 1"],
[["Cat", "cat", "Candy", "candy"], "comparecase", "Candy Cat candy cat"],
[["1", "102", "22", "One", "40", "Two"], "integer", "1 22 40 102 One Two"],
];
SimpleTest.waitForExplicitFinish();
function doTests()
{
var box = document.getElementById("box");
const sortService = Components.classes["@mozilla.org/xul/xul-sort-service;1"].
getService(Components.interfaces.nsIXULSortService);
for (let t = 0; t < tests.length; t++) {
var test = tests[t];
for (let e = 0; e < test[0].length; e++) {
var label = document.createElement("label");
label.setAttribute("value", test[0][e]);
box.appendChild(label);
}
sortService.sort(box, "value", test[1]);
var actual = "";
for (let e = 0; e < box.childNodes.length; e++) {
if (actual)
actual += " ";
actual += box.childNodes[e].getAttribute("value");
}
is(actual, test[2], "sorted step " + (t + 1));
while(box.hasChildNodes())
box.removeChild(box.firstChild);
box.removeAttribute("sortDirection");
}
SimpleTest.finish();
}
window.addEventListener("load", doTests, false);
]]>
</script>
</window>

View file

@ -0,0 +1,73 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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 "/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,80 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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 "/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,73 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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: "/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,58 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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: "/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,58 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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: "/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,88 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
<template container="?parent" member="?child">
<rule>
<button uri="?" label="?parent ?child"/>
</rule>
</template>
</vbox>
</window>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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 "/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
<template container="?parent">
<rule>
<button uri="?" label="?parent ?child"/>
</rule>
</template>
</vbox>
</window>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
<template>
<rule>
<button uri="?uri" label="?uri"/>
</rule>
</template>
</vbox>
</window>

View file

@ -0,0 +1,280 @@
<?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"?>
<!--
tests for templates with invalid syntax
-->
<window title="XUL Invalid Template Tests" width="500" height="600"
onload="runTest();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<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>
<![CDATA[
SimpleTest.waitForExplicitFinish();
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService);
function checkConsole(expectedError)
{
var message = consoleService.getMessageArray()[0].message;
is(message, expectedError, "logged message " + expectedError);
}
// each test consists of a pre function executed before the template build, an
// expected error message, and a post function executed after the template build
var tests = [
// <queryset> used in invalid location
{
pre: template => template.insertBefore(document.createElement("queryset"), template.lastChild),
error: "Error parsing template: unexpected <queryset> element",
post: queryset => queryset.parentNode.removeChild(queryset)
},
// no member variable found
{
pre: template => $("action").firstChild.removeAttribute("uri"),
error: "Error parsing template: no member variable found. Action body should have an element with uri attribute",
post: () => $("action").firstChild.setAttribute("uri", "?child")
},
// bad binding subject
{
pre: template => $("binding").removeAttribute("subject"),
error: "Error parsing template: <binding> requires a variable for its subject attribute",
post: () => $("binding").setAttribute("subject", "?child"),
},
// bad binding predicate
{
pre: template => $("binding").removeAttribute("predicate"),
error: "Error parsing template: <binding> element is missing a predicate attribute",
post: () => $("binding").setAttribute("predicate", "http://www.some-fictitious-zoo.com/rdf#name"),
},
// bad binding object
{
pre: template => $("binding").setAttribute("object", "blah"),
error: "Error parsing template: <binding> requires a variable for its object attribute",
post: () => $("binding").setAttribute("object", "?name"),
},
// where condition missing a subject
{
pre: function(template) { var rule = $("rule");
var where = document.createElement("where");
where.setAttribute("subject", "");
where.setAttribute("rel", "equals");
where.setAttribute("value", "Raven");
rule.appendChild(where);
return where; },
error: "Error parsing template: <where> element is missing a subject attribute",
post: function(where) { where.parentNode.removeChild(where); }
},
// where condition missing a rel
{
pre: function(template) { var rule = $("rule");
var where = document.createElement("where");
where.setAttribute("subject", "?name");
where.setAttribute("rel", "");
where.setAttribute("value", "Raven");
rule.appendChild(where);
return where; },
error: "Error parsing template: <where> element is missing a rel attribute",
post: function(where) { where.parentNode.removeChild(where); }
},
// where condition missing a value
{
pre: function(template) { var rule = $("rule");
var where = document.createElement("where");
where.setAttribute("subject", "?name");
where.setAttribute("rel", "equals");
where.setAttribute("value", "");
rule.appendChild(where);
return where; },
error: "Error parsing template: <where> element is missing a value attribute",
post: function(where) { where.parentNode.removeChild(where); }
},
// where condition missing a variable
{
pre: function(template) { var rule = $("rule");
var where = document.createElement("where");
where.setAttribute("subject", "name");
where.setAttribute("rel", "equals");
where.setAttribute("value", "Raven");
rule.appendChild(where);
return where; },
error: "Error parsing template: <where> element must have at least one variable as a subject or value",
post: function(where) { where.parentNode.removeChild(where); }
},
// bad member container
{
pre: template => $("member").setAttribute("container", "blah"),
error: "Error parsing template: <member> requires a variable for its container attribute",
post: () => $("member").setAttribute("container", "?uri"),
},
// bad member child
{
pre: template => $("member").setAttribute("child", "blah"),
error: "Error parsing template: <member> requires a variable for its child attribute",
post: () => $("member").setAttribute("child", "?child"),
},
// bad triple subject
{
pre: template => $("triple").removeAttribute("subject"),
error: "Error parsing template: <triple> requires a variable for its subject attribute",
post: () => $("triple").setAttribute("subject", "?child"),
},
// missing triple predicate
{
pre: template => $("triple").removeAttribute("predicate"),
error: "Error parsing template: <triple> should have a non-variable value as a predicate",
post: () => $("triple").setAttribute("predicate", "http://www.some-fictitious-zoo.com/rdf#name"),
},
// bad triple predicate
{
pre: template => $("triple").setAttribute("predicate", "?predicate"),
error: "Error parsing template: <triple> should have a non-variable value as a predicate",
post: () => $("triple").setAttribute("predicate", "http://www.some-fictitious-zoo.com/rdf#name"),
},
// bad triple object
{
pre: template => $("triple").removeAttribute("object"),
error: "Error parsing template: <triple> requires a variable for its object attribute",
post: () => $("triple").setAttribute("object", "?name"),
},
// content not first element in query
{
pre: function(template) { var content = $("content"); content.parentNode.appendChild(content); return content; },
error: "Error parsing template: expected <content> to be first",
post: content => content.parentNode.insertBefore(content, content.parentNode.firstChild),
},
// member container variable not bound
{
pre: template => $("member").removeAttribute("container"),
error: "Error parsing template: neither container or child variables of <member> has a value",
post: () => $("member").setAttribute("container", "?uri"),
},
// neither triple subject or object variable are bound
{
pre: template => $("triple").setAttribute("subject", "?blah"),
error: "Error parsing template: neither subject or object variables of <triple> has a value",
post: () => $("triple").setAttribute("subject", "?child"),
},
// neither triple subject or object variable are bound
{
pre: function(template) { var triple = $("triple"); triple.setAttribute("subject", "blah");
triple.setAttribute("object", "blah"); },
error: "Error parsing template: <triple> should have at least one variable as a subject or object",
post: function() { var triple = $("triple"); triple.setAttribute("subject", "?uri");
triple.setAttribute("object", "?uri") }
},
// could not parse xml query expression
{
firstXMLTest: true,
pre: function(template) { $("query").setAttribute("expr", "something()"); },
error: "Error parsing template: XPath expression in query could not be parsed",
post: function() { }
},
// could not parse xml assign expression
{
pre: function(template) { var query = $("query");
query.setAttribute("expr", "*");
var assign = document.createElement("assign");
assign.setAttribute("var", "?name");
assign.setAttribute("expr", "something()");
query.appendChild(assign);
return assign; },
error: "Error parsing template: XPath expression in <assign> could not be parsed",
post: function(assign) { assign.parentNode.removeChild(assign); }
},
// could not parse xml binding expression
{
pre: function(template) { $("binding").setAttribute("predicate", "something()"); },
error: "Error parsing template: XPath expression in <binding> could not be parsed",
post: function() { $("binding").setAttribute("predicate", "[name]"); },
},
];
function runTest()
{
var root = $("root");
var template = $("template");
while (test = tests.shift()) {
consoleService.reset();
var context = test.pre(template);
root.builder.rebuild();
checkConsole(test.error);
test.post(context);
// preload and set up for the xml datasource query error tests
if (tests.length && tests[0].firstXMLTest) {
var src = window.location.href.replace(/test_tmpl.*xul/, "animals.xml");
xmlDoc = new XMLHttpRequest();
xmlDoc.open("get", src, false);
xmlDoc.send(null);
var root = $("root");
root.setAttribute("querytype", "xml");
root.setAttribute("datasources", "animals.xml");
$("binding").setAttribute("predicate", "[name]");
function waitForDatasource() {
// wait for the datasource to be available before continuing the test
if (root.builder.datasource instanceof XMLDocument)
runTest();
else
setTimeout(waitForDatasource, 100);
}
setTimeout(waitForDatasource, 0);
return;
}
}
SimpleTest.finish();
}
]]>
</script>
<vbox id="root" datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/birds">
<template id="template">
<query id="query">
<content id="content" uri="?uri"/>
<member id="member" container="?uri" child="?child"/>
<triple id="triple" subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
</query>
<rule id="rule">
<binding id="binding" subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
<action id="action">
<label uri="?child" value="?name"/>
</action>
</rule>
</template>
</vbox>
</window>

View file

@ -0,0 +1,95 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,48 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output"/>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,95 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/humans/robert" value="Robert Sanderson"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value=""/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula? - TarantulaTarantula^ Test"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,131 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,102 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,48 @@
<?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"?>
<!--
invalid syntax - querytype="blah"
-->
<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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output"/>
<script src="templates_shared.js"/>
<script>
<![CDATA[
SimpleTest.waitForExplicitFinish();
var testid ="invalid syntax";
var queryType = "rdf";
var isTreeBuilder = false;
var needsOpen = false;
var notWorkingYet = false;
var notWorkingYetDynamic = false;
var expectedOutput = document.getElementById("output");
Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService).reset();
expectedConsoleMessages.push("Error parsing template: querytype attribute doesn't specify a valid query processor");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null"
ref="http://www.some-fictitious-zoo.com/birds" querytype="blah">
<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>

View file

@ -0,0 +1,117 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<script src="templates_shared.js"/>
<script>
<![CDATA[
SimpleTest.expectAssertions(4);
SimpleTest.waitForExplicitFinish();
var testid ="listbox element";
var queryType = "rdf";
var isTreeBuilder = false;
var needsOpen = false;
var notWorkingYet = false;
var notWorkingYetDynamic = false;
var expectedOutput = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,52 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output"/>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,90 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<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>
</data>
<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 = document.getElementById("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>
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" type="menu" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,121 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<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>
</data>
<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 = document.getElementById("output");
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="rdf:null" 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>

View file

@ -0,0 +1,90 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<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>
</data>
<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 = document.getElementById("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>
<menulist xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,48 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output"/>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label value="Tarantula"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,113 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,58 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,58 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" value="Mammals"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,95 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,117 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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);
expectConsoleMessage(ZOO_NS + 'birds', ZOO_NS + 'birds/emperorpenguin', true, true,
'2 matching rule 1');
},
// 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);
expectConsoleMessage(ZOO_NS + 'birds', ZOO_NS + 'birds/archaeopteryx', true, true,
'2 matching rule 1');
},
// 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);
expectConsoleMessage(ZOO_NS + 'birds', ZOO_NS + 'birds/wren', true, true,
'2 matching rule 1');
},
// 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);
expectConsoleMessage(ZOO_NS + 'birds', ZOO_NS + 'birds/barnowl', false, false,
'2 (active query is 1)');
expectConsoleMessage(ZOO_NS + 'birds', ZOO_NS + 'birds/barnowl', false, true,
'1 (no new active query)');
}
];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" flags="logging"
datasources="rdf:null" 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>

View file

@ -0,0 +1,149 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,63 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,113 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/mammals/llama" value="Mammals"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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 - 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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, 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,117 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
Regenerate template by removing and appending elements
-->
<window title="XUL Template Tests" width="500" height="600"
onload="test_regenerate()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<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>
<![CDATA[
SimpleTest.waitForExplicitFinish();
function test_regenerate()
{
var container = document.getElementById("container");
var node = container.firstChild;
if (node.childNodes.length != 2) {
setTimeout(test_regenerate, 50);
return;
}
container.removeChild(node);
is(node.childNodes.length, 1, "childNodes after removeChild");
container.appendChild(node);
is(node.childNodes.length, 2, "childNodes after appendChild");
SimpleTest.finish();
}
]]>
</script>
<vbox id="container">
<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>
</vbox>
</window>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output"/>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,90 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,58 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,45 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,97 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,86 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,90 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,100 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -0,0 +1,52 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,109 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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 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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,45 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="^^Before Tarantula^"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,45 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula^ and^^ lots ^ more"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -0,0 +1,45 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name"/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/arachnids">
<template id="template">
<label uri="rdf:*" value="Name"/>
</template>
</vbox>
</window>

View file

@ -0,0 +1,45 @@
<?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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="output">
<label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Name is "/>
</data>
<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 = document.getElementById("output");
var changes = [];
]]>
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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 ?"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

View file

@ -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"?>
<!--
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/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
<data id="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"/>
</data>
<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 = document.getElementById("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="rdf:null" 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>

Some files were not shown because too many files have changed in this diff Show more