Skip to content

Commit 411e35f

Browse files
committed
fix(offline): Ensure offline badge shown if user is logged in
1 parent 46f9a6d commit 411e35f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/components/SaveButton/SaveButton.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const SaveButton = ({ className, type, fill = false }) => {
4242

4343
if (loading !== "success" || projectOwner || !buttonType) return null;
4444

45-
if (offlineEnabled && !isOnline && !user) {
45+
if (offlineEnabled && !isOnline) {
4646
return (
4747
<div
4848
className={classNames(className, "offline-badge")}

src/components/SaveButton/SaveButton.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,21 @@ describe("When project is loaded", () => {
260260
expect(screen.queryByText("header.offline")).not.toBeInTheDocument();
261261
});
262262

263-
test("does not show offline badge when user is logged in", () => {
263+
test("shows offline badge when user is logged in and offline", () => {
264264
const store = configureStore([])({
265265
...offlineState,
266+
editor: {
267+
...offlineState.editor,
268+
project: { identifier: "some-project", user_id: "some-other-user" },
269+
},
266270
auth: { user: { profile: { user: "some-user" } } },
267271
});
268272
render(
269273
<Provider store={store}>
270274
<SaveButton />
271275
</Provider>,
272276
);
273-
expect(screen.queryByText("header.offline")).not.toBeInTheDocument();
277+
expect(screen.queryByText("header.offline")).toBeInTheDocument();
274278
});
275279

276280
describe("accessibility", () => {

0 commit comments

Comments
 (0)