In the callback of F.open()
use F.win.resizeTo(width, height)
:
F.open("desired-url", function onOpenSuccess() {
F.win.resizeTo(1024, 768);
});
سؤال
When I try to use FuncUnit to open a browser window to run some tests, the window it opens is too narrow and the site I am testing hides some menu items to work with the narrow window. Is there some way to increase the width of the window FuncUnit opens so the presence of these menu items can be tested? The docs provide no help with this issue.
The FuncUnit code I have is really basic:
test("dummy test", function () {
F.open('http://localhost:8000/');
});
I can increase the size of the window by hand after the test starts running, but that does not work for automated testing.
EDIT:
Other attempts that worked less well:
المحلول
In the callback of F.open()
use F.win.resizeTo(width, height)
:
F.open("desired-url", function onOpenSuccess() {
F.win.resizeTo(1024, 768);
});
نصائح أخرى
Looking at the FuncUnit API and code for F.Open()
the answer appears to be no.
The F.open()
method signature is defined as: open(path, success, timeout)
With no option to manually set the height, width. Looking at their source they are doing their own internal calcs for height, width.
What you could do is get their git project and extend the F.open() method to accept a height, width param. Or just use JQuery. FuncUnit appears to be targeted at unit testing so UI finesse might be a secondary objective for that project.