Conclusion(s)
For the insanely curious, here's the complete block of JavaScript
that goes, via javascript:void()
and
update_iframe()
, into the inner Wiki's
IFRAME src
attribute,
reformatted:
function report(diagnostic) { var transcript = window.parent.document.getElementById('transcript'); transcript.innerHTML += diagnostic; onComplete (); } function onComplete() { window.parent.location.href = 'javascript:void(find_faults("TestWiki","//test_WikiTestPage"))'; } if (!(!/Exception /.test (document.title))) report ("<span class='fault'>failed: !/Exception/.test(document.title)</span><br/>"); document.getElementById('link_node:test_uncle_wiggily').click (); { var handler = { onComplete: function(request) { if (/^\\/wiki\\/find_faults.*test_uncle_wiggily/.test(request.url)) { Ajax.Responders.unregister(handler); if (!($("title_node:test_uncle_wiggily").className == "wiki_red")) report( "<span class='fault'>" + "failed: $("title_node:test_uncle_wiggily"). className == "wiki_red"" + "</span><br/>" ); } } }; Ajax.Responders.register(handler); } onComplete();
When you click the test link on the outer Wiki, all these things happen:
link_to_remote
calls the server, which dispatches to our controllerOur controller responds with JavaScript
The JavaScript creates an
IFRAME
and sets itsonload
handlerThe
load
event stuffs more JavaScript into theIFRAME src
That JavaScript clicks the inner Wiki's test button
This whole sequence runs again, inside the inner Wiki
Its test script fails ...
Get Test Driven Ajax (on Rails) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.