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

Commit

Permalink
default bookmark title to the url if no title is present
Browse files Browse the repository at this point in the history
fixes #3344
  • Loading branch information
bridiver committed Aug 23, 2016
1 parent 78a799a commit fd60bac
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/components/addEditBookmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class AddEditBookmark extends ImmutableComponent {
if (this.props.currentDetail.get('customTitle') !== undefined) {
return this.props.currentDetail.get('customTitle')
}
return this.props.currentDetail.get('title') || ''
return this.props.currentDetail.get('title') || this.props.currentDetail.get('location')
}
render () {
return <Dialog onHide={this.onClose} isClickDismiss>
Expand Down
79 changes: 79 additions & 0 deletions test/components/bookmarksTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* global describe, it, before */

const Brave = require('../lib/brave')
const {urlInput, navigator, navigatorNotBookmarked, saveButton} = require('../lib/selectors')

describe('bookmarks', function () {
function * setup (client) {
yield client
.waitUntilWindowLoaded()
.waitForUrl(Brave.newTabUrl)
.waitForBrowserWindow()
.waitForVisible('#window')
.waitForEnabled(urlInput)
}

describe('with title', function () {
Brave.beforeAll(this)

before(function * () {
this.page1Url = Brave.server.url('page1.html')

yield setup(this.app.client)

yield this.app.client
.waitForUrl(Brave.newTabUrl)
.loadUrl(this.page1Url)
.windowParentByUrl(this.page1Url)
.moveToObject(navigator)
.waitForExist(navigatorNotBookmarked)
.moveToObject(navigator)
.click(navigatorNotBookmarked)
.waitForVisible(saveButton)
})

it('fills in the title field', function * () {
yield this.app.client
.waitForExist('#bookmarkName input')
.getValue('#bookmarkName input').should.eventually.be.equal('Page 1')
})

it('fills in the url field', function * () {
yield this.app.client
.waitForExist('#bookmarkLocation input')
.getValue('#bookmarkLocation input').should.eventually.be.equal(this.page1Url)
})
})

describe('without title', function () {
Brave.beforeAll(this)

before(function * () {
this.page1Url = Brave.server.url('page_no_title.html')

yield setup(this.app.client)

yield this.app.client
.waitForUrl(Brave.newTabUrl)
.loadUrl(this.page1Url)
.windowParentByUrl(this.page1Url)
.moveToObject(navigator)
.waitForExist(navigatorNotBookmarked)
.moveToObject(navigator)
.click(navigatorNotBookmarked)
.waitForVisible(saveButton)
})

it('fills in the url for the title field', function * () {
yield this.app.client
.waitForExist('#bookmarkName input')
.getValue('#bookmarkName input').should.eventually.be.equal(this.page1Url)
})

it('fills in the url field', function * () {
yield this.app.client
.waitForExist('#bookmarkLocation input')
.getValue('#bookmarkLocation input').should.eventually.be.equal(this.page1Url)
})
})
})

0 comments on commit fd60bac

Please sign in to comment.