fix: prevent title change for within page navigation (#45981)
* fix: prevent title change for on page navigation * add back and forward testing * update Chromium comment * remove errant script tag
This commit is contained in:
parent
7c0b7b417b
commit
4812b4e6c2
3 changed files with 37 additions and 9 deletions
|
@ -631,6 +631,17 @@ describe('webContents module', () => {
|
|||
w.webContents.navigationHistory.goBack();
|
||||
expect(w.webContents.navigationHistory.getActiveIndex()).to.equal(0);
|
||||
});
|
||||
|
||||
it('should have the same window title if navigating back within the page', async () => {
|
||||
const title = 'Test';
|
||||
w.webContents.on('did-finish-load', () => {
|
||||
w.setTitle(title);
|
||||
w.loadURL(`file://${fixturesPath}/pages/navigation-history-anchor-in-page.html#next`);
|
||||
});
|
||||
await w.loadURL(`file://${fixturesPath}/pages/navigation-history-anchor-in-page.html`);
|
||||
w.webContents.navigationHistory.goBack();
|
||||
expect(w.getTitle()).to.equal(title);
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigationHistory.canGoForward and navigationHistory.goForward API', () => {
|
||||
|
@ -653,6 +664,16 @@ describe('webContents module', () => {
|
|||
w.webContents.navigationHistory.goForward();
|
||||
expect(w.webContents.navigationHistory.getActiveIndex()).to.equal(1);
|
||||
});
|
||||
|
||||
it('should have the same window title if navigating forward within the page', async () => {
|
||||
const title = 'Test';
|
||||
w.webContents.on('did-finish-load', () => {
|
||||
w.setTitle(title);
|
||||
w.loadURL(`file://${fixturesPath}/pages/navigation-history-anchor-in-page.html#next`);
|
||||
});
|
||||
await w.loadURL(`file://${fixturesPath}/pages/navigation-history-anchor-in-page.html`);
|
||||
expect(w.getTitle()).to.equal(title);
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigationHistory.canGoToOffset(index) and navigationHistory.goToOffset(index) API', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue