content/xul/templates/tests/chrome/test_tmpl_regenerate.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_regenerate.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +
     1.8 +<!--
     1.9 +  Regenerate template by removing and appending elements
    1.10 +-->
    1.11 +
    1.12 +<window title="XUL Template Tests" width="500" height="600"
    1.13 +        onload="test_regenerate()"
    1.14 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.15 +  <script type="application/javascript"
    1.16 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.17 +
    1.18 +  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.19 +
    1.20 +<script>
    1.21 +<![CDATA[
    1.22 +SimpleTest.waitForExplicitFinish();
    1.23 +
    1.24 +function test_regenerate()
    1.25 +{
    1.26 +  var container = document.getElementById("container");
    1.27 +  var node = container.firstChild;
    1.28 +
    1.29 +  if (node.childNodes.length != 2) {
    1.30 +    setTimeout(test_regenerate, 50);
    1.31 +    return;
    1.32 +  }
    1.33 +
    1.34 +  container.removeChild(node);
    1.35 +  is(node.childNodes.length, 1, "childNodes after removeChild");
    1.36 +  container.appendChild(node);
    1.37 +  is(node.childNodes.length, 2, "childNodes after appendChild");
    1.38 +  SimpleTest.finish();
    1.39 +}
    1.40 +
    1.41 +]]>
    1.42 +</script>
    1.43 +
    1.44 +<vbox id="container">
    1.45 +<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">
    1.46 +<template zoo:name="Barn Owl" xmlns:zoo="http://www.some-fictitious-zoo.com/rdf#">
    1.47 +<label uri="rdf:*" value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
    1.48 +</template>
    1.49 +</vbox>
    1.50 +</vbox>
    1.51 +
    1.52 +</window>

mercurial