diff --git a/client/src/components/Draftail/__snapshots__/index.test.js.snap b/client/src/components/Draftail/__snapshots__/index.test.js.snap
new file mode 100644
index 000000000..e2046662f
--- /dev/null
+++ b/client/src/components/Draftail/__snapshots__/index.test.js.snap
@@ -0,0 +1,49 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Draftail #initEditor options 1`] = `
+Object {
+ "autoCapitalize": null,
+ "autoComplete": null,
+ "autoCorrect": null,
+ "blockTypes": Array [],
+ "decorators": Array [],
+ "enableHorizontalRule": Object {
+ "description": "Horizontal line",
+ },
+ "enableLineBreak": Object {
+ "description": "Line break",
+ },
+ "entityTypes": Array [
+ Object {
+ "block": [Function],
+ "decorator": undefined,
+ "source": [Function],
+ "type": "Image",
+ },
+ ],
+ "inlineStyles": Array [],
+ "maxListNesting": 4,
+ "onSave": [Function],
+ "placeholder": "Write here…",
+ "rawContentState": null,
+ "showRedoControl": Object {
+ "description": "Redo",
+ },
+ "showUndoControl": Object {
+ "description": "Undo",
+ },
+ "spellCheck": true,
+ "stateSaveInterval": 250,
+ "stripPastedStyles": false,
+ "textAlignment": null,
+ "textDirectionality": null,
+}
+`;
+
+exports[`Draftail #wrapWagtailIcon works 1`] = `
+
+`;
diff --git a/client/src/components/Draftail/blocks/ImageBlock.js b/client/src/components/Draftail/blocks/ImageBlock.js
index db49ce41c..25b3b9669 100644
--- a/client/src/components/Draftail/blocks/ImageBlock.js
+++ b/client/src/components/Draftail/blocks/ImageBlock.js
@@ -21,7 +21,7 @@ class ImageBlock extends Component {
const { editorState, onChange } = blockProps;
const data = {
- alt: e.currentTarget.value,
+ alt: e.target.value,
};
onChange(DraftUtils.updateBlockEntity(editorState, block, data));
diff --git a/client/src/components/Draftail/blocks/ImageBlock.test.js b/client/src/components/Draftail/blocks/ImageBlock.test.js
index 70cce73d8..c694bdbce 100644
--- a/client/src/components/Draftail/blocks/ImageBlock.test.js
+++ b/client/src/components/Draftail/blocks/ImageBlock.test.js
@@ -65,8 +65,7 @@ describe('ImageBlock', () => {
).toMatchSnapshot();
});
- // Alt field is readonly for now.
- it.skip('changeAlt', () => {
+ it('changeAlt', () => {
jest.spyOn(DraftUtils, 'updateBlockEntity');
DraftUtils.updateBlockEntity.mockImplementation(e => e);
@@ -88,11 +87,17 @@ describe('ImageBlock', () => {
/>
);
- wrapper.find('[type="text"]').simulate('change', {
- currentTarget: {
+ // // Alt field is readonly for now.
+ wrapper.instance().changeAlt({
+ target: {
value: 'new alt',
- },
+ }
});
+ // wrapper.find('[type="text"]').simulate('change', {
+ // target: {
+ // value: 'new alt',
+ // },
+ // });
expect(onChange).toHaveBeenCalled();
expect(DraftUtils.updateBlockEntity).toHaveBeenCalledWith(
diff --git a/client/src/components/Draftail/blocks/MediaBlock.test.js b/client/src/components/Draftail/blocks/MediaBlock.test.js
index 6c19a07b3..131448a2d 100644
--- a/client/src/components/Draftail/blocks/MediaBlock.test.js
+++ b/client/src/components/Draftail/blocks/MediaBlock.test.js
@@ -86,7 +86,7 @@ describe('MediaBlock', () => {
).toMatchSnapshot();
});
- it.skip('large viewport', () => {
+ it('large viewport', () => {
const target = document.createElement('div');
document.body.appendChild(target);
target.getBoundingClientRect = () => ({
diff --git a/client/src/components/Draftail/decorators/TooltipEntity.js b/client/src/components/Draftail/decorators/TooltipEntity.js
index d80098317..de526bc3e 100644
--- a/client/src/components/Draftail/decorators/TooltipEntity.js
+++ b/client/src/components/Draftail/decorators/TooltipEntity.js
@@ -61,7 +61,7 @@ class TooltipEntity extends Component {
closeOnResize
>
- {url ? (
+ {(
{shortenLabel(label)}
- ) : null}
+ )}