Commit fb95af45 authored by Robert Knight's avatar Robert Knight

Add missing types to MarkdownEditor

 - Add missing types in MarkdownEditor implementation

 - Simplify `onEditText` prop to take a single `text` string argument
   instead of an object with a `text` property
parent f9bb654a
......@@ -107,7 +107,8 @@ function AnnotationEditor({
);
const onEditText = useCallback(
({ text }) => {
/** @param {string} text */
text => {
store.createDraft(draft.annotation, { ...draft, text });
},
[draft, store]
......
......@@ -98,7 +98,7 @@ describe('AnnotationEditor', () => {
const editor = wrapper.find('MarkdownEditor');
act(() => {
editor.props().onEditText({ text: 'updated text' });
editor.props().onEditText('updated text');
});
const call = fakeStore.createDraft.getCall(0);
......
This diff is collapsed.
......@@ -119,9 +119,7 @@ describe('MarkdownEditor', () => {
button.simulate('click');
assert.calledWith(onEditText, {
text: 'formatted text',
});
assert.calledWith(onEditText, 'formatted text');
const [formatFunction, ...args] = effect;
assert.calledWith(
formatFunction,
......@@ -184,9 +182,7 @@ describe('MarkdownEditor', () => {
key: keyEvent.key,
});
assert.calledWith(onEditText, {
text: 'formatted text',
});
assert.calledWith(onEditText, 'formatted text');
const [formatFunction, ...args] = effect;
assert.calledWith(
formatFunction,
......@@ -235,9 +231,7 @@ describe('MarkdownEditor', () => {
const input = wrapper.find('textarea').getDOMNode();
input.value = 'changed';
wrapper.find('textarea').simulate('input');
assert.calledWith(onEditText, {
text: 'changed',
});
assert.calledWith(onEditText, 'changed');
});
it('enters preview mode when Preview button is clicked', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment