Skip to content

Commit 99f60d9

Browse files
authored
Remove buttons (#984)
* Remove re/undo buttons and move console to end * Update tests
1 parent a02a57f commit 99f60d9

File tree

2 files changed

+17
-40
lines changed

2 files changed

+17
-40
lines changed

packages/base/src/toolbar/widget.tsx

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
Toolbar,
1313
ToolbarButton,
1414
addIcon,
15-
redoIcon,
16-
undoIcon,
1715
} from '@jupyterlab/ui-components';
1816
import { CommandRegistry } from '@lumino/commands';
1917
import { Widget } from '@lumino/widgets';
@@ -74,42 +72,12 @@ export class ToolbarWidget extends ReactiveToolbar {
7472
this.addClass('jGIS-toolbar-widget');
7573

7674
if (options.commands) {
77-
const undoButton = new CommandToolbarButton({
78-
id: CommandIDs.undo,
79-
label: '',
80-
icon: undoIcon,
81-
commands: options.commands,
82-
});
83-
84-
this.addItem('undo', undoButton);
85-
undoButton.node.dataset.testid = 'undo-button';
86-
87-
const redoButton = new CommandToolbarButton({
88-
id: CommandIDs.redo,
89-
label: '',
90-
icon: redoIcon,
91-
commands: options.commands,
92-
});
93-
this.addItem('redo', redoButton);
94-
95-
this.addItem('separator0', new Separator());
96-
97-
const toggleConsoleButton = new CommandToolbarButton({
98-
id: CommandIDs.toggleConsole,
99-
commands: options.commands,
100-
label: '',
101-
icon: terminalToolbarIcon,
102-
});
103-
this.addItem('Toggle console', toggleConsoleButton);
104-
toggleConsoleButton.node.dataset.testid = 'toggle-console-button';
105-
106-
this.addItem('separator1', new Separator());
107-
10875
const openLayersBrowserButton = new CommandToolbarButton({
10976
id: CommandIDs.openLayerBrowser,
11077
label: '',
11178
commands: options.commands,
11279
});
80+
11381
this.addItem('openLayerBrowser', openLayersBrowserButton);
11482
openLayersBrowserButton.node.dataset.testid = 'open-layers-browser';
11583

@@ -138,17 +106,18 @@ export class ToolbarWidget extends ReactiveToolbar {
138106
NewSubMenu.open(bbox.x, bbox.bottom);
139107
},
140108
});
141-
NewEntryButton.node.dataset.testid = 'new-entry-button';
142109

143110
this.addItem('New', NewEntryButton);
111+
NewEntryButton.node.dataset.testid = 'new-entry-button';
144112

145-
this.addItem('separator2', new Separator());
113+
this.addItem('separator1', new Separator());
146114

147115
const geolocationButton = new CommandToolbarButton({
148116
id: CommandIDs.getGeolocation,
149117
commands: options.commands,
150118
label: '',
151119
});
120+
152121
this.addItem('Geolocation', geolocationButton);
153122
geolocationButton.node.dataset.testid = 'geolocation-button';
154123

@@ -166,6 +135,7 @@ export class ToolbarWidget extends ReactiveToolbar {
166135
label: '',
167136
commands: options.commands,
168137
});
138+
169139
this.addItem('temporalController', temporalControllerButton);
170140
temporalControllerButton.node.dataset.testid =
171141
'temporal-controller-button';
@@ -175,9 +145,21 @@ export class ToolbarWidget extends ReactiveToolbar {
175145
label: '',
176146
commands: options.commands,
177147
});
148+
178149
this.addItem('addMarker', addMarkerButton);
179150
addMarkerButton.node.dataset.testid = 'add-marker-controller-button';
180151

152+
this.addItem('separator2', new Separator());
153+
154+
const toggleConsoleButton = new CommandToolbarButton({
155+
id: CommandIDs.toggleConsole,
156+
commands: options.commands,
157+
label: '',
158+
icon: terminalToolbarIcon,
159+
});
160+
this.addItem('Toggle console', toggleConsoleButton);
161+
toggleConsoleButton.node.dataset.testid = 'toggle-console-button';
162+
181163
this.addItem('spacer', ReactiveToolbar.createSpacerItem());
182164

183165
// Users

ui-tests/tests/contextmenu.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ test.describe('context menu', () => {
7272
.press('Enter');
7373

7474
await expect(page.getByText('new group', { exact: true })).toHaveCount(1);
75-
await page.getByRole('button', { name: 'Undo' }).click();
76-
await expect(layer).toBeVisible();
7775
});
7876

7977
test('clicking remove layer should remove the layer from the tree', async ({
@@ -121,9 +119,6 @@ test.describe('context menu', () => {
121119

122120
await page.getByRole('menu').getByText('Remove Group').click();
123121
await expect(firstItem).not.toBeVisible();
124-
125-
await page.getByRole('button', { name: 'Undo' }).click();
126-
await expect(firstItem).toBeVisible();
127122
});
128123

129124
test('pressing F2 should start rename for layer', async ({ page }) => {

0 commit comments

Comments
 (0)