diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/tests/mochitest/ajax/prototype/test/unit/fixtures | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests/mochitest/ajax/prototype/test/unit/fixtures')
25 files changed, 830 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html new file mode 100644 index 0000000000..4af5e267ac --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.html @@ -0,0 +1,2 @@ +<div id="content"></div> +<div id="content2" style="color:red"></div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js new file mode 100644 index 0000000000..8487943f73 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/ajax.js @@ -0,0 +1,42 @@ +var Fixtures = { + js: { + responseBody: '$("content").update("<H2>Hello world!</H2>");', + 'Content-Type': ' text/javascript ' + }, + + html: { + responseBody: "Pack my box with <em>five dozen</em> liquor jugs! " + + "Oh, how <strong>quickly</strong> daft jumping zebras vex..." + }, + + xml: { + responseBody: '<?xml version="1.0" encoding="UTF-8" ?><name attr="foo">bar</name>', + 'Content-Type': 'application/xml' + }, + + json: { + responseBody: '{\n\r"test": 123}', + 'Content-Type': 'application/json' + }, + + jsonWithoutContentType: { + responseBody: '{"test": 123}' + }, + + invalidJson: { + responseBody: '{});window.attacked = true;({}', + 'Content-Type': 'application/json' + }, + + headerJson: { + 'X-JSON': '{"test": "hello #éà"}' + } +}; + +var responderCounter = 0; + +// lowercase comparison because of MSIE which presents HTML tags in uppercase +var sentence = ("Pack my box with <em>five dozen</em> liquor jugs! " + +"Oh, how <strong>quickly</strong> daft jumping zebras vex...").toLowerCase(); + +var message = 'You must be running your tests from rake to test this feature.';
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html new file mode 100644 index 0000000000..8f091878c8 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/array.html @@ -0,0 +1 @@ +<div id="test_node">22<span id="span_1"></span><span id="span_2"></span></div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html new file mode 100644 index 0000000000..5a08fbd554 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.html @@ -0,0 +1,6 @@ +<div id="test"></div> +<ul id="list"> + <li></li> + <li></li> + <li></li> +</ul>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js new file mode 100644 index 0000000000..8e9e00bd54 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/base.js @@ -0,0 +1,106 @@ +var Person = function(name){ + this.name = name; +}; + +Person.prototype.toJSON = function() { + return '-' + this.name; +}; + +var arg1 = 1; +var arg2 = 2; +var arg3 = 3; +function TestObj() { }; +TestObj.prototype.assertingEventHandler = + function(event, assertEvent, assert1, assert2, assert3, a1, a2, a3) { + assertEvent(event); + assert1(a1); + assert2(a2); + assert3(a3); + }; + +var globalBindTest = null; + + +// base class +var Animal = Class.create({ + initialize: function(name) { + this.name = name; + }, + name: "", + eat: function() { + return this.say("Yum!"); + }, + say: function(message) { + return this.name + ": " + message; + } +}); + +// subclass that augments a method +var Cat = Class.create(Animal, { + eat: function($super, food) { + if (food instanceof Mouse) return $super(); + else return this.say("Yuk! I only eat mice."); + } +}); + +// empty subclass +var Mouse = Class.create(Animal, {}); + +//mixins +var Sellable = { + getValue: function(pricePerKilo) { + return this.weight * pricePerKilo; + }, + + inspect: function() { + return '#<Sellable: #{weight}kg>'.interpolate(this); + } +}; + +var Reproduceable = { + reproduce: function(partner) { + if (partner.constructor != this.constructor || partner.sex == this.sex) + return null; + var weight = this.weight / 10, sex = Math.random(1).round() ? 'male' : 'female'; + return new this.constructor('baby', weight, sex); + } +}; + +// base class with mixin +var Plant = Class.create(Sellable, { + initialize: function(name, weight) { + this.name = name; + this.weight = weight; + }, + + inspect: function() { + return '#<Plant: #{name}>'.interpolate(this); + } +}); + +// subclass with mixin +var Dog = Class.create(Animal, Reproduceable, { + initialize: function($super, name, weight, sex) { + this.weight = weight; + this.sex = sex; + $super(name); + } +}); + +// subclass with mixins +var Ox = Class.create(Animal, Sellable, Reproduceable, { + initialize: function($super, name, weight, sex) { + this.weight = weight; + this.sex = sex; + $super(name); + }, + + eat: function(food) { + if (food instanceof Plant) + this.weight += food.weight; + }, + + inspect: function() { + return '#<Ox: #{name}>'.interpolate(this); + } +});
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html new file mode 100644 index 0000000000..ee3701d3c3 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/content.html @@ -0,0 +1 @@ +Pack my box with <em>five dozen</em> liquor jugs! Oh, how <strong>quickly</strong> daft jumping zebras vex...
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json new file mode 100644 index 0000000000..85391eb939 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/data.json @@ -0,0 +1 @@ +{test: 123}
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css new file mode 100644 index 0000000000..453a569c26 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.css @@ -0,0 +1,85 @@ +#style_test_1 { cursor: pointer; font-size:12px;} +div.style-test { margin-left: 1px } + +#style_test_dimensions_container { + position: absolute; + top: 0; + left: 500px; + width: 20px; + height: 30px; + margin: 10px; + padding: 10px; + border: 3px solid red; +} + +#not_floating_style { float: none } +#floating_style { float: left } +#op2 { opacity:0.5;filter:alpha(opacity=50)progid:DXImageTransform.Microsoft.Blur(strength=10);} + +#scroll_test_1 { + margin: 10px; + padding: 10px; + position: relative; +} + +#scroll_test_2 { + position: absolute; + left: 10px; + top: 10px; +} + +#dimensions-visible, +#dimensions-display-none, +#dimensions-visible-pos-rel, +#dimensions-display-none-pos-rel, +#dimensions-visible-pos-abs, +#dimensions-display-none-pos-abs { + font-size: 10px; + height: 10em; + width: 20em; +} + +#dimensions-visible-pos-abs, +#dimensions-display-none-pos-abs { + position: absolute; + top: 15px; + left: 15px; +} + +#dimensions-visible-pos-rel, +#dimensions-display-none-pos-rel { + position: relative; + top: 15px; + left: 15px; +} + +#dimensions-display-none, #dimensions-display-none-pos-rel, #dimensions-display-none-pos-abs { + display: none; +} + +#dimensions-table, #dimensions-tbody, #dimensions-tr, #dimensions-td { + font-size: 10px; + margin: 0; + padding: 0; + border: 0; + border-spacing: 0; + height: 10em; + width: 20em; +} + + +#notInlineAbsoluted { position: absolute; } + +#elementToViewportDimensions { + position: absolute; + top: 0; + left: 0; + height: 10px; + width: 10px; + background: #000; +} + +/* for scroll test on really big screens */ +body { + height: 40000px; +}
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html new file mode 100644 index 0000000000..1273098e6d --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.html @@ -0,0 +1,285 @@ +<div id="scroll_test_1"> + <p id="scroll_test_2">Scroll test</p> +</div> + +<div id="test-visible">visible</div> +<div id="test-hidden" style="display:none;">hidden</div> +<div id="test-toggle-visible">visible</div> +<div id="test-toggle-hidden" style="display:none;">hidden</div> +<div id="test-hide-visible">visible</div> +<div id="test-hide-hidden" style="display:none;">hidden</div> +<div id="test-show-visible">visible</div> +<div id="test-show-hidden" style="display:none;">hidden</div> +<div id="removable-container"><div id="removable"></div></div> + +<div> + <table> + <tbody id="table"> + <tr> + <td>Data</td> + </tr> + <tr> + <td id="a_cell">First Row</td> + </tr> + <tr id="second_row"> + <td>Second Row</td> + </tr> + </tbody> + </table> +</div> + +<div id="table-container-to-replace"> + <table> + <tbody id="table-to-replace"> + <tr> + <td>Data</td> + </tr> + <tr> + <td id="a_cell-to-replace">First Row</td> + </tr> + <tr id="second_row-to-replace"> + <td>Second Row</td> + </tr> + </tbody> + </table> +</div> + +<p class="test">Test paragraph outside of container</p> + +<div id="container"> + <p class="test" id="intended">Test paragraph 1 inside of container</p> + <p class="test">Test paragraph 2 inside of container</p> + <p class="test">Test paragraph 3 inside of container</p> + <p class="test">Test paragraph 4 inside of container</p> +</div> + +<div id="testdiv">to be updated</div> +<div id="testdiv-replace-container-1"><div id="testdiv-replace-1"></div></div> +<div id="testdiv-replace-container-2"><div id="testdiv-replace-2"></div></div> +<div id="testdiv-replace-container-3"><div id="testdiv-replace-3"></div></div> +<div id="testdiv-replace-container-4"><div id="testdiv-replace-4"></div></div> +<div id="testdiv-replace-container-5"><div id="testdiv-replace-5"></div></div> +<div id="testdiv-replace-container-element"><div id="testdiv-replace-element"></div></div> +<div id="testdiv-replace-container-toelement"><div id="testdiv-replace-toelement"></div></div> +<div id="testdiv-replace-container-tohtml"><div id="testdiv-replace-tohtml"></div></div> +<div id="testtable-replace-container"><table id="testtable-replace"></table></div> +<table id="testrow-replace-container"><tr id="testrow-replace"></tr></table> +<select id="testoption-replace-container"><option id="testoption-replace"></option><option>stays</option></select> +<div id="testform-replace-container"><p>some text</p><form id="testform-replace"><input id="testinput-replace" type="text" /></form><p>some text</p></div> + +<div id="element_with_visible_overflow" style="overflow:visible">V</div> +<div id="element_with_hidden_overflow" style="overflow:hidden">H</div> +<div id="element_with_scroll_overflow" style="overflow:scroll">S</div> + +<div id="element_extend_test"> </div> + +<div id="element_reextend_test"><div id="discard_1"></div></div> + +<div id="test_whitespace"> <span> </span> + + +<div><div></div> </div><span> </span> +</div> + + +<div id="nav_tests_isolator"> + <div id="nav_test_first_sibling"></div> + <div></div> + <p id="nav_test_p" class="test"></p> + <span id="nav_test_prev_sibling"></span> + + <ul id="navigation_test" style="display: none"> + <!-- comment node to screw things up --> + <li class="first"><em>A</em></li> + <li><em class="dim">B</em></li> + <li id="navigation_test_c"> + <em>C</em> + <ul> + <li><em class="dim">E</em></li> + <li id="navigation_test_f"><em>F</em></li> + </ul> + </li> + <li class="last"><em>D</em></li> + </ul> + + <div id="navigation_test_next_sibling"> + <!-- --> + </div> + + <p></p> +</div> + +<div id="class_names"> + <p class="A"></p> + <ul class="A B" id="class_names_ul"> + <li class="C"></li> + <li class="A C"></li> + <li class="1"></li> + </ul> + <div class="B C D"></div> + <div id="unextended"></div> +</div> + +<div id="style_test_1" style="display:none;"></div> +<div id="style_test_2" class="style-test" style="font-size:11px;"></div> + +<div id="style_test_3">blah</div> +<span id="style_test_4">blah</span> +<span id="style_test_5">blah</span> + +<div id="style_test_dimensions_container"> + <div id="style_test_dimensions" style="background:#ddd;padding:1px;margin:1px;border:1px solid #00f"><div style="height:5px;background:#eee;width:5px;padding:2px;margin:2px;border:2px solid #0f0"> </div> + </div> +</div> + +<div id="test_csstext_1">test_csstext_1</div> +<div id="test_csstext_2">test_csstext_2</div> +<div id="test_csstext_3" style="border: 1px solid red">test_csstext_3</div> +<div id="test_csstext_4" style="font-size: 20px">test_csstext_4</div> +<div id="test_csstext_5">test_csstext_5</div> + +<div id="custom_attributes"> + <div foo="1" bar="2"></div> + <div foo="2"></div> +</div> + +<div id="cloned_element_attributes_issue" foo="original"></div> +<a id="attributes_with_issues_1" href="test.html" accesskey="L" tabindex="50" title="a link" onclick="alert('hello world');"></a> +<a id="attributes_with_issues_2" href="" accesskey="" tabindex="" title=""></a> +<a id="attributes_with_issues_3"></a> +<form id="attributes_with_issues_form" method="post" action="blah" class="blah-class"> + <input type="hidden" id="id" /> + <input type="hidden" name="id" /> + <input type="checkbox" id="action" /> + <input type="checkbox" name="action" /> + <input type="text" id="method" /> + <input type="hidden" name="class" /> + <input type="checkbox" id="attributes_with_issues_checked" name="a" checked="checked"/> + <input type="checkbox" id="attributes_with_issues_disabled" name="b" checked="checked" disabled="disabled"/> + <input type="text" id="attributes_with_issues_readonly" name="c" readonly="readonly" value="blech"/> + <input type="text" id="attributes_with_issues_regular" name="d" value="0"/> + <input type="date" id="attributes_with_issues_type" value="blech" /> + <select id="attributes_with_issues_multiple" name="e" multiple="multiple"> + <option>blech</option> + <option>blah</option> + </select> +</form> + +<!-- writeAttributes --> +<p id="write_attribute_para"></p> +<a id="write_attribute_link" href="test.html"></a> +<form action="/dev/null" id="write_attribute_form" method="get" accept-charset="utf-8"> + <label id="write_attribute_label"></label> + <input type="checkbox" name="write_attribute_checkbox" value="" id="write_attribute_checkbox"> + <input type="checkbox" checked="checked" name="write_attribute_checked_checkbox" value="" id="write_attribute_checked_checkbox"> + <input type="text" name="write_attribute_input" value="" id="write_attribute_input"> + <select id="write_attribute_select"> + <option>Cat</option> + <option>Dog</option> + </select> +</form> + +<table id="write_attribute_table" cellpadding="6" cellspacing="4"> + <tr><td id="write_attribute_td">A</td><td>B</td></tr> + <tr><td>C</td></tr> + <tr><td>D</td><td>E</td><td>F</td></tr> +</table> + +<div id="dom_attribute_precedence"> + <form action="blech" method="post"> + <input type="submit" id="update" /> + </form> +</div> + +<div id="not_floating_none">NFN</div> +<div id="not_floating_inline" style="float:none">NFI</div> +<div id="not_floating_style">NFS</div> + +<div id="floating_inline" style="float:left">FI</div> +<div id="floating_style">FS</div> +<!-- Test Element opacity functions --> +<img id="op1" alt="op2" src="fixtures/logo.gif" style="opacity:0.5;filter:alpha(opacity=50)" /> +<img id="op2" alt="op2" src="fixtures/logo.gif"/> +<img id="op3" alt="op3" src="fixtures/logo.gif"/> +<img id="op4-ie" alt="op3" src="fixtures/logo.gif" style="filter:alpha(opacity=30)" /> +<div id="dimensions-visible"></div> +<div id="dimensions-display-none"></div> +<div id="dimensions-visible-pos-rel"></div> +<div id="dimensions-display-none-pos-rel"></div> +<div id="dimensions-visible-pos-abs"></div> +<div id="dimensions-display-none-pos-abs"></div> +<table border="0" cellspacing="0" cellpadding="0" id="dimensions-table"> + <tbody id="dimensions-tbody"> + <tr id="dimensions-tr"> + <td id="dimensions-td">Data</td> + </tr> + </tbody> +</table> + +<div id="dimensions-nester" style="width: 500px;"> + <div id="dimensions-nestee" style="display: none">This is a nested DIV. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div> +</div> + + +<p id="test-empty"></p> +<p id="test-empty-but-contains-whitespace"> + + +</p> +<p id="test-full">content</p> +<div id="ancestor"> + <div id="child"> + <div id="grand-child"> + <div id="great-grand-child"></div> + </div></div><!-- intentional formatting; don't change this line --> + <div id="sibling"><div id="grand-sibling"></div></div> +</div> +<div id="not-in-the-family"></div> + +<div id="insertions-container"><div id="insertions-main"><p>some content.</p></div></div> +<div id="insertions-node-container"><div id="insertions-node-main"><p>some content.</p></div></div> +<div id="element-insertions-container"><div id="element-insertions-main"><p>some content.</p></div></div> +<div id="element-insertions-multiple-container"><div id="element-insertions-multiple-main"><p>some content.</p></div></div> +<table id="table_for_insertions"></table> +<table id="table_for_row_insertions"><tr id="row_1"></tr></table> +<form method="post" action="blah"> + <select id="select_for_update" name="select_for_update"> + <option>option 1</option> + <option>option 2</option> + </select> + <select id="select_for_insert_bottom" name="select_for_insert_bottom"> + <option>option 1</option> + <option>option 2</option> + </select> + <select id="select_for_insert_top" name="select_for_insert_top"> + <option>option 1</option> + <option>option 2</option> + </select> +</form> +<div id="wrap-container"><p id="wrap"></p></div> + +<!-- Positioning methods bench --> +<div id="body_absolute" style="position: absolute; top: 10px; left: 10px"> + <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div> + <div id="absolute_relative" style="position: relative; top: 10px; left:10px"> + <div style="height:10px;font-size:2px">test<span id="inline">test</span></div> + <div id="absolute_relative_undefined">XYZ</div> + </div> + <div id="absolute_fixed" style="position: fixed; top: 10px; left: 10px"> + <span id="absolute_fixed_absolute" style="position: absolute; top: 10px; left: 10px">foo</span> + <span id="absolute_fixed_undefined" style="display:block">bar</span> + </div></div> +<div id="notInlineAbsoluted"></div> +<div id="inlineAbsoluted" style="position: absolute"></div> + +<div id="unextended"></div> +<div id="identification"> + <div id="predefined_id"></div> + <div></div> + <div></div> + <div></div> + <div id="anonymous_element_3"></div> +</div> + +<div id='elementToViewportDimensions' style='display: none'></div> +<div id="auto_dimensions" style="height:auto"></div>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js new file mode 100644 index 0000000000..18f62f354c --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/dom.js @@ -0,0 +1,17 @@ +var testVar = 'to be updated', testVar2 = '', documentViewportProperties; + +Element.addMethods({ + hashBrowns: function(element) { return 'hash browns'; } +}); + +Element.addMethods("LI", { + pancakes: function(element) { return "pancakes"; } +}); + +Element.addMethods("DIV", { + waffles: function(element) { return "waffles"; } +}); + +Element.addMethods($w("li div"), { + orangeJuice: function(element) { return "orange juice"; } +});
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html new file mode 100644 index 0000000000..583d0e5f30 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.html @@ -0,0 +1,4 @@ +<form id="form"> + <input type="text" id="input" value="4" /> + <input type="submit" /> +</form>
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js new file mode 100644 index 0000000000..22b1c3fd14 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/element_mixins.js @@ -0,0 +1,2 @@ +Form.Element.Methods.coffee = Prototype.K; +Element.addMethods();
\ No newline at end of file diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.html diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/empty.js @@ -0,0 +1 @@ + diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html new file mode 100644 index 0000000000..5e7e8f3b3c --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.html @@ -0,0 +1,8 @@ +<table id="grepTable"> +<tbody id="grepTBody"> + <tr id="grepRow"> + <th id="grepHeader" class="cell"></th> + <td id="grepCell" class="cell"></td> + </tr> +</tbody> +</table> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js new file mode 100644 index 0000000000..5fae7662dd --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/enumerable.js @@ -0,0 +1,23 @@ +var Fixtures = { + People: [ + {name: 'Sam Stephenson', nickname: 'sam-'}, + {name: 'Marcel Molina Jr.', nickname: 'noradio'}, + {name: 'Scott Barron', nickname: 'htonl'}, + {name: 'Nicholas Seckar', nickname: 'Ulysses'} + ], + + Nicknames: $w('sam- noradio htonl Ulysses'), + + Basic: [1, 2, 3], + + Primes: [ + 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, + 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, + 71, 73, 79, 83, 89, 97 + ], + + Z: [] +}; + +for (var i = 1; i <= 100; i++) + Fixtures.Z.push(i); diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html new file mode 100644 index 0000000000..baa88a7d10 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/event.html @@ -0,0 +1,4 @@ +<div id="outer" style="display: none"> + <p id="inner">One two three <span id="span">four</span></p> +</div> +<div id="container"><div></div></div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html new file mode 100644 index 0000000000..dc7f171bf2 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/form.html @@ -0,0 +1,112 @@ +<form id="form" method="get" action="fixtures/empty.js"> + <input type="text" name="val1" id="input_enabled" value="4" /> + <div>This is not a form element</div> + <input type="text" name="val2" id="input_disabled" disabled="disabled" value="5" /> + <input type="submit" name="first_submit" value="Commit it!" /> + <input type="submit" name="second_submit" value="Delete it!" /> + <input type="text" name="action" value="blah" /> +</form> + +<form id="bigform" method="get" action="fixtures/empty.js"> + <div id="inputs"> + <input type="text" name="dummy" id="dummy_disabled" disabled="disabled"/> + <input type="submit" name="commit" id="submit" /> + <input type="button" name="clicky" value="click me" /> + <input type="reset" name="revert" /> + <input type="text" name="greeting" id="focus_text" value="Hello" /> + </div> + + <div id="buttons"> + <button type="button" id="button_type_button" name="button">Click Me</button> + </div>div> + + <!-- some edge cases in serialization --> + <div id="value_checks"> + <input name="twin" type="text" value="" /> + <input name="twin" type="text" value="siamese" /> + <!-- Rails checkbox hack with hidden input: --> + <input name="checky" type="checkbox" id="checkbox_hack" value="1" /> + <input name="checky" type="hidden" value="0" /> + </div> + + <!-- all variations of SELECT controls --> + <div id="selects_wrapper"> + <select name="vu"> + <option value="1" selected="selected">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <select id="multiSel1" name="vm[]" multiple="multiple"> + <option id="multiSel1_opt1" value="1" selected="selected">One</option> + <option id="multiSel1_opt2" value="2">Two</option> + <option id="multiSel1_opt3" value="3" selected="selected">Three</option> + </select> + <select name="nvu"> + <option selected="selected">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + + <fieldset id="selects_fieldset"> + <select name="nvm[]" multiple="multiple"> + <option selected="selected">One</option> + <option>Two</option> + <option selected="selected">Three</option> + </select> + <select name="evu"> + <option value="" selected="selected">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <select name="evm[]" multiple="multiple"> + <option value="" selected="selected">One</option> + <option>Two</option> + <option selected="selected">Three</option> + </select> + </fieldset> + </div> + + <div id="various"> + <select name="tf_selectOne"><option selected="selected"></option><option>1</option></select> + <textarea name="tf_textarea"></textarea> + <input type="checkbox" name="tf_checkbox" value="on" /> + <select name="tf_selectMany" multiple="multiple"></select> + <input type="text" name="tf_text" /> + <div>This is not a form element</div> + <input type="radio" name="tf_radio" value="on" /> + <input type="hidden" name="tf_hidden" /> + <input type="password" name="tf_password" /> + </div> +</form> + +<form id="form_focus_hidden" style="display: none"> + <input type="text" /> +</form> + +<form id="form_with_file_input"> + <input type="file" name="file_name" value="foo" /> +</form> + +<!-- tabindexed forms --> +<div id="tabindex"> + <form id="ffe"> + <p><input type="text" disabled="disabled" id="ffe_disabled" /></p> + <input type="hidden" id="ffe_hidden" /> + <input type="checkbox" id="ffe_checkbox" /> + </form> + + <form id="ffe_ti"> + <p><input type="text" disabled="disabled" id="ffe_ti_disabled" /></p> + <input type="hidden" id="ffe_ti_hidden" /> + <input type="checkbox" id="ffe_ti_checkbox" /> + <input type="submit" id="ffe_ti_submit" tabindex="1" /> + </form> + + <form id="ffe_ti2"> + <p><input type="text" disabled="disabled" id="ffe_ti2_disabled" /></p> + <input type="hidden" id="ffe_ti2_hidden" /> + <input type="checkbox" id="ffe_ti2_checkbox" tabindex="0" /> + <input type="submit" id="ffe_ti2_submit" tabindex="1" /> + </form> + +</div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js new file mode 100644 index 0000000000..be5ccfa7d9 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hash.js @@ -0,0 +1,25 @@ +var Fixtures = { + one: { a: 'A#' }, + + many: { + a: 'A', + b: 'B', + c: 'C', + d: 'D#' + }, + + functions: { + quad: function(n) { return n*n }, + plus: function(n) { return n+n } + }, + + multiple: { color: $w('r g b') }, + multiple_nil: { color: ['r', null, 'g', undefined, 0] }, + multiple_all_nil: { color: [null, undefined] }, + multiple_empty: { color: [] }, + multiple_special: { 'stuff[]': $w('$ a ;') }, + + value_undefined: { a:"b", c:undefined }, + value_null: { a:"b", c:null }, + value_zero: { a:"b", c:0 } +}; diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js new file mode 100644 index 0000000000..63d81117bf --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/hello.js @@ -0,0 +1 @@ +$("content").update("<H2>Hello world!</H2>"); diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif Binary files differnew file mode 100644 index 0000000000..71574abd76 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/logo.gif diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html new file mode 100644 index 0000000000..5fd7bdf4b6 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/position.html @@ -0,0 +1,9 @@ +<div id="ensure_scrollbars" style="width:10000px; height:10000px; position:absolute" > </div> + +<div id="body_absolute" style="position: absolute; top: 10px; left: 10px"> + <div id="absolute_absolute" style="position: absolute; top: 10px; left:10px"> </div> + <div id="absolute_relative" style="position: relative; top: 10px; left:10px"> + <div style="height:10px;font-size:2px">test<span id="inline">test</span></div> + <div id="absolute_relative_undefined"> </div> + </div> +</div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html new file mode 100644 index 0000000000..d745c8fd55 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/selector.html @@ -0,0 +1,69 @@ +<div id="fixtures" style="display: none"> + <h1 class="title">Some title <span>here</span></h1> + <p id="p" class="first summary"> + <strong id="strong">This</strong> is a short blurb + <a id="link_1" class="first internal" rel="external nofollow" href="#">with a <em id="em2">link</em></a> or + <a id="link_2" class="internal highlight" href="#"><em id="em">two</em></a>. + Or <cite id="with_title" title="hello world!">a citation</cite>. + </p> + <ul id="list"> + <li id="item_1" class="first"><a id="link_3" href="#" class="external"><span id="span">Another link</span></a></li> + <li id="item_2">Some text</li> + <li id="item_3" xml:lang="es-us" class="">Otra cosa</li> + </ul> + + <!-- this form has a field with the name 'id', + therefore its ID property won't be 'troubleForm': --> + <form id="troubleForm"> + <input type="hidden" name="id" id="hidden" /> + <input type="text" name="disabled_text_field" id="disabled_text_field" disabled="disabled" /> + <input type="text" name="enabled_text_field" id="enabled_text_field" /> + <input type="checkbox" name="checkboxes" id="checked_box" checked="checked" value="Checked" /> + <input type="checkbox" name="checkboxes" id="unchecked_box" value="Unchecked"/> + <input type="radio" name="radiobuttons" id="checked_radio" checked="checked" value="Checked" /> + <input type="radio" name="radiobuttons" id="unchecked_radio" value="Unchecked" /> + </form> + + <form id="troubleForm2"> + <input type="checkbox" name="brackets[5][]" id="chk_1" checked="checked" value="1" /> + <input type="checkbox" name="brackets[5][]" id="chk_2" value="2" /> + </form> + + <div id="level1"> + <span id="level2_1"> + <span id="level3_1"></span> + <!-- This comment should be ignored by the adjacent selector --> + <span id="level3_2"></span> + </span> + <span id="level2_2"> + <em id="level_only_child"> + </em> + </span> + <div id="level2_3"></div> + </div> <!-- #level1 --> + + <div id="dupContainer"> + <span id="dupL1" class="span_foo span_bar"> + <span id="dupL2"> + <span id="dupL3"> + <span id="dupL4"> + <span id="dupL5"></span> + </span> + </span> + </span> + </span> + </div> <!-- #dupContainer --> + + <div id="grandfather"> grandfather + <div id="father" class="brothers men"> father + <div id="son"> son </div> + </div> + <div id="uncle" class="brothers men"> uncle </div> + </div> + + <form id="commaParent" title="commas,are,good"> + <input type="hidden" id="commaChild" name="foo" value="#commaOne,#commaTwo" /> + <input type="hidden" id="commaTwo" name="foo2" value="oops" /> + </form> + <div id="counted_container"><div class="is_counted"></div></div> +</div> diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js new file mode 100644 index 0000000000..e4483a5b61 --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/string.js @@ -0,0 +1,8 @@ +var attackTarget; +var evalScriptsCounter = 0, + largeTextEscaped = '<span>test</span>', + largeTextUnescaped = '<span>test</span>'; +(2048).times(function(){ + largeTextEscaped += ' ABC'; + largeTextUnescaped += ' ABC'; +}); diff --git a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html new file mode 100644 index 0000000000..15d303aa3d --- /dev/null +++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/unittest.html @@ -0,0 +1,18 @@ +<div id="testlog_2"> </div> + +<!-- Test elements follow --> +<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div> + +<div id="test_2"> <span> </span> + + + +<div><div></div> </div><span> </span> +</div> + +<ul id="tlist"><li id="tlist_1">x1</li><li id="tlist_2">x2</li></ul> +<ul id="tlist2"><li class="a" id="tlist2_1">x1</li><li id="tlist2_2">x2</li></ul> + +<div id="testmoveby" style="background-color:#333;width:100px;">XXXX</div> + +<div id="testcss1">testcss1<span id="testcss1_span" style="display:none;">blah</span></div><div id="testcss2">testcss1</div> |