Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

added emoji-regex in package.json, modified urlBar.js to remove emoji #10314

Merged
merged 2 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/renderer/components/navigation/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const historyUtil = require('../../../common/lib/historyUtil')

// Icons
const iconNoScript = require('../../../../img/url-bar-no-script.svg')
const emojiRegex = require('emoji-regex')

class UrlBar extends React.Component {
constructor (props) {
Expand Down Expand Up @@ -376,7 +377,7 @@ class UrlBar extends React.Component {
// 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.urlbarLocation)
? '' : this.props.title
? '' : this.props.title.replace(emojiRegex(), '')
}

get loadTime () {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"clipboard-copy": "^1.0.0",
"electron-localshortcut": "^0.6.0",
"electron-squirrel-startup": "brave/electron-squirrel-startup",
"emoji-regex": "^6.5.1",
"file-loader": "^0.8.5",
"font-awesome": "^4.5.0",
"font-awesome-webpack": "0.0.4",
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/title_with_emoji.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>page with 🐉 dragon emoji</title>
</head>
<body>
<h1>wow such 🐉 very amazing</h1>
</body>
</html>
16 changes: 16 additions & 0 deletions test/navbar-components/navigationBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,22 @@ describe('navigationBar tests', function () {
.waitForElementCount(titleBar, 0)
yield selectsText(this.app.client, page1Url)
})

it('does not show emoji in title mode', function * () {
const emojiPage = Brave.server.url('title_with_emoji.html')
const emojiPageHost = urlParse(emojiPage).host
yield this.app.client
.tabByUrl(Brave.newTabUrl)
.loadUrl(emojiPage)
.windowParentByUrl(emojiPage)
.activateTitleMode()
.click(activeWebview)
.windowParentByUrl(emojiPage)
.waitForExist(titleBar)
.waitForTextValue(titleBar, `${emojiPageHost} | page with dragon emoji`)
.isExisting('🐉').then((isExisting) => assert(!isExisting))
.isExisting(navigatorLoadTime).then((isExisting) => assert(!isExisting))
})
})

describe('page without a title', function () {
Expand Down