bitovi/funcunit

Dynamic iframes are considered not loaded

Open

#139 geöffnet am 24. Feb. 2016

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (395 Forks)batch import
bughelp wantedp2

Repository-Metriken

Stars
 (575 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

If I create an <iframe>, populate it dynamically, and set it as the context for FuncUnit like this:

var iframe = $(document.createElement('iframe'));
iframe.contents().find('body').append(frag);    
F.open(win);

All tests will fail because FuncUnit.documentLoaded() will return false here: https://github.com/bitovi/funcunit/blob/01f767b1e95737a7dfcae1f67a75b4d72408ba37/browser/getters.js#L509

Due to the fact that FuncUnit.win.location.href === 'about:blank' here: https://github.com/bitovi/funcunit/blob/92fd4b283388576922506fb76096902c8f9183bf/browser/open.js#L258-L260

To get around this I had to overwrite FuncUnit.documentLoaded to always return true like this:

F.documentLoaded = function () { return true; };

Contributor Guide