Commit 6906e256 authored by Arnold Hendriks's avatar Arnold Hendriks

Fix click handler registration race in iframe test

parent ca6c54f7
......@@ -217,6 +217,9 @@ export default class ObjIFrame extends ComponentBase
{
var doc = this.iframe.contentWindow.document;
this.addIframeEvent(doc, "click", this.clickLink.bind(this));
//flag that we've configured the iframe, some tests need this
this.iframe.contentWindow.whIframeAttached = true;
}
catch(e)
{
......
......@@ -349,9 +349,9 @@ PUBLIC OBJECTTYPE IFrameTest EXTEND TolliumScreenBase
|| " </script>\n"
|| " </head>\n"
|| " <body>\n"
|| " <span id='source' data-source='" || source || "'>" || source ||"</span>:<img id='image' src='" || link || "'><br>\n"
|| " <span id='source' data-source='" || source || "'>" || source ||"</span>:<img id='image' src='" || link || "' width='60' height='40'><br>\n"
|| " <textarea id='calls' style='white-space: pre; height: 150px; width: 80%'></textarea><br>\n"
|| " <a id='link' href='http://www.webhare.net/'>A link!</a><br>\n"
|| " <a id='link' href='http://www.webhare.dev/'>A link!</a><br>\n"
|| " </body>\n"
|| "</html>";
}
......
......@@ -147,9 +147,12 @@ test.registerTests(
}
, { name: 'clicklink'
, test: function(doc,win)
, test: async function(doc,win)
{
var iframe = test.$$t('iframe')[0];
//wait for us to have intercepted the click handler
await test.wait( () => iframe.contentWindow.whIframeAttached === true);
var iframdoc = iframe.contentWindow.document;
iframdoc.getElementById('link').click();
}
......@@ -159,7 +162,12 @@ test.registerTests(
, { name: 'clicklink verify'
, test: function(doc,win)
{
var textarea = test.$$t('textarea')[0];
test.eq('{"args":[1,"test"],"type":"receivedcall"}\n' +
'data:data\n' +
'data:databa\n' +
'{"args":[3,"test"],"type":"receivedcall"}\n' +
'click:http://www.webhare.dev/', textarea.value.trim());
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment