From 5b1c31f63be51e27fe63b6454d0d80e6182e86a4 Mon Sep 17 00:00:00 2001 From: Christopher Loverich Date: Fri, 14 Aug 2020 15:58:00 -0500 Subject: [PATCH] fix add journal not reacting to selected journal --- ui/src/journal/header.tsx | 4 ++-- ui/src/journal/journal.test.tsx | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 ui/src/journal/journal.test.tsx diff --git a/ui/src/journal/header.tsx b/ui/src/journal/header.tsx index 73cf137..9432bf9 100644 --- a/ui/src/journal/header.tsx +++ b/ui/src/journal/header.tsx @@ -32,9 +32,9 @@ function Header(props: Props) { const setEditing = useCallback(() => { props.setEditing({ - journal: state.journals[0].name, + journal: selectedJournal, }); - }, [state.journals]); + }, [state.journals, selectedJournal]); if (!state.journals.length) { // really, should be handled above. But this provides some protection diff --git a/ui/src/journal/journal.test.tsx b/ui/src/journal/journal.test.tsx new file mode 100644 index 0000000..cc85721 --- /dev/null +++ b/ui/src/journal/journal.test.tsx @@ -0,0 +1,8 @@ +import { suite, test } from "mocha"; + +suite("header", function () { + test("current journal can be selected from the dropdown"); + test( + "add button creates a document for today in the currently selected journal" + ); +});