From 9200676f89e8dbfc6c22d5c13e3db2f3ebe00f1b Mon Sep 17 00:00:00 2001 From: Paul Spencer Date: Tue, 18 Dec 2007 13:47:23 +0000 Subject: [PATCH] Fix tests for Safari 3. For some reason, you can set the style.overflow property but you have to read it as overflowX or overflowY. git-svn-id: http://svn.openlayers.org/trunk/openlayers@5489 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/Layer/test_Text.html | 12 +++++++++--- tests/Marker/test_Box.html | 4 +++- tests/test_Feature.html | 4 +++- tests/test_Popup.html | 4 +++- tests/test_Util.html | 12 +++++++++--- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/tests/Layer/test_Text.html b/tests/Layer/test_Text.html index 3a1b8c3e4b..f154526072 100644 --- a/tests/Layer/test_Text.html +++ b/tests/Layer/test_Text.html @@ -75,7 +75,9 @@ t.eq(map.popups.length, 1, "Popup opened correctly"); layer.markers[1].events.triggerEvent('click', event); t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly"); - t.eq(map.popups[0].contentDiv.style.overflow,"auto", "default Popup overflow correct"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(map.popups[0].contentDiv.style[prop],"auto", "default Popup overflow correct"); }); } function test_03_Layer_Text_overflow (t) { @@ -92,10 +94,14 @@ t.delay_call( 1, function() { layer.markers[0].events.triggerEvent('click', event); t.eq(map.popups.length, 1, "Popup opened correctly"); - t.eq(map.popups[0].contentDiv.style.overflow,"auto", "Popup overflow read from file"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(map.popups[0].contentDiv.style[prop],"auto", "Popup overflow read from file"); layer.markers[1].events.triggerEvent('click', event); t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly"); - t.eq(map.popups[0].contentDiv.style.overflow,"hidden", "Popup overflow read from file"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(map.popups[0].contentDiv.style[prop],"hidden", "Popup overflow read from file"); }); } function test_04_Layer_Text_events_nopopups (t) { diff --git a/tests/Marker/test_Box.html b/tests/Marker/test_Box.html index a9f940eb90..0fd8361a07 100644 --- a/tests/Marker/test_Box.html +++ b/tests/Marker/test_Box.html @@ -25,7 +25,9 @@ t.ok( box instanceof OpenLayers.Marker.Box, "new OpenLayers.Marker.Box returns Box object" ); t.ok( box.bounds.equals(bounds), "bounds object correctly set"); t.ok( box.div != null, "div created"); - t.eq( box.div.style.overflow, "hidden", "div style overflow hidden"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq( box.div.style[prop], "hidden", "div style overflow hidden"); t.ok( box.events != null, "events object created"); t.eq( g_Color, borderColor, "setBorder called with correct border color"); t.eq( g_Width, borderWidth, "setBorder called with correct border width"); diff --git a/tests/test_Feature.html b/tests/test_Feature.html index 1a33f5f074..f6000e0223 100644 --- a/tests/test_Feature.html +++ b/tests/test_Feature.html @@ -42,7 +42,9 @@ feature = new OpenLayers.Feature(layer, lonlat, data); popup = feature.createPopup(); - t.eq(popup.contentDiv.style.overflow, "auto", 'overflow on popup is correct'); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(popup.contentDiv.style[prop], "auto", 'overflow on popup is correct'); } function test_02_Feature_createMarker (t) { t.plan(1); diff --git a/tests/test_Popup.html b/tests/test_Popup.html index 9f469e13ef..93d57bec76 100644 --- a/tests/test_Popup.html +++ b/tests/test_Popup.html @@ -120,7 +120,9 @@ t.eq(contentDiv.style.width, "500px", "correct content div width"); t.eq(contentDiv.style.height, "400px", "correct content div height"); t.eq(contentDiv.style.position, "relative", "correct content div position"); - t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(contentDiv.style[prop], "hidden", "correct content div overflow"); t.eq(contentDiv.innerHTML, content, "correct content div content"); var bColor = popup.div.style.backgroundColor; diff --git a/tests/test_Util.html b/tests/test_Util.html index 9a6580d515..b26fd9e995 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -59,7 +59,9 @@ t.eq( div.style.position, position, "div.style.positionset correctly"); t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly"); - t.eq( div.style.overflow, overflow, "div.style.overflow set correctly"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq( div.style[prop], overflow, "div.style.overflow set correctly"); t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly"); var filterString = 'alpha(opacity=' + (opacity * 100) + ')'; t.eq( div.style.filter, filterString, "element.style.filter set correctly"); @@ -82,7 +84,9 @@ t.eq( div.style.position, "absolute", "div.style.positionset correctly"); t.eq( div.style.border, "", "div.style.border set correctly"); - t.eq(div.style.overflow, "", "div.style.overflow set correctly"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq(div.style[prop], "", "div.style.overflow set correctly"); t.ok( !div.style.opacity, "element.style.opacity set correctly"); t.ok( !div.style.filter, "element.style.filter set correctly"); @@ -342,7 +346,9 @@ t.eq( element.style.position, position, "element.style.position set correctly"); t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly"); - t.eq( element.style.overflow, overflow, "element.style.overflow set correctly"); + //Safari 3 separates style overflow into overflow-x and overflow-y + var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow'; + t.eq( element.style[prop], overflow, "element.style.overflow set correctly"); t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly"); var filterString = 'alpha(opacity=' + (opacity * 100) + ')'; t.eq( element.style.filter, filterString, "element.style.filter set correctly");