Skip to content

Commit

Permalink
[IMP] spreadsheet: global o-disabled CSS class
Browse files Browse the repository at this point in the history
The bottom bar and the bottom bar both had a custom CSS class `o-disabled`
to disable their buttons.

This commit introduces a global `o-disabled` CSS class, and remove the
definitions in the bottom bar and the bottom bar. The class will also be
used in side panels in future commits.

Part of task 3271348

closes #2331

Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
  • Loading branch information
hokolomopo committed Apr 12, 2023
1 parent 18dcf13 commit 3cf6910
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/components/bottom_bar/bottom_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ css/* scss */ `
.o-bottom-bar-arrows {
.o-bottom-bar-arrow {
cursor: pointer;
&.o-disabled {
opacity: 0.4;
cursor: default;
}
&:hover:not([class*="o-disabled"]) {
.o-icon {
opacity: 0.9;
Expand Down
5 changes: 5 additions & 0 deletions src/components/spreadsheet/spreadsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ css/* scss */ `
button {
color: #333;
}
.o-disabled {
opacity: 0.4;
pointer: default;
pointer-events: none;
}
&,
*,
Expand Down
5 changes: 0 additions & 5 deletions src/components/top_bar/top_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,6 @@ css/* scss */ `
margin: 0 6px;
}
.o-disabled {
opacity: 0.6;
cursor: default;
}
.o-dropdown {
position: relative;
display: flex;
Expand Down
11 changes: 7 additions & 4 deletions tests/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,13 @@ describe("Model", () => {
CommandResult.CancelledForUnknownReason
);

expect(model.canDispatch("UPDATE_CELL", { sheetId: "42", col: 0, row: 0, content: "hey" }))
.toBeSuccessfullyDispatched;
expect(model.dispatch("UPDATE_CELL", { sheetId: "42", col: 0, row: 0, content: "hey" }))
.toBeSuccessfullyDispatched;
const sheetId = model.getters.getActiveSheetId();
expect(
model.canDispatch("UPDATE_CELL", { sheetId, col: 0, row: 0, content: "hey" })
).toBeSuccessfullyDispatched();
expect(
model.dispatch("UPDATE_CELL", { sheetId, col: 0, row: 0, content: "hey" })
).toBeSuccessfullyDispatched();
corePluginRegistry.remove("myCorePlugin");
});

Expand Down

0 comments on commit 3cf6910

Please sign in to comment.