Skip to content

Commit ec60c8d

Browse files
Leslie NgoLeslie Ngo
Leslie Ngo
authored and
Leslie Ngo
committed
topic edit modal: Modify webview unit tests to accommodate feature update.
1 parent daa4b6f commit ec60c8d

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

src/boot/TopicModalProvider.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ type Props = $ReadOnly<{|
1111
children: Node,
1212
|}>;
1313

14-
type TopicModalContext = {|
14+
type TopicModalContext = $ReadOnly<{|
1515
startEditTopic: (
1616
streamId: number,
1717
topic: string,
1818
streamsById: Map<number, Stream>,
1919
_: GetText,
2020
) => Promise<void>,
2121
closeEditTopicModal: () => void,
22-
|};
22+
|}>;
2323

24+
// $FlowIssue[incompatible-type]
2425
const TopicModal: Context<TopicModalContext> = createContext(undefined);
2526

26-
export const useTopicModalHandler = () => useContext(TopicModal);
27+
export const useTopicModalHandler = (): TopicModalContext => useContext(TopicModal);
2728

2829
export default function TopicModalProvider(props: Props): Node {
2930
const { children } = props;

src/streams/TopicItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function TopicItem(props: Props): Node {
7171
useActionSheet().showActionSheetWithOptions;
7272
const _ = useContext(TranslationContext);
7373
const dispatch = useDispatch();
74-
const startEditTopic = useTopicModalHandler();
74+
const { startEditTopic } = useTopicModalHandler();
7575
const backgroundData = useSelector(state => ({
7676
auth: getAuth(state),
7777
mute: getMute(state),

src/webview/MessageList.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ export type Props = $ReadOnly<{|
7878

7979
// From `withGetText`.
8080
_: GetText,
81-
82-
// From 'TopicModalProvider'.
83-
startEditTopic: (
84-
streamId: number,
85-
topic: string,
86-
streamsById: Map<number, Stream>,
87-
_: GetText,
88-
) => Promise<void>,
8981
|}>;
9082

9183
/**

src/webview/__tests__/generateInboundEvents-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('generateInboundEvents', () => {
2929
narrow: HOME_NARROW,
3030
showMessagePlaceholders: false,
3131
startEditMessage: jest.fn(),
32+
startEditTopic: jest.fn(),
3233
dispatch: jest.fn(),
3334
...baseSelectorProps,
3435
showActionSheetWithOptions: jest.fn(),

0 commit comments

Comments
 (0)