Repository: electron/electron
File: spec/api-browser-window-spec.ts (TypeScript)

Code before:
        `);
        await didStartLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame');
      });

      it('is true when navigating to pages from the same origin', async () => {
        const w = new BrowserWindow({ show: false });

        const didStopLoading = once(w.webContents, 'did-stop-loading');
        w.webContents.loadURL(serverUrl);
        await didStopLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame');

        const didStartLoading = once(w.webContents, 'did-start-loading');
        w.webContents.loadURL(`${serverUrl}/page2`);
        await didStartLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.true('isLoadingMainFrame');
      });
    });

    ifdescribe(process.platform !== 'win32')('visibleOnAllWorkspaces state', () => {
      it('with properties', () => {
        it('can be changed', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.visibleOnAllWorkspaces).to.be.false();
          w.visibleOnAllWorkspaces = true;
          expect(w.visibleOnAllWorkspaces).to.be.true();
        });
      });

      describe('with functions', () => {
        it('can be changed', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.isVisibleOnAllWorkspaces()).to.be.false();
          w.setVisibleOnAllWorkspaces(true);
          expect(w.isVisibleOnAllWorkspaces()).to.be.true();
        });
      });
    });

    describe('hasShadow state', () => {
      describe('with properties', () => {
        it('returns a boolean on all platforms', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.shadow).to.be.a('boolean');
        });

        // On Windows there's no shadow by default & it can't be changed dynamically.

Review comment (suggestion):
I thought nested `it` doesn't work? Also looks like this change isn't part of the original PR that this PR is backporting

Code after:
        `);
        await didStartLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame');
      });

      it('is true when navigating to pages from the same origin', async () => {
        const w = new BrowserWindow({ show: false });

        const didStopLoading = once(w.webContents, 'did-stop-loading');
        w.webContents.loadURL(serverUrl);
        await didStopLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame');

        const didStartLoading = once(w.webContents, 'did-start-loading');
        w.webContents.loadURL(`${serverUrl}/page2`);
        await didStartLoading;

        expect(w.webContents.isLoadingMainFrame()).to.be.true('isLoadingMainFrame');
      });
    });

    ifdescribe(process.platform !== 'win32')('visibleOnAllWorkspaces state', () => {
      describe('with properties', () => {
        it('can be changed', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.visibleOnAllWorkspaces).to.be.false();
          w.visibleOnAllWorkspaces = true;
          expect(w.visibleOnAllWorkspaces).to.be.true();
        });
      });

      describe('with functions', () => {
        it('can be changed', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.isVisibleOnAllWorkspaces()).to.be.false();
          w.setVisibleOnAllWorkspaces(true);
          expect(w.isVisibleOnAllWorkspaces()).to.be.true();
        });
      });
    });

    describe('hasShadow state', () => {
      describe('with properties', () => {
        it('returns a boolean on all platforms', () => {
          const w = new BrowserWindow({ show: false });
          expect(w.shadow).to.be.a('boolean');
        });

        // On Windows there's no shadow by default & it can't be changed dynamically.