diff --git a/js/components/urlBar.js b/js/components/urlBar.js index 8f70c6a9ad6..8ed1608581f 100644 --- a/js/components/urlBar.js +++ b/js/components/urlBar.js @@ -173,17 +173,16 @@ class UrlBar extends ImmutableComponent { this.updateDOM() } - get titleValue () { - const parsedUrl = urlParse(this.props.activeFrameProps.get('location')) - let titlePrefix = '' - if (parsedUrl.protocol !== 'about:') { - titlePrefix += parsedUrl.host + ' | ' - } + get hostValue () { + const parsed = urlParse(this.props.activeFrameProps.get('location')) + return parsed.host && parsed.protocol !== 'about:' ? parsed.host : '' + } + get titleValue () { // For about:newtab we don't want the top of the browser saying New Tab // Instead just show "Brave" return ['about:blank', 'about:newtab'].includes(this.props.urlbar.get('location')) - ? '' : titlePrefix + this.props.activeFrameProps.get('title') + ? '' : this.props.activeFrameProps.get('title') } get locationValue () { @@ -191,11 +190,6 @@ class UrlBar extends ImmutableComponent { ? '' : this.props.urlbar.get('location') } - get inputValue () { - return this.props.titleMode - ? this.titleValue : this.locationValue - } - get loadTime () { let loadTime = '' if (this.props.activeFrameProps.get('startLoadTime') && @@ -248,7 +242,9 @@ class UrlBar extends ImmutableComponent { extendedValidation: this.extendedValidationSSL })}/>
- {this.titleValue} + {this.hostValue} + {this.hostValue && this.titleValue ? ' | ' : ''} + {this.titleValue}
val === host + ' | Page 1') + return this.getText(titleBar).then(val => val === host + ' | Page 1') }) .isExisting(navigatorLoadTime).then(isExisting => assert(!isExisting)) }) @@ -86,7 +86,7 @@ describe('urlbar', function () { yield this.app.client .ipcSend('shortcut-focus-url', false) .waitUntil(function () { - return this.getValue(urlInput).then(val => val === page1Url) + return this.getCssProperty(titleBar, 'display').then(display => display.value === 'none') }) yield selectsText(this.app.client, page1Url) }) @@ -102,10 +102,9 @@ describe('urlbar', function () { }) it('does not have title mode', function *() { - let page_no_title = this.page_no_title yield this.app.client .waitUntil(function () { - return this.getValue(urlInput).then(val => val === page_no_title) + return this.getCssProperty(titleBar, 'display').then(display => display.value === 'none') }) .waitForExist(navigatorLoadTime) })