diff --git a/js/components/frame.js b/js/components/frame.js index 146cd6be7d5..a8fd4621640 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -768,6 +768,7 @@ class Frame extends ImmutableComponent { if (this.props.findbarShown) { this.onFindHide() } + for (let message in this.notificationCallbacks) { appActions.hideMessageBox(message) } @@ -777,6 +778,10 @@ class Frame extends ImmutableComponent { this.webview.focus() } windowActions.setNavigated(e.url, this.props.frameKey, false) + // After navigating to the URL, set correct frame title + let webContents = this.webview.getWebContents() + let title = webContents.getTitleAtIndex(webContents.getCurrentEntryIndex()) + windowActions.setFrameTitle(this.frame, title) }) this.webview.addEventListener('crashed', (e) => { windowActions.setFrameError(this.frame, { diff --git a/test/components/tabTest.js b/test/components/tabTest.js index 693e9c64360..adb283b7e61 100644 --- a/test/components/tabTest.js +++ b/test/components/tabTest.js @@ -3,7 +3,7 @@ const Brave = require('../lib/brave') const messages = require('../../js/constants/messages') const settings = require('../../js/constants/settings') -const {urlInput} = require('../lib/selectors') +const {urlInput, backButton, forwardButton, activeTabTitle} = require('../lib/selectors') describe('tabs', function () { function * setup (client) { @@ -15,6 +15,48 @@ describe('tabs', function () { .waitForVisible(urlInput) } + describe('back forward actions', function () { + Brave.beforeAll(this) + before(function * () { + yield setup(this.app.client) + }) + + it('sets correct title', function * () { + var page1 = Brave.server.url('page1.html') + var page2 = Brave.server.url('page2.html') + + yield this.app.client + .tabByIndex(0) + .loadUrl(page1) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 1') + }) + .tabByIndex(0) + .loadUrl(page2) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 2') + }) + .click(backButton) + .waitForUrl(page1) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 1') + }) + .click(forwardButton) + .waitForUrl(page2) + .windowByUrl(Brave.browserWindowUrl) + .waitUntil(function () { + return this.getText(activeTabTitle) + .then((title) => title === 'Page 2') + }) + }) + }) + describe('new tab signal', function () { Brave.beforeAll(this) before(function * () { diff --git a/test/lib/selectors.js b/test/lib/selectors.js index 21cb70802fc..dd4a4ab2e90 100644 --- a/test/lib/selectors.js +++ b/test/lib/selectors.js @@ -2,6 +2,7 @@ module.exports = { urlInput: '#urlInput', activeWebview: '.frameWrapper.isActive webview', activeTab: '.tab.active', + activeTabTitle: '.tab.active .tabTitle', activeTabFavicon: '.tab.active .tabIcon', pinnedTabs: '.pinnedTabs', pinnedTabsTabs: '.pinnedTabs .tab',