Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/app-core/src/components/SettingsModal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ describe("SettingsModal date note directories", () => {
expect(await sharesRowFound()).toBe(true);
});

it("names the Unsplash key in the Covers section only where the key row exists", async () => {
const coversDescription = async (): Promise<string> => {
await act(async () => root.render(createElement(SettingsModal)));
const typography = [...host.querySelectorAll<HTMLButtonElement>("button")].find(
(button) => button.textContent?.trim() === "Typography",
);
expect(typography).toBeTruthy();
await act(async () => typography!.click());
return host.textContent ?? "";
};
// The phones' bridge has no Unsplash methods.
let text = await coversDescription();
expect(text).toContain("How a note's cover shows.");
expect(text).not.toContain("Unsplash key the cover picker searches with");

await act(async () => root.render(createElement("div")));
Object.assign(window.zen, {
getUnsplashKeyStatus: vi.fn().mockResolvedValue({ set: false, store: "system", canStore: true }),
});
text = await coversDescription();
expect(text).toContain("and the Unsplash key the cover picker searches with.");
});

it("leaves the shares location out where there is no Share menu extension", async () => {
await act(async () => root.render(createElement(SettingsModal)));
const search = host.querySelector<HTMLInputElement>('input[placeholder="Search settings…"]')!;
Expand Down
8 changes: 7 additions & 1 deletion packages/app-core/src/components/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4005,7 +4005,13 @@ export function SettingsModal(): JSX.Element {

<Section
title="Covers"
description="How a note's cover shows, and the Unsplash key the cover picker searches with."
description={
// A host without the Unsplash bridge (the phones) shows no key
// row below, so the section does not promise one.
unsplashKeySupported()
? "How a note's cover shows, and the Unsplash key the cover picker searches with."
: "How a note's cover shows."
}
>
<SegmentedRow
label="Note covers"
Expand Down
Loading