Fix for gh-961: Added jasmine test for multiple-windows API

Also fixed a focused flag issue when first opening a child window