|
@@ -893,7 +893,6 @@ describe('webContents module', () => {
|
|
|
});
|
|
|
|
|
|
describe('zoom api', () => {
|
|
|
- const scheme = (global as any).standardScheme;
|
|
|
const hostZoomMap: Record<string, number> = {
|
|
|
host1: 0.3,
|
|
|
host2: 0.7,
|
|
@@ -902,7 +901,7 @@ describe('webContents module', () => {
|
|
|
|
|
|
before(() => {
|
|
|
const protocol = session.defaultSession.protocol;
|
|
|
- protocol.registerStringProtocol(scheme, (request, callback) => {
|
|
|
+ protocol.registerStringProtocol(standardScheme, (request, callback) => {
|
|
|
const response = `<script>
|
|
|
const {ipcRenderer} = require('electron')
|
|
|
ipcRenderer.send('set-zoom', window.location.hostname)
|
|
@@ -916,7 +915,7 @@ describe('webContents module', () => {
|
|
|
|
|
|
after(() => {
|
|
|
const protocol = session.defaultSession.protocol;
|
|
|
- protocol.unregisterProtocol(scheme);
|
|
|
+ protocol.unregisterProtocol(standardScheme);
|
|
|
});
|
|
|
|
|
|
afterEach(closeAllWindows);
|
|
@@ -1008,7 +1007,7 @@ describe('webContents module', () => {
|
|
|
if (finalNavigation) {
|
|
|
done();
|
|
|
} else {
|
|
|
- w.loadURL(`${scheme}://host2`);
|
|
|
+ w.loadURL(`${standardScheme}://host2`);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
done(e);
|
|
@@ -1025,7 +1024,7 @@ describe('webContents module', () => {
|
|
|
done(e);
|
|
|
}
|
|
|
});
|
|
|
- w.loadURL(`${scheme}://host1`);
|
|
|
+ w.loadURL(`${standardScheme}://host1`);
|
|
|
});
|
|
|
|
|
|
it('can propagate zoom level across same session', async () => {
|
|
@@ -1037,10 +1036,10 @@ describe('webContents module', () => {
|
|
|
w2.close();
|
|
|
});
|
|
|
|
|
|
- await w.loadURL(`${scheme}://host3`);
|
|
|
+ await w.loadURL(`${standardScheme}://host3`);
|
|
|
w.webContents.zoomLevel = hostZoomMap.host3;
|
|
|
|
|
|
- await w2.loadURL(`${scheme}://host3`);
|
|
|
+ await w2.loadURL(`${standardScheme}://host3`);
|
|
|
const zoomLevel1 = w.webContents.zoomLevel;
|
|
|
expect(zoomLevel1).to.equal(hostZoomMap.host3);
|
|
|
|
|
@@ -1057,7 +1056,7 @@ describe('webContents module', () => {
|
|
|
}
|
|
|
});
|
|
|
const protocol = w2.webContents.session.protocol;
|
|
|
- protocol.registerStringProtocol(scheme, (request, callback) => {
|
|
|
+ protocol.registerStringProtocol(standardScheme, (request, callback) => {
|
|
|
callback('hello');
|
|
|
});
|
|
|
|
|
@@ -1065,13 +1064,13 @@ describe('webContents module', () => {
|
|
|
w2.setClosable(true);
|
|
|
w2.close();
|
|
|
|
|
|
- protocol.unregisterProtocol(scheme);
|
|
|
+ protocol.unregisterProtocol(standardScheme);
|
|
|
});
|
|
|
|
|
|
- await w.loadURL(`${scheme}://host3`);
|
|
|
+ await w.loadURL(`${standardScheme}://host3`);
|
|
|
w.webContents.zoomLevel = hostZoomMap.host3;
|
|
|
|
|
|
- await w2.loadURL(`${scheme}://host3`);
|
|
|
+ await w2.loadURL(`${standardScheme}://host3`);
|
|
|
const zoomLevel1 = w.webContents.zoomLevel;
|
|
|
expect(zoomLevel1).to.equal(hostZoomMap.host3);
|
|
|
|