Repository: electron/electron
File: spec/chromium-spec.ts (TypeScript)

Code before:
        const height = outerHeight;
        return {
          width,
          height,
          eventData: e.data
        }
      })()`);
      expect(eventData).to.equal(`size: ${width} ${height}`);
      expect(eventData).to.equal('size: 123 456');
    });

    it('does not override child options', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size.html`;
      const { eventData } = await w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, {once: true}));
        const b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,width=350,height=450')
        const e = await message
        b.close();
        return { eventData: e.data }
      })()`);
      expect(eventData).to.equal('size: 350 450');
    });

    it('window opened with innerWidth option has the same innerWidth', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size-inner.html`;
      const { eventData } = await w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, {once: true}));
        const b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,innerWidth=400,height=450')
        const e = await message
        b.close();
        return { eventData: e.data }
      })()`);
      expect(eventData).to.equal('size: 400 450');
    });
    it('window opened with innerHeight option has the same innerHeight', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size-inner.html`;
      const { eventData } = await w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, {once: true}));
        const b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,width=350,innerHeight=400')
        const e = await message
        b.close();
        return { eventData: e.data }
      })()`);
      expect(eventData).to.equal('size: 350 400');
    });

Review comment (suggestion):
We should also be testing this against `win.getContentSize()` 

Code after:
        const height = outerHeight;
        return {
          width,
          height,
          eventData: e.data
        }
      })()`);
      expect(eventData).to.equal(`size: ${width} ${height}`);
      expect(eventData).to.equal('size: 123 456');
    });

    it('does not override child options', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size.html`;
      const { eventData } = await w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, {once: true}));
        const b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,width=350,height=450')
        const e = await message
        b.close();
        return { eventData: e.data }
      })()`);
      expect(eventData).to.equal('size: 350 450');
    });

    it('window opened with innerWidth option has the same innerWidth', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size-inner.html`;
      const windowCreatedPromise = once(app, 'browser-window-created') as Promise<[any, BrowserWindow]>;
      const eventDataPromise = w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, { once: true }));
        b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,innerWidth=400,height=450');
        const e = await message;
        b.close();
        return e.data;
      })()`);
      const [[, newWindow], eventData] = await Promise.all([windowCreatedPromise, eventDataPromise]);

      expect(newWindow.getContentSize().toString()).to.equal('400,450');
      expect(eventData).to.equal('size: 400 450');
    });
    it('window opened with innerHeight option has the same innerHeight', async () => {
      const w = new BrowserWindow({ show: false });
      w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html'));
      const windowUrl = `file://${fixturesPath}/pages/window-open-size-inner.html`;
      const windowCreatedPromise = once(app, 'browser-window-created') as Promise<[any, BrowserWindow]>;
      const eventDataPromise = w.webContents.executeJavaScript(`(async () => {
        const message = new Promise(resolve => window.addEventListener('message', resolve, {once: true}));
        const b = window.open(${JSON.stringify(windowUrl)}, '', 'show=no,width=350,innerHeight=400')
        const e = await message;