Skip to content
Browse files

Skip window-resizing tests if programmatic window resizing isn't enab…

…led by the browser.
  • Loading branch information...
1 parent 2d41b51 commit 5d404d48848b61d2df9a86a4c53e5bfe2c4f88f8 @savetheclocktower savetheclocktower committed Jun 5, 2012
Showing with 21 additions and 3 deletions.
  1. +21 −3 test/unit/dom_test.js
View
24 test/unit/dom_test.js
@@ -7,6 +7,8 @@ var createParagraph = function(text) {
return p;
}
+var RESIZE_DISABLED = false;
+
function simulateClick(node) {
var oEvent;
if (document.createEvent) {
@@ -1473,9 +1475,19 @@ new Test.Unit.Runner({
window.resizeBy(50, 50);
this.wait(1000, function() {
var after = document.viewport.getDimensions();
+
+ // Assume that JavaScript window resizing is disabled if before width
+ // and after width are the same.
+ if (before.width === after.width) {
+ RESIZE_DISABLED = true;
+ this.info("SKIPPING REMAINING TESTS (JavaScript window resizing disabled)");
+ return;
+ }
- this.assertEqual(before.width + 50, after.width, "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS");
- this.assertEqual(before.height + 50, after.height, "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS");
+ this.assertEqual(before.width + 50, after.width,
+ "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS");
+ this.assertEqual(before.height + 50, after.height,
+ "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THIS TEST TO PASS");
this.wait(1000, function() {
// Restore original dimensions.
@@ -1512,14 +1524,20 @@ new Test.Unit.Runner({
window.scrollTo(0, 35);
this.assertEqual(35, document.viewport.getScrollOffsets().top);
+ if (RESIZE_DISABLED) {
+ this.info("SKIPPING REMAINING TESTS (JavaScript window resizing disabled)");
+ return;
+ }
+
window.resizeTo(200, 650);
this.wait(1000, function() {
var before = document.viewport.getDimensions();
var delta = { width: 200 - before.width, height: 650 - before.height };
window.scrollTo(25, 35);
- this.assertEqual(25, document.viewport.getScrollOffsets().left, "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THESE TESTS TO PASS");
+ this.assertEqual(25, document.viewport.getScrollOffsets().left,
+ "NOTE: YOU MUST ALLOW JAVASCRIPT TO RESIZE YOUR WINDOW FOR THESE TESTS TO PASS");
this.wait(1000, function() {
// Restore original dimensions.

0 comments on commit 5d404d4

Please sign in to comment.
Something went wrong with that request. Please try again.