geoext/geoext2 — pull request #187 by marcjansen (2013-09-26 13:07:07+00:00)
Title: Workaround for Popup-tests in FF and IE8

Note: See also the discussions in #185, this pull request is based upon the changes in that PR.

Once #185 is merged, we have one remaining test failure in both Firefox 24 and Internet Explorer 8:

```
* window/Popup.html: fail 1 ok 11 (detailed: fail 3 ok 47)
* test_anchorPopup fail 3 ok 2
* fail anchored popup moves once on collapse. eq: values differ: got 0, but expected 1
* fail anchored popup moves once on expand. eq: values differ: got 0, but expected 1
* fail anchored popup moves once on resize. eq: values differ: got 0, but expected 1
```

I fail to fully understand what really is behind this oddity. All the usual workarounds for IE 8 and FF (showing the iframe, adding delays) don't make this pass.

Strangely enough, if one opens the file `window/Popup.html` standalone in a browser, and mocks the testing framework up with code like the following (Copy and paste into e.g. Firebug):

```js
var mock = {
plan: function(){},
ok: function(cond, msg){
if (!cond) {
console.log('FAIL: ' + msg);
} else {
console.log('OK: ' + msg);
}
},
eq: function(got, exp, msg){
if (got !== exp) {
console.log('FAIL: ' + msg);
} else {
console.log('OK: ' + msg);
}
},
delay_call: function(s, fn) {
console.log('t.delay_call called.');
window.setTimeout(fn, s*1000);
}
};

test_anchorPopup(mock);
```

You'll get the following output indicating that all is well:

```
OK: Popup has anchor element
OK: anchored popup moves once on map.setCenter
OK: anchored popup moves once on collapse
OK: anchored popup moves once on expand
OK: anchored popup moves once on resize
```

Also when the semantics of the test are added to the example (`move`-listener firing only once), you'll get the expected results in the offending browsers.

This pull request changes the semantics of the test (Use [this difference view for comparison](https://github.com/marcjansen/geoext2/compare/tests-update-4.2.1...ie8-window?expand=1)):
* right after reseting `moves` to `0`, the popup is explicitly shown with `show()`
* The test condition is changed from `eq()` to `ok()`, because with Chrome, we would now get `2` fired events.

I would be grateful to hear your thoughts on this.

Thanks in advance.