diff options
author | Yehuda Katz <wycats@gmail.com> | 2012-04-15 17:41:54 -0400 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2012-04-15 17:41:54 -0400 |
commit | 6bc08c2b2f04629114ae7ca79c3c2c54320e4908 (patch) | |
tree | 48dd57b8575a5abee26e1cc4870cd78fd1ce49ca /test/data | |
parent | 5181ce0f35cf941ae2d7f5da2cf98ebcc638daff (diff) | |
download | jquery-6bc08c2b2f04629114ae7ca79c3c2c54320e4908.tar.gz jquery-6bc08c2b2f04629114ae7ca79c3c2c54320e4908.zip |
Remove Ajax requirement for simple XML tests
Previously, all jQuery tests that wanted an XML
document would make an Ajax request to go through
jQuery's XML parsing logic in jQuery.ajax. Now,
use jQuery.parseXML instead.
This removes the need for the Ajax server for
these tests, improves their performance, and
decouples simple core tests from Ajax.
(with scottgonzalez)
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/testinit.js | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/test/data/testinit.js b/test/data/testinit.js index 43244e7eb..1f775c1d7 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -1,3 +1,5 @@ +/*jshint multistr:true*/ + var jQuery = this.jQuery || "jQuery", // For testing .noConflict() $ = this.$ || "$", originaljQuery = jQuery, @@ -45,6 +47,53 @@ function t(a,b,c) { deepEqual(f, q.apply(q,c), a + " (" + b + ")"); } + +var createDashboardXML = function() { + var string = '<?xml version="1.0" encoding="UTF-8"?> \ + <dashboard> \ + <locations class="foo"> \ + <location for="bar" checked="different"> \ + <infowindowtab> \ + <tab title="Location"><![CDATA[blabla]]></tab> \ + <tab title="Users"><![CDATA[blublu]]></tab> \ + </infowindowtab> \ + </location> \ + </locations> \ + </dashboard>'; + + return jQuery.parseXML(string); +}; + +var createWithFriesXML = function() { + var string = '<?xml version="1.0" encoding="UTF-8"?> \ + <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \ + xmlns:xsd="http://www.w3.org/2001/XMLSchema" \ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \ + <soap:Body> \ + <jsconf xmlns="http://www.example.com/ns1"> \ + <response xmlns:ab="http://www.example.com/ns2"> \ + <meta> \ + <component id="seite1" class="component"> \ + <properties xmlns:cd="http://www.example.com/ns3"> \ + <property name="prop1"> \ + <thing /> \ + <value>1</value> \ + </property> \ + <property name="prop2"> \ + <thing att="something" /> \ + </property> \ + <foo_bar>foo</foo_bar> \ + </properties> \ + </component> \ + </meta> \ + </response> \ + </jsconf> \ + </soap:Body> \ + </soap:Envelope>'; + + return jQuery.parseXML(string); +}; + var fireNative; if ( document.createEvent ) { fireNative = function( node, type ) { @@ -159,4 +208,4 @@ function url(value) { window.start = function() { oldStart(); }; -})();
\ No newline at end of file +})(); |