2007-01-18 22:24:27 +00:00
|
|
|
<!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" />
|
|
|
|
</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">
|
2007-08-10 14:24:28 +00:00
|
|
|
<div style="height:10px;font-size:2px">test<span id="inline">test</span></div>
|
2007-01-18 22:24:27 +00:00
|
|
|
<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;
|
|
|
|
},
|
|
|
|
|
2008-03-16 18:53:51 +00:00
|
|
|
testPrepare: function() {
|
2007-01-18 22:24:27 +00:00
|
|
|
Position.prepare();
|
2008-03-16 18:53:51 +00:00
|
|
|
this.assertEqual(0, Position.deltaX);
|
|
|
|
this.assertEqual(0, Position.deltaY);
|
2007-01-18 22:24:27 +00:00
|
|
|
scrollTo(20,30);
|
|
|
|
Position.prepare();
|
2008-03-16 18:53:51 +00:00
|
|
|
this.assertEqual(20, Position.deltaX);
|
|
|
|
this.assertEqual(30, Position.deltaY);
|
|
|
|
},
|
2007-01-18 22:24:27 +00:00
|
|
|
|
2008-03-16 18:53:51 +00:00
|
|
|
testWithin: function() {
|
2007-01-18 22:24:27 +00:00
|
|
|
[true, false].each(function(withScrollOffsets) {
|
|
|
|
Position.includeScrollOffsets = withScrollOffsets;
|
2008-03-16 18:53:51 +00:00
|
|
|
this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
|
|
|
|
this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
|
|
|
|
this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
|
|
|
|
this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
|
|
|
|
}, this);
|
2007-01-18 22:24:27 +00:00
|
|
|
|
|
|
|
scrollTo(20,30);
|
|
|
|
Position.prepare();
|
|
|
|
Position.includeScrollOffsets = true;
|
2008-03-16 18:53:51 +00:00
|
|
|
this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
|
|
|
|
this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
|
|
|
|
this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
|
|
|
|
this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
|
|
|
|
}
|
2008-01-06 00:34:39 +00:00
|
|
|
});
|
2007-01-18 22:24:27 +00:00
|
|
|
|
|
|
|
// ]]>
|
|
|
|
</script>
|
|
|
|
</body>
|
Merge -r6634:HEAD from ../branches/dom.
* 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]
2007-05-12 05:01:56 +00:00
|
|
|
</html>
|