Remove confirmation dialog when deleting place bookmarks
This commit is contained in:
@@ -25,10 +25,8 @@ export default class PlaceListsManager extends Component {
|
|||||||
@action
|
@action
|
||||||
async toggleSaved() {
|
async toggleSaved() {
|
||||||
if (this.isSaved) {
|
if (this.isSaved) {
|
||||||
if (confirm(`Remove "${this.args.place.title}" from saved places?`)) {
|
|
||||||
await this.storage.removePlace(this.args.place);
|
await this.storage.removePlace(this.args.place);
|
||||||
if (this.args.onClose) this.args.onClose();
|
if (this.args.onClose) this.args.onClose();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
await this.storage.storePlace(this.args.place);
|
await this.storage.storePlace(this.args.place);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default class PlacesSidebar extends Component {
|
|||||||
if (!place) return;
|
if (!place) return;
|
||||||
|
|
||||||
if (place.createdAt) {
|
if (place.createdAt) {
|
||||||
if (confirm(`Delete "${place.title}"?`)) {
|
// Direct delete without confirmation
|
||||||
try {
|
try {
|
||||||
await this.storage.removePlace(place);
|
await this.storage.removePlace(place);
|
||||||
console.debug('Place deleted:', place.title);
|
console.debug('Place deleted:', place.title);
|
||||||
@@ -85,7 +85,6 @@ export default class PlacesSidebar extends Component {
|
|||||||
console.error('Failed to delete:', e);
|
console.error('Failed to delete:', e);
|
||||||
alert('Failed to delete: ' + e.message);
|
alert('Failed to delete: ' + e.message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// It's a fresh POI -> Save it
|
// It's a fresh POI -> Save it
|
||||||
const placeData = {
|
const placeData = {
|
||||||
|
|||||||
@@ -127,14 +127,6 @@ module('Integration | Component | place-details', function (hooks) {
|
|||||||
|
|
||||||
test('it handles removing a saved place via master toggle', async function (assert) {
|
test('it handles removing a saved place via master toggle', async function (assert) {
|
||||||
let removedPlace = null;
|
let removedPlace = null;
|
||||||
let confirmCalled = false;
|
|
||||||
|
|
||||||
// Mock confirm
|
|
||||||
const originalConfirm = window.confirm;
|
|
||||||
window.confirm = () => {
|
|
||||||
confirmCalled = true;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MockStorage extends Service {
|
class MockStorage extends Service {
|
||||||
lists = [];
|
lists = [];
|
||||||
@@ -168,11 +160,7 @@ module('Integration | Component | place-details', function (hooks) {
|
|||||||
// Click it to remove
|
// Click it to remove
|
||||||
await click(masterToggle);
|
await click(masterToggle);
|
||||||
|
|
||||||
assert.ok(confirmCalled, 'confirm dialog was shown');
|
|
||||||
assert.strictEqual(removedPlace.id, 'saved-id', 'removePlace was called');
|
assert.strictEqual(removedPlace.id, 'saved-id', 'removePlace was called');
|
||||||
|
|
||||||
// Restore confirm
|
|
||||||
window.confirm = originalConfirm;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it adds place to a list', async function (assert) {
|
test('it adds place to a list', async function (assert) {
|
||||||
|
|||||||
Reference in New Issue
Block a user