83b4b337e1
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel] * Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel] * Make Element#readAttribute('title') work in Opera. [Tobie Langel] * Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel] * Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel] * Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel] * Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
90 lines
2.9 KiB
HTML
90 lines
2.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<title>Prototype Unit test file</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<script src="../../dist/prototype.js" type="text/javascript"></script>
|
|
<script src="../lib/unittest.js" type="text/javascript"></script>
|
|
<link rel="stylesheet" href="../test.css" type="text/css" />
|
|
<style type="text/css" media="screen">
|
|
/* <![CDATA[ */
|
|
#testcss1 { font-size:11px; color: #f00; }
|
|
#testcss2 { font-size:12px; color: #0f0; display: none; }
|
|
/* ]]> */
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="ensure_scrollbars" style="width:10000px; height:10000px; position:absolute" > </div>
|
|
|
|
<h1>Prototype Unit test file</h1>
|
|
<p>
|
|
Test of functions in position.js
|
|
</p>
|
|
|
|
<!-- Log output -->
|
|
<div id="testlog"> </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">test<span id="inline">test</span></div>
|
|
<div id="absolute_relative_undefined"> </div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tests follow -->
|
|
<script type="text/javascript" language="javascript" charset="utf-8">
|
|
// <![CDATA[
|
|
|
|
var testVar = 'to be updated';
|
|
|
|
new Test.Unit.Runner({
|
|
|
|
setup: function() {
|
|
scrollTo(0,0);
|
|
Position.prepare();
|
|
Position.includeScrollOffsets = false;
|
|
},
|
|
|
|
teardown: function() {
|
|
scrollTo(0,0);
|
|
Position.prepare();
|
|
Position.includeScrollOffsets = false;
|
|
},
|
|
|
|
testPrepare: function() {with(this) {
|
|
Position.prepare();
|
|
assertEqual(0, Position.deltaX);
|
|
assertEqual(0, Position.deltaY);
|
|
scrollTo(20,30);
|
|
Position.prepare();
|
|
assertEqual(20, Position.deltaX);
|
|
assertEqual(30, Position.deltaY);
|
|
}},
|
|
|
|
testWithin: function() {with(this) {
|
|
[true, false].each(function(withScrollOffsets) {
|
|
Position.includeScrollOffsets = withScrollOffsets;
|
|
assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
|
|
assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
|
|
assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
|
|
assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
|
|
});
|
|
|
|
scrollTo(20,30);
|
|
Position.prepare();
|
|
Position.includeScrollOffsets = true;
|
|
assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
|
|
assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
|
|
assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
|
|
assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
|
|
}}
|
|
|
|
}, 'testlog');
|
|
|
|
// ]]>
|
|
</script>
|
|
</body>
|
|
</html>
|