This may be beyond the scope of this testing framework, but it's been working so well for my ExtJS projects I decided to try it out on some of my other ones. I am writing a plugin for a rich text editor, and I wanted to test selecting some text within the editor. The editor keeps it's content within an iframe, the typical structure looks like this.
StartTest(function(t) {
// Forgive my pseudo code here
t.drag(editor.contentDocument.body.p, [50, 10], function () {
t.is(testSelectionRange.myTextSelected, 'Text is selected');
});
});
Instead of seeing the event fire on the contentDocument, I see that it's fired on the iFrame. Since the passed element's document originates on the iFrame's contentDocument, it would be ideal to see the event fired on that document. Alternatively I could see passing the document I wish to fire the event on, something like:
t.drag([0, 0], [50, 0], null, function () {
t.is(testSelectionRange.myTextSelected, 'Text is selected');
}, editor.contentDocument);
Hm.. Seems your goal is to select the text in editor - this is probably not supported by using mouse events simulation (drag). Text selection should be possible though, using a dedicated API, like:
I did see the text selection simulator, and for this specific case it will work. But what would happen if I fired a right click on the editor? Would it fire on the iframe or on the element contained within it's contentDocument?