From 608f4e868f2107d317081e5bc095d1df59e19e46 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Sat, 27 Aug 2016 13:26:34 -0400 Subject: [PATCH] Allow deleting folder from add/edit Auditors: @bsclifton Fix #3409 --- js/components/addEditBookmark.js | 3 ++- test/components/bookmarksTest.js | 27 ++++++++++++++++++++++++++- test/lib/selectors.js | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/js/components/addEditBookmark.js b/js/components/addEditBookmark.js index 3370a09b861..dc903c25034 100644 --- a/js/components/addEditBookmark.js +++ b/js/components/addEditBookmark.js @@ -113,7 +113,8 @@ class AddEditBookmark extends ImmutableComponent { this.onClose() } onRemoveBookmark () { - appActions.removeSite(this.props.currentDetail, siteTags.BOOKMARK) + const tag = this.isFolder ? siteTags.BOOKMARK_FOLDER : siteTags.BOOKMARK + appActions.removeSite(this.props.currentDetail, tag) this.updateMenuBookmarkedStatus(false) this.onClose() } diff --git a/test/components/bookmarksTest.js b/test/components/bookmarksTest.js index 0be7ee2b58d..91d6c38a4e4 100644 --- a/test/components/bookmarksTest.js +++ b/test/components/bookmarksTest.js @@ -1,7 +1,7 @@ /* global describe, it, before */ const Brave = require('../lib/brave') -const {urlInput, navigator, navigatorNotBookmarked, saveButton} = require('../lib/selectors') +const {urlInput, navigator, navigatorNotBookmarked, saveButton, deleteButton} = require('../lib/selectors') describe('bookmarks', function () { function * setup (client) { @@ -56,6 +56,19 @@ describe('bookmarks', function () { .then((val) => val === 'Page 1') }) }) + + describe('and then removed', function () { + before(function *() { + yield this.app.client + .click(navigatorNotBookmarked) + .waitForExist(deleteButton) + .click(deleteButton) + }) + it('removes the bookmark from the toolbar', function * () { + yield this.app.client + .waitForExist('.bookmarkText', 1000, true) + }) + }) }) }) @@ -103,6 +116,18 @@ describe('bookmarks', function () { .then((val) => val === page1Url) }) }) + describe('and then removed', function () { + before(function *() { + yield this.app.client + .click(navigatorNotBookmarked) + .waitForExist(deleteButton) + .click(deleteButton) + }) + it('removes the bookmark from the toolbar', function * () { + yield this.app.client + .waitForExist('.bookmarkText', 1000, true) + }) + }) }) }) }) diff --git a/test/lib/selectors.js b/test/lib/selectors.js index 413233fefdc..230e3d8b327 100644 --- a/test/lib/selectors.js +++ b/test/lib/selectors.js @@ -46,6 +46,7 @@ module.exports = { clearBrowsingDataButton: '.clearBrowsingDataButton', securityTab: '[data-l10n-id="security"]', saveButton: '[data-l10n-id="save"]', + deleteButton: '[data-l10n-id="delete"]', autofillAddressPanel: '.autofillAddressPanel', autofillCreditCardPanel: '.autofillCreditCardPanel' }