Home | History | Annotate | Download | only in script-tests
      1 description('Test of normalize on an XML document with CDATA.');
      2 
      3 var parser = new DOMParser();
      4 var serializer = new XMLSerializer();
      5 
      6 var xmlChunk = parser.parseFromString(
      7     '<foo>' +
      8     'This is some text before the CDATA' +
      9     '<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>' +
     10     'This is some text after the CDATA' +
     11     '</foo>',
     12     'application/xml');
     13 
     14 debug('Before normalize');
     15 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text before the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This is some text after the CDATA</foo>"');
     16 shouldBe('xmlChunk.documentElement.childNodes.length', '3');
     17 xmlChunk.documentElement.normalize();
     18 debug('After normalize');
     19 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text before the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This is some text after the CDATA</foo>"');
     20 shouldBe('xmlChunk.documentElement.childNodes.length', '3');
     21 
     22 var successfullyParsed = true;
     23