Permalink
Browse files

Blocks: Add regression check for block edit using snapshot testing (#…

  • Loading branch information...
gziolo committed Jan 16, 2018
1 parent 34930ca commit f4fb4ad862d2ae7ef75c299dde3e79000f28445d
Showing with 975 additions and 0 deletions.
  1. +51 −0 blocks/library/audio/test/__snapshots__/index.js.snap
  2. +15 −0 blocks/library/audio/test/index.js
  3. +22 −0 blocks/library/button/test/__snapshots__/index.js.snap
  4. +13 −0 blocks/library/button/test/index.js
  5. +13 −0 blocks/library/code/test/__snapshots__/index.js.snap
  6. +13 −0 blocks/library/code/test/index.js
  7. +93 −0 blocks/library/cover-image/test/__snapshots__/index.js.snap
  8. +15 −0 blocks/library/cover-image/test/index.js
  9. +46 −0 blocks/library/embed/test/__snapshots__/index.js.snap
  10. +13 −0 blocks/library/embed/test/index.js
  11. +14 −0 blocks/library/freeform/test/__snapshots__/index.js.snap
  12. +13 −0 blocks/library/freeform/test/index.js
  13. +94 −0 blocks/library/gallery/test/__snapshots__/index.js.snap
  14. +15 −0 blocks/library/gallery/test/index.js
  15. +18 −0 blocks/library/heading/test/__snapshots__/index.js.snap
  16. +13 −0 blocks/library/heading/test/index.js
  17. +9 −0 blocks/library/html/test/__snapshots__/index.js.snap
  18. +13 −0 blocks/library/html/test/index.js
  19. +20 −0 blocks/library/list/test/__snapshots__/index.js.snap
  20. +13 −0 blocks/library/list/test/index.js
  21. +13 −0 blocks/library/more/test/__snapshots__/index.js.snap
  22. +13 −0 blocks/library/more/test/index.js
  23. +28 −0 blocks/library/paragraph/test/__snapshots__/index.js.snap
  24. +13 −0 blocks/library/paragraph/test/index.js
  25. +18 −0 blocks/library/preformatted/test/__snapshots__/index.js.snap
  26. +13 −0 blocks/library/preformatted/test/index.js
  27. +24 −0 blocks/library/pullquote/test/__snapshots__/index.js.snap
  28. +13 −0 blocks/library/pullquote/test/index.js
  29. +24 −0 blocks/library/quote/test/__snapshots__/index.js.snap
  30. +13 −0 blocks/library/quote/test/index.js
  31. +7 −0 blocks/library/separator/test/__snapshots__/index.js.snap
  32. +13 −0 blocks/library/separator/test/index.js
  33. +33 −0 blocks/library/shortcode/test/__snapshots__/index.js.snap
  34. +13 −0 blocks/library/shortcode/test/index.js
  35. +31 −0 blocks/library/table/test/__snapshots__/index.js.snap
  36. +13 −0 blocks/library/table/test/index.js
  37. +44 −0 blocks/library/text-columns/test/__snapshots__/index.js.snap
  38. +13 −0 blocks/library/text-columns/test/index.js
  39. +18 −0 blocks/library/verse/test/__snapshots__/index.js.snap
  40. +13 −0 blocks/library/verse/test/index.js
  41. +51 −0 blocks/library/video/test/__snapshots__/index.js.snap
  42. +15 −0 blocks/library/video/test/index.js
  43. +23 −0 blocks/test/helpers/index.js
@@ -0,0 +1,51 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/audio block edit matches snapshot 1`] = `
<div
class="components-placeholder wp-block-audio"
>
<div
class="components-placeholder__label"
>
<svg
aria-hidden="true"
class="dashicon dashicons-media-audio"
focusable="false"
height="20"
role="img"
viewBox="0 0 20 20"
width="20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M12 2l4 4v12H4V2h8zm0 4h3l-3-3v3zm1 7.26V8.09c0-.11-.04-.21-.12-.29-.07-.08-.16-.11-.27-.1 0 0-3.97.71-4.25.78C8.07 8.54 8 8.8 8 9v3.37c-.2-.09-.42-.07-.6-.07-.38 0-.7.13-.96.39-.26.27-.4.58-.4.96 0 .37.14.69.4.95.26.27.58.4.96.4.34 0 .7-.04.96-.26.26-.23.64-.65.64-1.12V10.3l3-.6V12c-.67-.2-1.17.04-1.44.31-.26.26-.39.58-.39.95 0 .38.13.69.39.96.27.26.71.39 1.08.39.38 0 .7-.13.96-.39.26-.27.4-.58.4-.96z"
/>
</svg>
Audio
</div>
<div
class="components-placeholder__instructions"
>
Select an audio file from your library, or upload a new one:
</div>
<div
class="components-placeholder__fieldset"
>
<form>
<input
class="components-placeholder__input"
placeholder="Enter URL of audio file here…"
type="url"
value=""
/>
<button
class="components-button button button-large"
type="submit"
>
Use URL
</button>
</form>
*** Mock(Media upload button) ***
</div>
</div>
`;
@@ -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();
} );
} );
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/button block edit matches snapshot 1`] = `
<span
class="wp-block-button"
>
<div
class="blocks-editable"
>
<span
aria-label="Add text…"
class="wp-block-button__link blocks-editable__tinymce"
contenteditable="true"
/>
<span
class="blocks-editable__tinymce wp-block-button__link"
>
Add text…
</span>
</div>
</span>
`;
@@ -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();
} );
} );
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/code block edit matches snapshot 1`] = `
<div
class="wp-block-code"
>
<textarea
aria-label="Code"
placeholder="Write code…"
rows="1"
/>
</div>
`;
@@ -0,0 +1,13 @@
/**
* Internal dependencies
*/
import '../';
import { blockEditRender } from 'blocks/test/helpers';
describe( 'core/code', () => {
test( 'block edit matches snapshot', () => {
const wrapper = blockEditRender( 'core/code' );
expect( wrapper ).toMatchSnapshot();
} );
} );
@@ -0,0 +1,93 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/cover-image block edit matches snapshot 1`] = `
<div
class="components-placeholder wp-block-cover-image"
>
<div
class="components-placeholder__label"
>
<svg
aria-hidden="true"
class="dashicon dashicons-format-image"
focusable="false"
height="20"
role="img"
viewBox="0 0 20 20"
width="20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M2.25 1h15.5c.69 0 1.25.56 1.25 1.25v15.5c0 .69-.56 1.25-1.25 1.25H2.25C1.56 19 1 18.44 1 17.75V2.25C1 1.56 1.56 1 2.25 1zM17 17V3H3v14h14zM10 6c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm3 5s0-6 3-6v10c0 .55-.45 1-1 1H5c-.55 0-1-.45-1-1V8c2 0 3 4 3 4s1-3 3-3 3 2 3 2z"
/>
</svg>
Cover Image
</div>
<div
class="components-placeholder__instructions"
>
Drag image here or add from media library
</div>
<div
class="components-placeholder__fieldset"
>
<div
class="components-drop-zone"
>
<div
class="components-drop-zone__content"
>
<svg
aria-hidden="true"
class="dashicon dashicons-upload components-drop-zone__content-icon"
focusable="false"
height="40"
role="img"
viewBox="0 0 20 20"
width="40"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14V8H5l5-6 5 6h-3v6H8zm-2 2v-6H4v8h12.01v-8H14v6H6z"
/>
</svg>
<span
class="components-drop-zone__content-text"
>
Drop files to upload
</span>
</div>
</div>
<div
class="components-form-file-upload"
>
<button
class="components-button components-icon-button wp-block-image__upload-button button button-large"
type="button"
>
<svg
aria-hidden="true"
class="dashicon dashicons-upload"
focusable="false"
height="20"
role="img"
viewBox="0 0 20 20"
width="20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 14V8H5l5-6 5 6h-3v6H8zm-2 2v-6H4v8h12.01v-8H14v6H6z"
/>
</svg>
Upload
</button>
<input
accept="image/*"
style="display:none"
type="file"
/>
</div>
*** Mock(Media upload button) ***
</div>
</div>
`;
@@ -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/cover-image', () => {
test( 'block edit matches snapshot', () => {
const wrapper = blockEditRender( 'core/cover-image' );
expect( wrapper ).toMatchSnapshot();
} );
} );
@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/embed block edit matches snapshot 1`] = `
<div
class="components-placeholder wp-block-embed"
>
<div
class="components-placeholder__label"
>
<svg
aria-hidden="true"
class="dashicon dashicons-embed-generic"
focusable="false"
height="20"
role="img"
viewBox="0 0 20 20"
width="20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M17 4H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-3 6.5L12.5 12l1.5 1.5V15l-3-3 3-3v1.5zm1 4.5v-1.5l1.5-1.5-1.5-1.5V9l3 3-3 3z"
/>
</svg>
Embed URL
</div>
<div
class="components-placeholder__fieldset"
>
<form>
<input
aria-label="Embed URL"
class="components-placeholder__input"
placeholder="Enter URL to embed here…"
type="url"
value=""
/>
<button
class="components-button button button-large"
type="submit"
>
Embed
</button>
</form>
</div>
</div>
`;
@@ -0,0 +1,13 @@
/**
* Internal dependencies
*/
import '../';
import { blockEditRender } from 'blocks/test/helpers';
describe( 'core/embed', () => {
test( 'block edit matches snapshot', () => {
const wrapper = blockEditRender( 'core/embed' );
expect( wrapper ).toMatchSnapshot();
} );
} );
@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`core/freeform block edit matches snapshot 1`] = `
Array [
<div
class="freeform-toolbar"
id="undefined-toolbar"
style="display:none"
/>,
<div
class="wp-block-freeform blocks-editable__tinymce"
/>,
]
`;
@@ -0,0 +1,13 @@
/**
* Internal dependencies
*/
import '../';
import { blockEditRender } from 'blocks/test/helpers';
describe( 'core/freeform', () => {
test( 'block edit matches snapshot', () => {
const wrapper = blockEditRender( 'core/freeform' );
expect( wrapper ).toMatchSnapshot();
} );
} );
Oops, something went wrong.

0 comments on commit f4fb4ad

Please sign in to comment.