aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dijit/tests/_base/viewport.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/tests/_base/viewport.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/tests/_base/viewport.html')
-rw-r--r--includes/js/dijit/tests/_base/viewport.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/_base/viewport.html b/includes/js/dijit/tests/_base/viewport.html
new file mode 100644
index 0000000..2b8454a
--- /dev/null
+++ b/includes/js/dijit/tests/_base/viewport.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+ <title>dijit.getViewport() test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../css/dijitTests.css";
+ html, body { margin: 0px; padding: 0px; }
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: false, parseOnLoad: false"></script>
+ <script type="text/javascript" src="../_testCommon.js"></script>
+
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit.dijit");
+
+ function compute(){
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ dojo.byId("results").innerHTML +=
+ "Document is " + d.w + "px x " + d.h + "px" +
+ ", viewport is " + v.w + "px x " + v.h + "px" +
+ ", with scroll offset of (" + v.l + ", " + v.t + ")<br>";
+ }
+
+ function addText(){
+ dojo.byId("results").innerHTML += "Adding text...<br><br>";
+ var text="";
+ for(var i=0;i<100;i++){
+ text += "<span style='white-space: nowrap'>";
+ for(var j=0;j<3;j++){ text += "Now is the time for all good men to come to the aid of their country."; }
+ text += "</span><br>";
+ }
+ dojo.byId("documentBorder").innerHTML += text;
+ }
+
+ dojo.addOnLoad(function(){
+ doh.register("dijit._base.manager",
+ [
+ function initial(t){
+ console.log("calling compute");
+ compute();
+ console.log("called compute");
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ doh.t(v.h > d.h);
+ },
+ function expand(t){
+ var v = dijit.getViewport();
+ addText();
+ compute();
+ var v2 = dijit.getViewport();
+ doh.t(v2.h <= v.h);
+ doh.t(v2.h+20 >= v.h);
+ }
+ ]
+ );
+ doh.run();
+ });
+
+ </script>
+</head>
+<body>
+ <div id="documentBorder" style="border: solid red 2px;">
+ <h1>dijit.getViewport() test</h1>
+ <div style="padding: 10px; border: solid blue 1px;">padding div</div>
+ <button onclick="addText(); compute();">add text and compute size</button>
+ <button onclick="compute();">recompute size</button>
+ <ol>
+ <li>check results div below to see that before adding text, document is smaller than viewport
+ <li>after adding text, document should be bigger than viewport,and check that viewport size hasn't changed,
+ except maybe being a little bit smaller (about 15px) because of the size of the scrollbars
+ <li>resize browser window and click the "recompute size" button; reported viewport size should change
+ <li>scroll the window and click "recompute size" to see that the scroll position is taken into effect
+ </ol>
+ <div id=results style="border: 5px solid blue;">
+ </div>
+</body>
+</html>