From f4fb4ad862d2ae7ef75c299dde3e79000f28445d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=28Greg=29=20Zi=C3=B3=C5=82kowski?= Date: Tue, 16 Jan 2018 08:59:59 +0100 Subject: [PATCH] Blocks: Add regression check for block edit using snapshot testing (#4399) --- .../audio/test/__snapshots__/index.js.snap | 51 ++++++++++ blocks/library/audio/test/index.js | 15 +++ .../button/test/__snapshots__/index.js.snap | 22 +++++ blocks/library/button/test/index.js | 13 +++ .../code/test/__snapshots__/index.js.snap | 13 +++ blocks/library/code/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 93 ++++++++++++++++++ blocks/library/cover-image/test/index.js | 15 +++ .../embed/test/__snapshots__/index.js.snap | 46 +++++++++ blocks/library/embed/test/index.js | 13 +++ .../freeform/test/__snapshots__/index.js.snap | 14 +++ blocks/library/freeform/test/index.js | 13 +++ .../gallery/test/__snapshots__/index.js.snap | 94 +++++++++++++++++++ blocks/library/gallery/test/index.js | 15 +++ .../heading/test/__snapshots__/index.js.snap | 18 ++++ blocks/library/heading/test/index.js | 13 +++ .../html/test/__snapshots__/index.js.snap | 9 ++ blocks/library/html/test/index.js | 13 +++ .../list/test/__snapshots__/index.js.snap | 20 ++++ blocks/library/list/test/index.js | 13 +++ .../more/test/__snapshots__/index.js.snap | 13 +++ blocks/library/more/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 28 ++++++ blocks/library/paragraph/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 18 ++++ blocks/library/preformatted/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 24 +++++ blocks/library/pullquote/test/index.js | 13 +++ .../quote/test/__snapshots__/index.js.snap | 24 +++++ blocks/library/quote/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 7 ++ blocks/library/separator/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 33 +++++++ blocks/library/shortcode/test/index.js | 13 +++ .../table/test/__snapshots__/index.js.snap | 31 ++++++ blocks/library/table/test/index.js | 13 +++ .../test/__snapshots__/index.js.snap | 44 +++++++++ blocks/library/text-columns/test/index.js | 13 +++ .../verse/test/__snapshots__/index.js.snap | 18 ++++ blocks/library/verse/test/index.js | 13 +++ .../video/test/__snapshots__/index.js.snap | 51 ++++++++++ blocks/library/video/test/index.js | 15 +++ blocks/test/helpers/index.js | 23 +++++ 43 files changed, 975 insertions(+) create mode 100644 blocks/library/audio/test/__snapshots__/index.js.snap create mode 100644 blocks/library/audio/test/index.js create mode 100644 blocks/library/button/test/__snapshots__/index.js.snap create mode 100644 blocks/library/button/test/index.js create mode 100644 blocks/library/code/test/__snapshots__/index.js.snap create mode 100644 blocks/library/code/test/index.js create mode 100644 blocks/library/cover-image/test/__snapshots__/index.js.snap create mode 100644 blocks/library/cover-image/test/index.js create mode 100644 blocks/library/embed/test/__snapshots__/index.js.snap create mode 100644 blocks/library/embed/test/index.js create mode 100644 blocks/library/freeform/test/__snapshots__/index.js.snap create mode 100644 blocks/library/freeform/test/index.js create mode 100644 blocks/library/gallery/test/__snapshots__/index.js.snap create mode 100644 blocks/library/gallery/test/index.js create mode 100644 blocks/library/heading/test/__snapshots__/index.js.snap create mode 100644 blocks/library/heading/test/index.js create mode 100644 blocks/library/html/test/__snapshots__/index.js.snap create mode 100644 blocks/library/html/test/index.js create mode 100644 blocks/library/list/test/__snapshots__/index.js.snap create mode 100644 blocks/library/list/test/index.js create mode 100644 blocks/library/more/test/__snapshots__/index.js.snap create mode 100644 blocks/library/more/test/index.js create mode 100644 blocks/library/paragraph/test/__snapshots__/index.js.snap create mode 100644 blocks/library/paragraph/test/index.js create mode 100644 blocks/library/preformatted/test/__snapshots__/index.js.snap create mode 100644 blocks/library/preformatted/test/index.js create mode 100644 blocks/library/pullquote/test/__snapshots__/index.js.snap create mode 100644 blocks/library/pullquote/test/index.js create mode 100644 blocks/library/quote/test/__snapshots__/index.js.snap create mode 100644 blocks/library/quote/test/index.js create mode 100644 blocks/library/separator/test/__snapshots__/index.js.snap create mode 100644 blocks/library/separator/test/index.js create mode 100644 blocks/library/shortcode/test/__snapshots__/index.js.snap create mode 100644 blocks/library/shortcode/test/index.js create mode 100644 blocks/library/table/test/__snapshots__/index.js.snap create mode 100644 blocks/library/table/test/index.js create mode 100644 blocks/library/text-columns/test/__snapshots__/index.js.snap create mode 100644 blocks/library/text-columns/test/index.js create mode 100644 blocks/library/verse/test/__snapshots__/index.js.snap create mode 100644 blocks/library/verse/test/index.js create mode 100644 blocks/library/video/test/__snapshots__/index.js.snap create mode 100644 blocks/library/video/test/index.js create mode 100644 blocks/test/helpers/index.js diff --git a/blocks/library/audio/test/__snapshots__/index.js.snap b/blocks/library/audio/test/__snapshots__/index.js.snap new file mode 100644 index 00000000000000..96289bdbeb0ebf --- /dev/null +++ b/blocks/library/audio/test/__snapshots__/index.js.snap @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`core/audio block edit matches snapshot 1`] = ` +
+
+ + Audio +
+
+ Select an audio file from your library, or upload a new one: +
+
+
+ + +
+ *** Mock(Media upload button) *** +
+
+`; diff --git a/blocks/library/audio/test/index.js b/blocks/library/audio/test/index.js new file mode 100644 index 00000000000000..616372f874777a --- /dev/null +++ b/blocks/library/audio/test/index.js @@ -0,0 +1,15 @@ +/** + * Internal dependencies + */ +import '../'; +import { blockEditRender } from 'blocks/test/helpers'; + +jest.mock( 'blocks/media-upload-button', () => () => '*** Mock(Media upload button) ***' ); + +describe( 'core/audio', () => { + test( 'block edit matches snapshot', () => { + const wrapper = blockEditRender( 'core/audio' ); + + expect( wrapper ).toMatchSnapshot(); + } ); +} ); diff --git a/blocks/library/button/test/__snapshots__/index.js.snap b/blocks/library/button/test/__snapshots__/index.js.snap new file mode 100644 index 00000000000000..60a4909e58e170 --- /dev/null +++ b/blocks/library/button/test/__snapshots__/index.js.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`core/button block edit matches snapshot 1`] = ` + +
+ + + Add text… + +
+
+`; diff --git a/blocks/library/button/test/index.js b/blocks/library/button/test/index.js new file mode 100644 index 00000000000000..8e4fdf4979f539 --- /dev/null +++ b/blocks/library/button/test/index.js @@ -0,0 +1,13 @@ +/** + * Internal dependencies + */ +import '../'; +import { blockEditRender } from 'blocks/test/helpers'; + +describe( 'core/button', () => { + test( 'block edit matches snapshot', () => { + const wrapper = blockEditRender( 'core/button' ); + + expect( wrapper ).toMatchSnapshot(); + } ); +} ); diff --git a/blocks/library/code/test/__snapshots__/index.js.snap b/blocks/library/code/test/__snapshots__/index.js.snap new file mode 100644 index 00000000000000..ff100192b8158c --- /dev/null +++ b/blocks/library/code/test/__snapshots__/index.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`core/code block edit matches snapshot 1`] = ` +
+