Skip to content

Commit

Permalink
Adapt window.Popup tests to work with CSS anchors.
Browse files Browse the repository at this point in the history
  • Loading branch information
bentrm committed Feb 26, 2016
1 parent 3c14c06 commit bcffce8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/window/Popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
pop.show();
};

t.ok(pop.anc, "Popup has anchor element");
t.ok(pop.hasCls('gx-popup-anc'), "Popup has popup class.");

// move the map and confirm that popup moves
context.map.setCenter(new OpenLayers.LonLat(6, 45));
Expand Down Expand Up @@ -236,7 +236,7 @@

var newPos = pop.getPosition();

t.ok(!pop.anc,"Anchor element removed");
t.ok(!pop.hasCls('gx-popup-anc'), "Does not have anchor class.");
t.ok(!this.collapsed, "Preserved collapsed state");
t.eq(origPos[0],newPos[0],"Popup remains in same position (X)");
t.eq(origPos[1],newPos[1],"Popup remains in same position (Y)");
Expand Down Expand Up @@ -487,7 +487,7 @@
}

function test_Popup_autoPosition(t) {
t.plan(8);
t.plan(16);

var context = setupMultiFeatureContext();
var pop;
Expand All @@ -500,14 +500,18 @@

// the following 4 assertions are called twice each
if (ancPos[0] === "top") {
t.ok(pop.el.child("div.top"), "popups with anchor at the top have the corresponding CSS class");
t.ok(pop.hasCls("gx-popup-anc-top"), "popups with anchor at the top have the corresponding CSS class");
t.ok(!pop.hasCls("gx-popup-anc-bottom"), "popups with anchor at the top do not have the corresponding CSS class for bottom anchor");
} else {
t.ok(!pop.el.child("div.top"), "popups with anchor at the bottom do not have an extra CSS class");
t.ok(!pop.hasCls("gx-popup-anc-top"), "popups with anchor at the bottom do not have an extra CSS class");
t.ok(pop.hasCls("gx-popup-anc-bottom"), "popups with anchor at the bottom do not have the corresponding CSS class for top anchor");
}
if (ancPos[1] == "right") {
t.ok(pop.el.child("div.right"), "popups with anchor on the right have the corresponding CSS class");
t.ok(pop.hasCls("gx-popup-anc-right"), "popups with anchor on the right have the corresponding CSS class");
t.ok(!pop.hasCls("gx-popup-anc-left"), "popups with anchor on the right do not have an extra CSS class");
} else {
t.ok(!pop.el.child("div.right"), "popups with anchor on the left do not have an extra CSS class");
t.ok(!pop.hasCls("gx-popup-anc-right"), "popups with anchor on the left do not have an extra CSS class");
t.ok(pop.hasCls("gx-popup-anc-left"), "popups with anchor on the left have the corresponding CSS class");
}

pop.destroy();
Expand Down

0 comments on commit bcffce8

Please sign in to comment.