diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/ajax/jquery/test/data | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/ajax/jquery/test/data')
19 files changed, 732 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg b/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg Binary files differnew file mode 100644 index 000000000..2c5b67225 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/cow.jpg diff --git a/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml b/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml new file mode 100644 index 000000000..10f6b3347 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/dashboard.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dashboard> + <locations class="foo"> + <location for="bar"> + <infowindowtab> + <tab title="Location"><![CDATA[blabla]]></tab> + <tab title="Users"><![CDATA[blublu]]></tab> + </infowindowtab> + </location> + </locations> +</dashboard> diff --git a/dom/tests/mochitest/ajax/jquery/test/data/iframe.html b/dom/tests/mochitest/ajax/jquery/test/data/iframe.html new file mode 100644 index 000000000..3ff26e161 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/iframe.html @@ -0,0 +1,8 @@ +<html> + <head> + <title>iframe</title> + </head> + <body> + <div><span>span text</span></div> + </body> +</html> diff --git a/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js b/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js new file mode 100644 index 000000000..867251dad --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/json_assigned_obj.js @@ -0,0 +1 @@ +json_assigned_obj = { "test" : "worked" }; diff --git a/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js b/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js new file mode 100644 index 000000000..7fa61820f --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/json_obj.js @@ -0,0 +1 @@ +{ "data": {"lang": "en", "length": 25} } diff --git a/dom/tests/mochitest/ajax/jquery/test/data/name.html b/dom/tests/mochitest/ajax/jquery/test/data/name.html new file mode 100644 index 000000000..0fa32d1a8 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/name.html @@ -0,0 +1 @@ +ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script> diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html new file mode 100644 index 000000000..3bbc8417d --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/absolute.html @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>absolute</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + div.absolute { position: absolute; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; } + #absolute-1 { top: 0; left: 0; } + #absolute-1-1 { top: 1px; left: 1px; } + #absolute-1-1-1 { top: 1px; left: 1px; } + #absolute-2 { top: 19px; left: 19px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + p.instructions { position: absolute; bottom: 0; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + $('.absolute').click(function() { + $('#marker').css( $(this).offset() ); + var pos = $(this).position(); + $(this).css({ top: pos.top, left: pos.left }); + return false; + }); + }); + </script> + </head> + <body> + <div id="absolute-1" class="absolute">absolute-1 + <div id="absolute-1-1" class="absolute">absolute-1-1 + <div id="absolute-1-1-1" class="absolute">absolute-1-1-1</div> + </div> + </div> + <div id="absolute-2" class="absolute">absolute-2</div> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html new file mode 100644 index 000000000..8d69aae94 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/fixed.html @@ -0,0 +1,33 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>fixed</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + div.fixed { position: fixed; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; } + #fixed-1 { top: 0; left: 0; } + #fixed-2 { top: 20px; left: 20px; } + #forceScroll { width: 5000px; height: 5000px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + window.scrollTo(1000,1000); + $('.fixed').click(function() { + $('#marker').css( $(this).offset() ); + return false; + }); + }); + </script> + </head> + <body> + <div id="fixed-1" class="fixed"></div> + <div id="fixed-2" class="fixed"></div> + <div id="forceScroll"></div> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html new file mode 100644 index 000000000..89aae83e4 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>relative</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + div.relative { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; } + #relative-2 { top: 20px; left: 20px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + $('.relative').click(function() { + $('#marker').css( $(this).offset() ); + var pos = $(this).position(); + $(this).css({ position: 'absolute', top: pos.top, left: pos.left }); + return false; + }); + }); + </script> + </head> + <body> + <div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div> + <div id="relative-2" class="relative"></div> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html new file mode 100644 index 000000000..494f64058 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/scroll.html @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>scroll</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + div.scroll { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: auto; } + #scroll-1 { top: 0; left: 0; } + #scroll-1-1 { top: 1px; left: 1px; } + #scroll-1-1-1 { top: 1px; left: 1px; } + #forceScroll { width: 5000px; height: 5000px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + window.scrollTo(1000,1000); + $('#scroll-1')[0].scrollLeft = 5; + $('#scroll-1')[0].scrollTop = 5; + $('.scroll').click(function() { + $('#marker').css( $(this).offset() ); + return false; + }); + }); + </script> + </head> + <body> + <div id="scroll-1" class="scroll"> + <div id="scroll-1-1" class="scroll"> + <div id="scroll-1-1-1" class="scroll"></div> + </div> + </div> + <div id="forceScroll"></div> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html new file mode 100644 index 000000000..10116af65 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/static.html @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>static</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + div.static { position: static; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; } + #static-2 { top: 20px; left: 20px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + $('.static').click(function() { + $('#marker').css( $(this).offset() ); + var pos = $(this).position(); + $(this).css({ position: 'absolute', top: pos.top, left: pos.left }); + return false; + }); + }); + </script> + </head> + <body> + <div id="static-1" class="static"><div id="static-1-1" class="static"><div id="static-1-1-1" class="static"></div></div></div> + <div id="static-2" class="static"></div> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html b/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html new file mode 100644 index 000000000..5d15b903b --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/table.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>table</title> + <style type="text/css" media="screen"> + body { margin: 1px; padding: 5px; } + table { border: 2px solid #000; } + th, td { border: 1px solid #000; width: 100px; height: 100px; } + #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } + </style> + <script type="text/javascript" src="../../../dist/jquery.js"></script> + <script type="text/javascript" charset="utf-8"> + $(function() { + $('table, th, td').click(function() { + $('#marker').css( $(this).offset() ); + return false; + }); + }); + </script> + </head> + <body> + <table id="table-1"> + <thead> + <tr valign="top"> + <th id="th-1">th-1</th> + <th id="th-2">th-2</th> + <th id="th-3">th-3</th> + </tr> + </thead> + <tbody> + <tr valign="top"> + <td id="td-1">td-1</td> + <td id="td-2">td-2</td> + <td id="td-3">td-3</td> + </tr> + </tbody> + </table> + <div id="marker"></div> + <p class="instructions">Click the white box to move the marker to it.</p> + </body> +</html>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test.html b/dom/tests/mochitest/ajax/jquery/test/data/test.html new file mode 100644 index 000000000..fc6dc3860 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/test.html @@ -0,0 +1,7 @@ +html text<br/> +<script type="text/javascript">/* <![CDATA[ */ +testFoo = "foo"; $('#foo').html('foo'); +ok( true, "test.html executed" ); +/* ]]> */</script> +<script src="data/test.js"></script> +blabla diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test.js b/dom/tests/mochitest/ajax/jquery/test/data/test.js new file mode 100644 index 000000000..f8bdd091e --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/test.js @@ -0,0 +1,3 @@ +var foobar = "bar";
+$('#ap').html('bar');
+ok( true, "test.js executed");
diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test2.html b/dom/tests/mochitest/ajax/jquery/test/data/test2.html new file mode 100644 index 000000000..ebf610e43 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/test2.html @@ -0,0 +1,5 @@ +<script type="text/javascript"> +var testFoo = "foo"; +$('#foo').html('foo'); +ok( true, "test2.html executed" ); +</script> diff --git a/dom/tests/mochitest/ajax/jquery/test/data/test3.html b/dom/tests/mochitest/ajax/jquery/test/data/test3.html new file mode 100644 index 000000000..909d41745 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/test3.html @@ -0,0 +1,3 @@ +<div class="user">This is a user</div> +<div class="user">This is a user</div> +<div class="teacher">This is a teacher</div> diff --git a/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js b/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js new file mode 100644 index 000000000..28f1a346c --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/testrunner.js @@ -0,0 +1,334 @@ +var _config = { + fixture: null, + Test: [], + stats: { + all: 0, + bad: 0 + }, + queue: [], + blocking: true, + timeout: null, + expected: null, + currentModule: null, + asyncTimeout: 2 // seconds for async timeout +}; + +_config.filters = location.search.length > 1 && //restrict modules/tests by get parameters + $.map( location.search.slice(1).split('&'), decodeURIComponent ); + +var isLocal = !!(window.location.protocol == 'file:'); + +$(function() { + $('#userAgent').html(navigator.userAgent); + runTest(); +}); + +function synchronize(callback) { + _config.queue[_config.queue.length] = callback; + if(!_config.blocking) { + process(); + } +} + +function process() { + while(_config.queue.length && !_config.blocking) { + var call = _config.queue[0]; + _config.queue = _config.queue.slice(1); + call(); + } +} + +function stop(allowFailure) { + _config.blocking = true; + var handler = allowFailure ? start : function() { + ok( false, "Test timed out" ); + start(); + }; + // Disabled, caused too many random errors + //_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000); +} +function start() { + // A slight delay, to avoid any current callbacks + setTimeout(function(){ + if(_config.timeout) + clearTimeout(_config.timeout); + _config.blocking = false; + process(); + }, 13); +} + +function validTest( name ) { + var filters = _config.filters; + if( !filters ) + return true; + + var i = filters.length, + run = false; + while( i-- ){ + var filter = filters[i], + not = filter.charAt(0) == '!'; + if( not ) + filter = filter.slice(1); + if( name.indexOf(filter) != -1 ) + return !not; + if( not ) + run = true; + } + return run; +} + +function runTest() { + _config.blocking = false; + var time = new Date(); + _config.fixture = document.getElementById('main').innerHTML; + _config.ajaxSettings = $.ajaxSettings; + synchronize(function() { + time = new Date() - time; + $("<div>").html(['<p class="result">Tests completed in ', + time, ' milliseconds.<br/>', + _config.stats.bad, ' tests of ', _config.stats.all, ' failed.</p>'] + .join('')) + .appendTo("body"); + $("#banner").addClass(_config.stats.bad ? "fail" : "pass"); + if ( parent.runAJAXTest ) + parent.runAJAXTest(); + + }); +} + +function test(name, callback, nowait) { + if(_config.currentModule) + name = _config.currentModule + " module: " + name; + + if ( !validTest(name) ) + return; + + synchronize(function() { + _config.Test = []; + try { + callback(); + } catch(e) { + if( typeof console != "undefined" && console.error && console.warn ) { + console.error("Test " + name + " died, exception and test follows"); + console.error(e); + console.warn(callback.toString()); + } + _config.Test.push( [ false, "Died on test #" + (_config.Test.length+1) + ": " + e.message ] ); + } + }); + synchronize(function() { + reset(); + + // don't output pause tests + if(nowait) return; + + if(_config.expected && _config.expected != _config.Test.length) { + _config.Test.push( [ false, "Expected " + _config.expected + " assertions, but " + _config.Test.length + " were run" ] ); + } + _config.expected = null; + + var good = 0, bad = 0; + var ol = document.createElement("ol"); + ol.style.display = "none"; + var li = "", state = "pass"; + for ( var i = 0; i < _config.Test.length; i++ ) { + var li = document.createElement("li"); + li.className = _config.Test[i][0] ? "pass" : "fail"; + li.innerHTML = _config.Test[i][1]; + ol.appendChild( li ); + + _config.stats.all++; + if ( !_config.Test[i][0] ) { + state = "fail"; + bad++; + _config.stats.bad++; + } else good++; + + if ( parent.SimpleTest ){ + parent.SimpleTest.ok( _config.Test[i][0], name, _config.Test[i][1] );} + } + + var li = document.createElement("li"); + li.className = state; + + var b = document.createElement("strong"); + b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + _config.Test.length + ")</b>"; + b.onclick = function(){ + var n = this.nextSibling; + if ( jQuery.css( n, "display" ) == "none" ) + n.style.display = "block"; + else + n.style.display = "none"; + }; + $(b).dblclick(function(event) { + var target = jQuery(event.target).filter("strong").clone(); + if ( target.length ) { + target.children().remove(); + location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text())); + } + }); + li.appendChild( b ); + li.appendChild( ol ); + + document.getElementById("tests").appendChild( li ); + }); +} + +// call on start of module test to prepend name to all tests +function module(moduleName) { + _config.currentModule = moduleName; +} + +/** + * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + */ +function expect(asserts) { + _config.expected = asserts; +} + +/** + * Resets the test setup. Useful for tests that modify the DOM. + */ +function reset() { + $("#main").html( _config.fixture ); + $.event.global = {}; + $.ajaxSettings = $.extend({}, _config.ajaxSettings); +} + +/** + * Asserts true. + * @example ok( $("a").size() > 5, "There must be at least 5 anchors" ); + */ +function ok(a, msg) { + _config.Test.push( [ !!a, msg ] ); +} + +/** + * Asserts that two arrays are the same + */ +function isSet(a, b, msg) { + var ret = true; + if ( a && b && a.length != undefined && a.length == b.length ) { + for ( var i = 0; i < a.length; i++ ) + if ( a[i] != b[i] ) + ret = false; + } else + ret = false; + if ( !ret ) + _config.Test.push( [ ret, msg + " expected: " + serialArray(b) + " result: " + serialArray(a) ] ); + else + _config.Test.push( [ ret, msg ] ); +} + +/** + * Asserts that two objects are equivalent + */ +function isObj(a, b, msg) { + var ret = true; + + if ( a && b ) { + for ( var i in a ) + if ( a[i] != b[i] ) + ret = false; + + for ( i in b ) + if ( a[i] != b[i] ) + ret = false; + } else + ret = false; + + _config.Test.push( [ ret, msg ] ); +} + +function serialArray( a ) { + var r = []; + + if ( a && a.length ) + for ( var i = 0; i < a.length; i++ ) { + var str = a[i].nodeName; + if ( str ) { + str = str.toLowerCase(); + if ( a[i].id ) + str += "#" + a[i].id; + } else + str = a[i]; + r.push( str ); + } + + return "[ " + r.join(", ") + " ]"; +} + +/** + * Returns an array of elements with the given IDs, eg. + * @example q("main", "foo", "bar") + * @result [<div id="main">, <span id="foo">, <input id="bar">] + */ +function q() { + var r = []; + for ( var i = 0; i < arguments.length; i++ ) + r.push( document.getElementById( arguments[i] ) ); + return r; +} + +/** + * Asserts that a select matches the given IDs + * @example t("Check for something", "//[a]", ["foo", "baar"]); + * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar' + */ +function t(a,b,c) { + var f = jQuery(b); + var s = ""; + for ( var i = 0; i < f.length; i++ ) + s += (s && ",") + '"' + f[i].id + '"'; + isSet(f, q.apply(q,c), a + " (" + b + ")"); +} + +/** + * Add random number to url to stop IE from caching + * + * @example url("data/test.html") + * @result "data/test.html?10538358428943" + * + * @example url("data/test.php?foo=bar") + * @result "data/test.php?foo=bar&10538358345554" + */ +function url(value) { + return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000); +} + +/** + * Checks that the first two arguments are equal, with an optional message. + * Prints out both expected and actual values on failure. + * + * Prefered to ok( expected == actual, message ) + * + * @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) ); + * + * @param Object actual + * @param Object expected + * @param String message (optional) + */ +function equals(actual, expected, message) { + var result = expected == actual; + message = message || (result ? "okay" : "failed"); + _config.Test.push( [ result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual ] ); +} + +/** + * Trigger an event on an element. + * + * @example triggerEvent( document.body, "click" ); + * + * @param DOMElement elem + * @param String type + */ +function triggerEvent( elem, type, event ) { + if ( jQuery.browser.mozilla || jQuery.browser.opera ) { + event = document.createEvent("MouseEvents"); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + elem.dispatchEvent( event ); + } else if ( jQuery.browser.msie ) { + elem.fireEvent("on"+type); + } +}
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css b/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css new file mode 100644 index 000000000..4801becd6 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/testsuite.css @@ -0,0 +1,117 @@ +body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 } +body {font-size: 10pt; } +h1 { padding: 15px; font-size: large; background-color: #06b; color: white; } +h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal } + +.pass { color: green; } +.fail { color: red; } +p.result { margin-left: 1em; } + +#banner { height: 2em; border-bottom: 1px solid white; } +h2.pass { background-color: green; } +h2.fail { background-color: red; } + +ol#tests > li > strong { cursor:pointer; } + +div#fx-tests h4 { + background: red; +} + +div#fx-tests h4.pass { + background: green; +} + +div#fx-tests div.box { + background: red url(data/cow.jpg) no-repeat; + overflow: hidden; + border: 2px solid #000; +} + +div#fx-tests div.overflow { + overflow: visible; +} + +div.inline { + display: inline; +} + +div.autoheight { + height: auto; +} + +div.autowidth { + width: auto; +} + +div.autoopacity { + opacity: auto; +} + +div.largewidth { + width: 100px; +} + +div.largeheight { + height: 100px; +} + +div.largeopacity { + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100); +} + +div.medwidth { + width: 50px; +} + +div.medheight { + height: 50px; +} + +div.medopacity { + opacity: 0.5; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); +} + +div.nowidth { + width: 0px; +} + +div.noheight { + height: 0px; +} + +div.noopacity { + opacity: 0; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); +} + +div.hidden { + display: none; +} + +div#fx-tests div.widewidth { + background-repeat: repeat-x; +} + +div#fx-tests div.wideheight { + background-repeat: repeat-y; +} + +div#fx-tests div.widewidth.wideheight { + background-repeat: repeat; +} + +div#fx-tests div.noback { + background-image: none; +} + +div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; } +div.chain div { position: absolute; top: 0px; left: 0px; } + +div.chain.test { background: red; } +div.chain.test div { background: green; } + +div.chain.out { background: green; } +div.chain.out div { background: red; display: none; } + +div#show-tests * { display: none; }
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml b/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml new file mode 100644 index 000000000..88e0e49d5 --- /dev/null +++ b/dom/tests/mochitest/ajax/jquery/test/data/with_fries.xml @@ -0,0 +1,25 @@ +<?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"> + <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> |