@wordpress/block-library 9.47.0 → 9.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/columns/transforms.cjs +65 -0
- package/build/columns/transforms.cjs.map +2 -2
- package/build/comments/edit/placeholder.cjs +1 -1
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +16 -4
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/gallery/edit.cjs +212 -331
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/transforms.cjs +43 -0
- package/build/gallery/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +0 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/image/image.cjs +14 -3
- package/build/image/image.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +8 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list/edit.cjs +1 -8
- package/build/list/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +1 -44
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/list-item/hooks/use-merge.cjs +47 -24
- package/build/list-item/hooks/use-merge.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +15 -26
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +0 -1
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-submenu/edit.cjs +2 -1
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/paragraph/deprecated.cjs +1 -0
- package/build/paragraph/deprecated.cjs.map +2 -2
- package/build/paragraph/edit.cjs +10 -1
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/playlist/block.json +12 -0
- package/build/playlist/edit.cjs +27 -1
- package/build/playlist/edit.cjs.map +2 -2
- package/build/playlist/save.cjs +8 -1
- package/build/playlist/save.cjs.map +2 -2
- package/build/playlist/view.cjs +1 -0
- package/build/playlist/view.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +6 -4
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-time-to-read/index.cjs +1 -1
- package/build/post-time-to-read/index.cjs.map +2 -2
- package/build/post-time-to-read/variations.cjs +1 -1
- package/build/post-time-to-read/variations.cjs.map +2 -2
- package/build/pullquote/edit.cjs +2 -7
- package/build/pullquote/edit.cjs.map +2 -2
- package/build/quote/edit.cjs +4 -9
- package/build/quote/edit.cjs.map +2 -2
- package/build/shortcode/transforms.cjs +2 -2
- package/build/shortcode/transforms.cjs.map +2 -2
- package/build/site-logo/edit.cjs +4 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/utils/waveform-player.cjs +42 -9
- package/build/utils/waveform-player.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +6 -4
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/video/edit-common-settings.cjs +3 -6
- package/build/video/edit-common-settings.cjs.map +2 -2
- package/build-module/columns/transforms.mjs +65 -0
- package/build-module/columns/transforms.mjs.map +2 -2
- package/build-module/comments/edit/placeholder.mjs +1 -1
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +16 -4
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +214 -334
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/transforms.mjs +43 -0
- package/build-module/gallery/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -2
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +15 -3
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +8 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list/edit.mjs +2 -9
- package/build-module/list/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +1 -45
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +48 -25
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +16 -33
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +0 -1
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-submenu/edit.mjs +2 -1
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/paragraph/deprecated.mjs +1 -0
- package/build-module/paragraph/deprecated.mjs.map +2 -2
- package/build-module/paragraph/edit.mjs +12 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +12 -0
- package/build-module/playlist/edit.mjs +27 -1
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/save.mjs +8 -1
- package/build-module/playlist/save.mjs.map +2 -2
- package/build-module/playlist/view.mjs +1 -0
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +6 -4
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/index.mjs +1 -1
- package/build-module/post-time-to-read/index.mjs.map +2 -2
- package/build-module/post-time-to-read/variations.mjs +2 -2
- package/build-module/post-time-to-read/variations.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +2 -7
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/quote/edit.mjs +5 -10
- package/build-module/quote/edit.mjs.map +2 -2
- package/build-module/shortcode/transforms.mjs +2 -2
- package/build-module/shortcode/transforms.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +5 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/utils/waveform-player.mjs +44 -11
- package/build-module/utils/waveform-player.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +6 -4
- package/build-module/utils/waveform-utils.mjs.map +2 -2
- package/build-module/video/edit-common-settings.mjs +4 -7
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-style/comment-template/style-rtl.css +1 -0
- package/build-style/comment-template/style.css +1 -0
- package/build-style/common-rtl.css +30 -10
- package/build-style/common.css +30 -10
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- package/build-style/editor-rtl.css +22 -11
- package/build-style/editor.css +22 -11
- package/build-style/form-input/style-rtl.css +2 -0
- package/build-style/form-input/style.css +2 -0
- package/build-style/gallery/style-rtl.css +4 -2
- package/build-style/gallery/style.css +4 -2
- package/build-style/media-text/style-rtl.css +2 -1
- package/build-style/media-text/style.css +2 -1
- package/build-style/playlist/style-rtl.css +3 -0
- package/build-style/playlist/style.css +3 -0
- package/build-style/query/editor-rtl.css +8 -4
- package/build-style/query/editor.css +8 -4
- package/build-style/read-more/style-rtl.css +1 -0
- package/build-style/read-more/style.css +1 -0
- package/build-style/reset-rtl.css +3 -1
- package/build-style/reset.css +3 -1
- package/build-style/search/style-rtl.css +3 -1
- package/build-style/search/style.css +3 -1
- package/build-style/site-logo/editor-rtl.css +2 -1
- package/build-style/site-logo/editor.css +2 -1
- package/build-style/style-rtl.css +53 -17
- package/build-style/style.css +53 -17
- package/build-style/tab/style-rtl.css +3 -1
- package/build-style/tab/style.css +3 -1
- package/build-style/template-part/editor-rtl.css +8 -4
- package/build-style/template-part/editor.css +8 -4
- package/build-style/video/style-rtl.css +2 -1
- package/build-style/video/style.css +2 -1
- package/package.json +51 -47
- package/src/accordion/README.md +97 -0
- package/src/accordion-heading/README.md +81 -0
- package/src/accordion-item/README.md +85 -0
- package/src/accordion-panel/README.md +74 -0
- package/src/archives/README.md +56 -0
- package/src/audio/README.md +55 -0
- package/src/avatar/README.md +74 -0
- package/src/block/README.md +56 -0
- package/src/breadcrumbs/README.md +67 -0
- package/src/button/README.md +93 -0
- package/src/buttons/README.md +80 -0
- package/src/calendar/README.md +51 -0
- package/src/categories/README.md +69 -0
- package/src/code/README.md +55 -0
- package/src/column/README.md +72 -0
- package/src/columns/README.md +90 -0
- package/src/columns/test/transforms.js +164 -0
- package/src/columns/transforms.js +74 -0
- package/src/comment-author-avatar/README.md +63 -0
- package/src/comment-author-name/README.md +67 -0
- package/src/comment-content/README.md +61 -0
- package/src/comment-date/README.md +67 -0
- package/src/comment-edit-link/README.md +67 -0
- package/src/comment-reply-link/README.md +63 -0
- package/src/comment-template/README.md +60 -0
- package/src/comments/README.md +88 -0
- package/src/comments/edit/placeholder.js +1 -1
- package/src/comments-pagination/README.md +77 -0
- package/src/comments-pagination-next/README.md +64 -0
- package/src/comments-pagination-numbers/README.md +64 -0
- package/src/comments-pagination-previous/README.md +64 -0
- package/src/comments-title/README.md +70 -0
- package/src/common.scss +63 -10
- package/src/cover/README.md +111 -0
- package/src/cover/edit/inspector-controls.js +61 -45
- package/src/cover/test/edit.js +38 -0
- package/src/details/README.md +65 -0
- package/src/embed/README.md +56 -0
- package/src/file/README.md +60 -0
- package/src/footnotes/README.md +64 -0
- package/src/form/README.md +90 -0
- package/src/form-input/README.md +74 -0
- package/src/form-submission-notification/README.md +50 -0
- package/src/form-submit-button/README.md +54 -0
- package/src/freeform/README.md +49 -0
- package/src/gallery/README.md +115 -0
- package/src/gallery/edit.js +213 -350
- package/src/gallery/test/transforms.js +155 -0
- package/src/gallery/transforms.js +47 -0
- package/src/group/README.md +80 -0
- package/src/heading/README.md +60 -0
- package/src/heading/edit.js +1 -2
- package/src/home-link/README.md +66 -0
- package/src/home-link/index.php +3 -15
- package/src/html/README.md +48 -0
- package/src/icon/README.md +63 -0
- package/src/image/README.md +102 -0
- package/src/image/image.js +50 -35
- package/src/image/index.php +4 -4
- package/src/image/test/use-open-image-media-editor-modal.js +41 -0
- package/src/image/use-open-image-media-editor-modal.js +7 -1
- package/src/latest-comments/README.md +57 -0
- package/src/latest-posts/README.md +71 -0
- package/src/list/README.md +70 -0
- package/src/list/edit.js +2 -9
- package/src/list/ordered-list-settings.js +46 -92
- package/src/list-item/README.md +71 -0
- package/src/list-item/hooks/use-merge.js +53 -46
- package/src/loginout/README.md +56 -0
- package/src/math/README.md +50 -0
- package/src/media-text/README.md +92 -0
- package/src/missing/README.md +55 -0
- package/src/more/README.md +49 -0
- package/src/navigation/README.md +115 -0
- package/src/navigation/edit/index.js +10 -30
- package/src/navigation-link/README.md +93 -0
- package/src/navigation-link/edit.js +0 -1
- package/src/navigation-link/index.php +1 -15
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +45 -134
- package/src/navigation-overlay-close/README.md +48 -0
- package/src/navigation-submenu/README.md +84 -0
- package/src/navigation-submenu/edit.js +1 -0
- package/src/navigation-submenu/index.php +1 -17
- package/src/nextpage/README.md +50 -0
- package/src/page-list/README.md +84 -0
- package/src/page-list/index.php +3 -15
- package/src/page-list-item/README.md +77 -0
- package/src/paragraph/README.md +70 -0
- package/src/paragraph/deprecated.js +1 -0
- package/src/paragraph/edit.js +13 -1
- package/src/pattern/README.md +45 -0
- package/src/playlist/README.md +86 -0
- package/src/playlist/block.json +12 -0
- package/src/playlist/edit.js +27 -0
- package/src/playlist/index.php +10 -3
- package/src/playlist/save.js +9 -1
- package/src/playlist/style.scss +7 -0
- package/src/playlist/view.js +1 -0
- package/src/playlist-track/README.md +69 -0
- package/src/post-author/README.md +78 -0
- package/src/post-author-biography/README.md +59 -0
- package/src/post-author-name/README.md +63 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-comment/README.md +61 -0
- package/src/post-comments-count/README.md +58 -0
- package/src/post-comments-form/README.md +59 -0
- package/src/post-comments-link/README.md +60 -0
- package/src/post-content/README.md +71 -0
- package/src/post-date/README.md +65 -0
- package/src/post-date/index.php +1 -1
- package/src/post-excerpt/README.md +66 -0
- package/src/post-featured-image/README.md +85 -0
- package/src/post-featured-image/edit.js +15 -10
- package/src/post-featured-image/index.php +1 -1
- package/src/post-navigation-link/README.md +63 -0
- package/src/post-template/README.md +71 -0
- package/src/post-terms/README.md +65 -0
- package/src/post-time-to-read/README.md +63 -0
- package/src/post-time-to-read/index.js +1 -1
- package/src/post-time-to-read/variations.js +2 -2
- package/src/post-title/README.md +69 -0
- package/src/preformatted/README.md +50 -0
- package/src/pullquote/README.md +64 -0
- package/src/pullquote/edit.js +1 -7
- package/src/query/README.md +64 -0
- package/src/query-no-results/README.md +65 -0
- package/src/query-pagination/README.md +79 -0
- package/src/query-pagination-next/README.md +67 -0
- package/src/query-pagination-numbers/README.md +65 -0
- package/src/query-pagination-previous/README.md +67 -0
- package/src/query-title/README.md +65 -0
- package/src/query-total/README.md +66 -0
- package/src/quote/README.md +75 -0
- package/src/quote/edit.js +3 -9
- package/src/read-more/README.md +61 -0
- package/src/read-more/index.php +2 -2
- package/src/rss/README.md +62 -0
- package/src/search/README.md +66 -0
- package/src/separator/README.md +62 -0
- package/src/shortcode/README.md +44 -0
- package/src/shortcode/transforms.js +2 -2
- package/src/site-logo/README.md +72 -0
- package/src/site-logo/edit.js +5 -0
- package/src/site-tagline/README.md +56 -0
- package/src/site-title/README.md +57 -0
- package/src/social-link/README.md +64 -0
- package/src/social-links/README.md +98 -0
- package/src/spacer/README.md +53 -0
- package/src/tab/README.md +69 -0
- package/src/tab-list/README.md +79 -0
- package/src/tab-panel/README.md +75 -0
- package/src/tab-panels/README.md +75 -0
- package/src/table/README.md +71 -0
- package/src/table-of-contents/README.md +61 -0
- package/src/tabs/README.md +83 -0
- package/src/tag-cloud/README.md +62 -0
- package/src/template-part/README.md +48 -0
- package/src/term-count/README.md +59 -0
- package/src/term-description/README.md +60 -0
- package/src/term-name/README.md +65 -0
- package/src/term-template/README.md +65 -0
- package/src/terms-query/README.md +58 -0
- package/src/text-columns/README.md +51 -0
- package/src/utils/test/waveform-player.js +254 -0
- package/src/utils/waveform-player.js +90 -18
- package/src/utils/waveform-utils.js +15 -11
- package/src/verse/README.md +58 -0
- package/src/video/README.md +58 -0
- package/src/video/edit-common-settings.js +4 -7
- package/src/audio/edit.native.js +0 -250
- package/src/audio/style.native.scss +0 -13
- package/src/audio/test/__snapshots__/edit.native.js.snap +0 -546
- package/src/audio/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/audio/test/edit.native.js +0 -132
- package/src/audio/test/transforms.native.js +0 -43
- package/src/audio/transforms.native.js +0 -12
- package/src/block/edit-title.native.js +0 -67
- package/src/block/edit.native.js +0 -247
- package/src/block/editor.native.scss +0 -125
- package/src/block/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/block/test/edit.native.js +0 -262
- package/src/block/test/transforms.native.js +0 -40
- package/src/button/color-background.native.js +0 -41
- package/src/button/edit.native.js +0 -567
- package/src/button/editor.native.scss +0 -70
- package/src/button/rich-text.android.scss +0 -6
- package/src/button/rich-text.ios.scss +0 -6
- package/src/buttons/edit.native.js +0 -157
- package/src/buttons/editor.native.scss +0 -11
- package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -99
- package/src/buttons/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/buttons/test/edit.native.js +0 -485
- package/src/buttons/test/transforms.native.js +0 -48
- package/src/buttons/transforms.native.js +0 -12
- package/src/code/edit.native.js +0 -70
- package/src/code/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/code/test/edit.native.js +0 -65
- package/src/code/theme.native.scss +0 -22
- package/src/code/transforms.native.js +0 -12
- package/src/column/column-preview.native.js +0 -58
- package/src/column/edit.native.js +0 -273
- package/src/column/editor.native.scss +0 -75
- package/src/columns/columnCalculations.native.js +0 -178
- package/src/columns/edit.native.js +0 -507
- package/src/columns/editor.native.scss +0 -17
- package/src/columns/test/__snapshots__/edit.native.js.snap +0 -305
- package/src/columns/test/__snapshots__/transforms.native.js.snap +0 -61
- package/src/columns/test/edit.native.js +0 -496
- package/src/columns/test/transforms.native.js +0 -89
- package/src/columns/transforms.native.js +0 -12
- package/src/cover/controls.native.js +0 -307
- package/src/cover/edit.native.js +0 -708
- package/src/cover/focal-point-settings-button.native.js +0 -53
- package/src/cover/overlay-color-settings.native.js +0 -106
- package/src/cover/style.native.scss +0 -220
- package/src/cover/test/__snapshots__/edit.native.js.snap +0 -105
- package/src/cover/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/cover/test/edit.native.js +0 -701
- package/src/cover/test/transforms.native.js +0 -116
- package/src/cover/transforms.native.js +0 -12
- package/src/cover/use-cover-is-dark.native.js +0 -51
- package/src/embed/edit.native.js +0 -345
- package/src/embed/embed-controls.native.js +0 -65
- package/src/embed/embed-link-settings.native.js +0 -99
- package/src/embed/embed-loading.native.js +0 -29
- package/src/embed/embed-no-preview.native.js +0 -230
- package/src/embed/embed-placeholder.native.js +0 -178
- package/src/embed/embed-preview.native.js +0 -157
- package/src/embed/styles.native.scss +0 -196
- package/src/embed/test/__snapshots__/index.native.js.snap +0 -191
- package/src/embed/test/__snapshots__/transforms.native.js.snap +0 -23
- package/src/embed/test/index.native.js +0 -1125
- package/src/embed/test/transforms.native.js +0 -44
- package/src/embed/transforms.native.js +0 -12
- package/src/embed/wp-embed-preview.native.js +0 -80
- package/src/file/edit.native.js +0 -605
- package/src/file/style.native.scss +0 -79
- package/src/file/test/__snapshots__/edit.native.js.snap +0 -580
- package/src/file/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/file/test/edit.native.js +0 -93
- package/src/file/test/transforms.native.js +0 -43
- package/src/file/transforms.native.js +0 -12
- package/src/freeform/edit.native.js +0 -13
- package/src/freeform/test/__snapshots__/index.native.js.snap +0 -7
- package/src/freeform/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/freeform/test/index.native.js +0 -57
- package/src/freeform/test/transforms.native.js +0 -39
- package/src/gallery/gallery-styles.native.scss +0 -8
- package/src/gallery/gallery.native.js +0 -124
- package/src/gallery/styles.native.scss +0 -7
- package/src/gallery/test/__snapshots__/index.native.js.snap +0 -177
- package/src/gallery/test/__snapshots__/transforms.native.js.snap +0 -53
- package/src/gallery/test/helpers.native.js +0 -106
- package/src/gallery/test/index.native.js +0 -700
- package/src/gallery/test/transforms.native.js +0 -53
- package/src/gallery/test/use-get-media.native.js +0 -24
- package/src/gallery/transforms.native.js +0 -12
- package/src/gallery/use-get-media.native.js +0 -49
- package/src/group/edit.native.js +0 -137
- package/src/group/editor.native.scss +0 -56
- package/src/group/test/__snapshots__/edit.native.js.snap +0 -19
- package/src/group/test/__snapshots__/transforms.native.js.snap +0 -35
- package/src/group/test/edit.native.js +0 -100
- package/src/group/test/transforms.native.js +0 -73
- package/src/heading/edit.native.js +0 -159
- package/src/heading/test/__snapshots__/index.native.js.snap +0 -43
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/heading/test/index.native.js +0 -257
- package/src/heading/test/transforms.native.js +0 -46
- package/src/heading/transforms.native.js +0 -12
- package/src/html/transforms.native.js +0 -11
- package/src/image/edit.native.js +0 -959
- package/src/image/styles.native.scss +0 -70
- package/src/image/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/image/test/edit.native.js +0 -459
- package/src/image/test/transforms.native.js +0 -49
- package/src/image/transforms.native.js +0 -12
- package/src/index.native.js +0 -274
- package/src/latest-posts/edit.native.js +0 -294
- package/src/latest-posts/style.native.scss +0 -47
- package/src/latest-posts/test/__snapshots__/edit.native.js.snap +0 -3
- package/src/latest-posts/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/latest-posts/test/edit.native.js +0 -49
- package/src/latest-posts/test/transforms.native.js +0 -61
- package/src/list/tag-name.native.js +0 -12
- package/src/list/test/__snapshots__/edit.native.js.snap +0 -121
- package/src/list/test/__snapshots__/transforms.native.js.snap +0 -85
- package/src/list/test/edit.native.js +0 -602
- package/src/list/test/transforms.native.js +0 -56
- package/src/list/transforms.native.js +0 -12
- package/src/list-item/edit.native.js +0 -175
- package/src/list-item/hooks/use-enter.native.js +0 -81
- package/src/list-item/icons.native.js +0 -34
- package/src/list-item/list-style-type.native.js +0 -146
- package/src/list-item/style.native.scss +0 -57
- package/src/media-text/edit.native.js +0 -417
- package/src/media-text/icon-retry.native.js +0 -11
- package/src/media-text/media-container.native.js +0 -393
- package/src/media-text/style.native.scss +0 -191
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/media-text/test/edit.native.js +0 -58
- package/src/media-text/test/transforms.native.js +0 -116
- package/src/media-text/transforms.native.js +0 -12
- package/src/missing/edit.native.js +0 -294
- package/src/missing/style.native.scss +0 -79
- package/src/missing/test/__snapshots__/edit.native.js.snap +0 -110
- package/src/missing/test/edit-integration.native.js +0 -168
- package/src/missing/test/edit.native.js +0 -81
- package/src/more/edit.native.js +0 -36
- package/src/more/editor.native.scss +0 -21
- package/src/more/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/more/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/more/test/edit.native.js +0 -41
- package/src/more/test/transforms.native.js +0 -42
- package/src/more/transforms.native.js +0 -12
- package/src/navigation-link/shared/build-css-font-sizes.php +0 -43
- package/src/nextpage/edit.native.js +0 -58
- package/src/nextpage/editor.native.scss +0 -21
- package/src/nextpage/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/nextpage/test/transforms.native.js +0 -42
- package/src/nextpage/transforms.native.js +0 -12
- package/src/paragraph/edit.native.js +0 -116
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +0 -88
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -65
- package/src/paragraph/test/edit.native.js +0 -999
- package/src/paragraph/test/transforms.native.js +0 -51
- package/src/paragraph/transforms.native.js +0 -12
- package/src/preformatted/edit.native.js +0 -48
- package/src/preformatted/styles.native.scss +0 -30
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +0 -95
- package/src/preformatted/test/__snapshots__/transforms.native.js.snap +0 -37
- package/src/preformatted/test/edit.native.js +0 -111
- package/src/preformatted/test/transforms.native.js +0 -47
- package/src/preformatted/transforms.native.js +0 -12
- package/src/pullquote/blockquote.native.js +0 -39
- package/src/pullquote/blockquote.native.scss +0 -8
- package/src/pullquote/edit.native.js +0 -128
- package/src/pullquote/figure.native.js +0 -33
- package/src/pullquote/figure.native.scss +0 -16
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/pullquote/test/edit.native.js +0 -73
- package/src/pullquote/test/transforms.native.js +0 -46
- package/src/pullquote/transforms.native.js +0 -12
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/quote/test/edit.native.js +0 -94
- package/src/quote/test/transforms.native.js +0 -69
- package/src/quote/transforms.native.js +0 -12
- package/src/search/edit.native.js +0 -486
- package/src/search/style.native.scss +0 -99
- package/src/search/test/__snapshots__/edit.native.js.snap +0 -827
- package/src/search/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/search/test/edit.native.js +0 -170
- package/src/search/test/transforms.native.js +0 -40
- package/src/separator/separator-settings.native.js +0 -3
- package/src/separator/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/separator/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/separator/test/edit.native.js +0 -41
- package/src/separator/test/transforms.native.js +0 -42
- package/src/separator/transforms.native.js +0 -12
- package/src/shortcode/edit.native.js +0 -77
- package/src/shortcode/style.native.scss +0 -44
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +0 -9
- package/src/shortcode/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/shortcode/test/edit.native.js +0 -70
- package/src/shortcode/test/transforms.native.js +0 -42
- package/src/shortcode/transforms.native.js +0 -12
- package/src/social-link/edit.native.js +0 -219
- package/src/social-link/editor.native.scss +0 -18
- package/src/social-links/edit.native.js +0 -147
- package/src/social-links/editor.native.scss +0 -25
- package/src/social-links/test/__snapshots__/edit.native.js.snap +0 -57
- package/src/social-links/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/social-links/test/edit.native.js +0 -266
- package/src/social-links/test/transforms.native.js +0 -53
- package/src/spacer/controls.native.js +0 -86
- package/src/spacer/edit.native.js +0 -110
- package/src/spacer/editor.native.scss +0 -18
- package/src/spacer/save.native.js +0 -18
- package/src/spacer/test/__snapshots__/index.native.js.snap +0 -43
- package/src/spacer/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/spacer/test/index.native.js +0 -257
- package/src/spacer/test/transforms.native.js +0 -42
- package/src/table/transforms.native.js +0 -11
- package/src/text-columns/transforms.native.js +0 -12
- package/src/utils/init-block.native.js +0 -40
- package/src/utils/transformation-categories.native.js +0 -47
- package/src/verse/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/verse/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/verse/test/edit.native.js +0 -118
- package/src/verse/test/transforms.native.js +0 -46
- package/src/verse/transforms.native.js +0 -12
- package/src/video/edit.native.js +0 -406
- package/src/video/icon-retry.native.js +0 -11
- package/src/video/style.native.scss +0 -81
- package/src/video/test/__snapshots__/transforms.native.js.snap +0 -41
- package/src/video/test/edit.native.js +0 -53
- package/src/video/test/transforms.native.js +0 -49
- package/src/video/transforms.native.js +0 -12
|
@@ -1,999 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
act,
|
|
6
|
-
addBlock,
|
|
7
|
-
dismissModal,
|
|
8
|
-
getBlock,
|
|
9
|
-
typeInRichText,
|
|
10
|
-
fireEvent,
|
|
11
|
-
getEditorHtml,
|
|
12
|
-
initializeEditor,
|
|
13
|
-
render,
|
|
14
|
-
setupCoreBlocks,
|
|
15
|
-
triggerBlockListLayout,
|
|
16
|
-
waitFor,
|
|
17
|
-
within,
|
|
18
|
-
withFakeTimers,
|
|
19
|
-
waitForElementToBeRemoved,
|
|
20
|
-
waitForModalVisible,
|
|
21
|
-
} from 'test/helpers';
|
|
22
|
-
import Clipboard from '@react-native-clipboard/clipboard';
|
|
23
|
-
import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* WordPress dependencies
|
|
27
|
-
*/
|
|
28
|
-
import { BACKSPACE, ENTER } from '@wordpress/keycodes';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Internal dependencies
|
|
32
|
-
*/
|
|
33
|
-
import Paragraph from '../edit';
|
|
34
|
-
|
|
35
|
-
// Mock debounce to prevent potentially belated state updates.
|
|
36
|
-
jest.mock( '@wordpress/compose/src/utils/debounce', () => ( {
|
|
37
|
-
debounce: ( fn ) => {
|
|
38
|
-
fn.cancel = jest.fn();
|
|
39
|
-
return fn;
|
|
40
|
-
},
|
|
41
|
-
} ) );
|
|
42
|
-
// Mock link suggestions that are fetched by the link picker
|
|
43
|
-
// when typing a search query.
|
|
44
|
-
jest.mock( '@wordpress/core-data/src/fetch', () => ( {
|
|
45
|
-
__experimentalFetchLinkSuggestions: jest.fn().mockResolvedValue( [ {} ] ),
|
|
46
|
-
} ) );
|
|
47
|
-
|
|
48
|
-
setupCoreBlocks();
|
|
49
|
-
|
|
50
|
-
const getTestComponentWithContent = ( content ) => {
|
|
51
|
-
return render(
|
|
52
|
-
<Paragraph
|
|
53
|
-
attributes={ { content } }
|
|
54
|
-
setAttributes={ jest.fn() }
|
|
55
|
-
onReplace={ jest.fn() }
|
|
56
|
-
insertBlocksAfter={ jest.fn() }
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
describe( 'Paragraph block', () => {
|
|
62
|
-
it( 'should render without crashing and match snapshot', () => {
|
|
63
|
-
const screen = getTestComponentWithContent( '' );
|
|
64
|
-
expect( screen.toJSON() ).toMatchSnapshot();
|
|
65
|
-
} );
|
|
66
|
-
|
|
67
|
-
it( 'should prevent deleting the first Paragraph block when pressing backspace at the start', async () => {
|
|
68
|
-
// Arrange
|
|
69
|
-
const screen = await initializeEditor();
|
|
70
|
-
await addBlock( screen, 'Paragraph' );
|
|
71
|
-
|
|
72
|
-
// Act
|
|
73
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
74
|
-
fireEvent.press( paragraphBlock );
|
|
75
|
-
const paragraphTextInput =
|
|
76
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
77
|
-
typeInRichText(
|
|
78
|
-
paragraphTextInput,
|
|
79
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
80
|
-
{ finalSelectionStart: 0, finalSelectionEnd: 0 }
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
fireEvent( paragraphTextInput, 'onKeyDown', {
|
|
84
|
-
nativeEvent: {},
|
|
85
|
-
preventDefault() {},
|
|
86
|
-
keyCode: BACKSPACE,
|
|
87
|
-
} );
|
|
88
|
-
|
|
89
|
-
// Assert
|
|
90
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
91
|
-
} );
|
|
92
|
-
|
|
93
|
-
it( 'should be able to use a prefix to create a Heading block', async () => {
|
|
94
|
-
const screen = await initializeEditor();
|
|
95
|
-
await addBlock( screen, 'Paragraph' );
|
|
96
|
-
const text = '# ';
|
|
97
|
-
|
|
98
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
99
|
-
fireEvent.press( paragraphBlock );
|
|
100
|
-
const paragraphTextInput =
|
|
101
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
102
|
-
typeInRichText( paragraphTextInput, text, {
|
|
103
|
-
finalSelectionStart: 1,
|
|
104
|
-
finalSelectionEnd: 1,
|
|
105
|
-
} );
|
|
106
|
-
|
|
107
|
-
fireEvent( paragraphTextInput, 'onChange', {
|
|
108
|
-
nativeEvent: { text },
|
|
109
|
-
preventDefault() {},
|
|
110
|
-
} );
|
|
111
|
-
|
|
112
|
-
const headingBlock = getBlock( screen, 'Heading' );
|
|
113
|
-
expect( headingBlock ).toBeVisible();
|
|
114
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
115
|
-
} );
|
|
116
|
-
|
|
117
|
-
it( 'should be able to use a prefix to create a Quote block', async () => {
|
|
118
|
-
const screen = await initializeEditor();
|
|
119
|
-
await addBlock( screen, 'Paragraph' );
|
|
120
|
-
const text = '> ';
|
|
121
|
-
|
|
122
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
123
|
-
fireEvent.press( paragraphBlock );
|
|
124
|
-
const paragraphTextInput =
|
|
125
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
126
|
-
typeInRichText( paragraphTextInput, text, {
|
|
127
|
-
finalSelectionStart: 1,
|
|
128
|
-
finalSelectionEnd: 1,
|
|
129
|
-
} );
|
|
130
|
-
|
|
131
|
-
fireEvent( paragraphTextInput, 'onChange', {
|
|
132
|
-
nativeEvent: { text },
|
|
133
|
-
preventDefault() {},
|
|
134
|
-
} );
|
|
135
|
-
const quoteBlock = getBlock( screen, 'Quote' );
|
|
136
|
-
await triggerBlockListLayout( quoteBlock );
|
|
137
|
-
|
|
138
|
-
expect( quoteBlock ).toBeVisible();
|
|
139
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
140
|
-
} );
|
|
141
|
-
|
|
142
|
-
it( 'should be able to use a prefix to create a List block', async () => {
|
|
143
|
-
const screen = await initializeEditor();
|
|
144
|
-
await addBlock( screen, 'Paragraph' );
|
|
145
|
-
const text = '- ';
|
|
146
|
-
|
|
147
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
148
|
-
fireEvent.press( paragraphBlock );
|
|
149
|
-
const paragraphTextInput =
|
|
150
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
151
|
-
typeInRichText( paragraphTextInput, text, {
|
|
152
|
-
finalSelectionStart: 1,
|
|
153
|
-
finalSelectionEnd: 1,
|
|
154
|
-
} );
|
|
155
|
-
|
|
156
|
-
fireEvent( paragraphTextInput, 'onChange', {
|
|
157
|
-
nativeEvent: { text },
|
|
158
|
-
preventDefault() {},
|
|
159
|
-
} );
|
|
160
|
-
const listBlock = getBlock( screen, 'List' );
|
|
161
|
-
await triggerBlockListLayout( listBlock );
|
|
162
|
-
|
|
163
|
-
expect( listBlock ).toBeVisible();
|
|
164
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
165
|
-
} );
|
|
166
|
-
|
|
167
|
-
it( 'should be able to use a prefix to create a numbered List block', async () => {
|
|
168
|
-
const screen = await initializeEditor();
|
|
169
|
-
await addBlock( screen, 'Paragraph' );
|
|
170
|
-
const text = '1. ';
|
|
171
|
-
|
|
172
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
173
|
-
fireEvent.press( paragraphBlock );
|
|
174
|
-
const paragraphTextInput =
|
|
175
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
176
|
-
typeInRichText( paragraphTextInput, text, {
|
|
177
|
-
finalSelectionStart: 2,
|
|
178
|
-
finalSelectionEnd: 2,
|
|
179
|
-
} );
|
|
180
|
-
|
|
181
|
-
fireEvent( paragraphTextInput, 'onChange', {
|
|
182
|
-
nativeEvent: { text },
|
|
183
|
-
preventDefault() {},
|
|
184
|
-
} );
|
|
185
|
-
const listBlock = getBlock( screen, 'List' );
|
|
186
|
-
await triggerBlockListLayout( listBlock );
|
|
187
|
-
|
|
188
|
-
expect( listBlock ).toBeVisible();
|
|
189
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
190
|
-
} );
|
|
191
|
-
|
|
192
|
-
it( 'should bold text', async () => {
|
|
193
|
-
// Arrange
|
|
194
|
-
const screen = await initializeEditor();
|
|
195
|
-
await addBlock( screen, 'Paragraph' );
|
|
196
|
-
|
|
197
|
-
// Act
|
|
198
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
199
|
-
fireEvent.press( paragraphBlock );
|
|
200
|
-
const paragraphTextInput =
|
|
201
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
202
|
-
typeInRichText(
|
|
203
|
-
paragraphTextInput,
|
|
204
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
205
|
-
{ finalSelectionStart: 2, finalSelectionEnd: 7 }
|
|
206
|
-
);
|
|
207
|
-
fireEvent.press( screen.getByLabelText( 'Bold' ) );
|
|
208
|
-
|
|
209
|
-
// Assert
|
|
210
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
211
|
-
"<!-- wp:paragraph -->
|
|
212
|
-
<p>A <strong>quick</strong> brown fox jumps over the lazy dog.</p>
|
|
213
|
-
<!-- /wp:paragraph -->"
|
|
214
|
-
` );
|
|
215
|
-
} );
|
|
216
|
-
|
|
217
|
-
it( 'should italicize text', async () => {
|
|
218
|
-
// Arrange
|
|
219
|
-
const screen = await initializeEditor();
|
|
220
|
-
await addBlock( screen, 'Paragraph' );
|
|
221
|
-
|
|
222
|
-
// Act
|
|
223
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
224
|
-
fireEvent.press( paragraphBlock );
|
|
225
|
-
const paragraphTextInput =
|
|
226
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
227
|
-
typeInRichText(
|
|
228
|
-
paragraphTextInput,
|
|
229
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
230
|
-
{ finalSelectionStart: 2, finalSelectionEnd: 7 }
|
|
231
|
-
);
|
|
232
|
-
fireEvent.press( screen.getByLabelText( 'Italic' ) );
|
|
233
|
-
|
|
234
|
-
// Assert
|
|
235
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
236
|
-
"<!-- wp:paragraph -->
|
|
237
|
-
<p>A <em>quick</em> brown fox jumps over the lazy dog.</p>
|
|
238
|
-
<!-- /wp:paragraph -->"
|
|
239
|
-
` );
|
|
240
|
-
} );
|
|
241
|
-
|
|
242
|
-
it( 'should strikethrough text', async () => {
|
|
243
|
-
// Arrange
|
|
244
|
-
const screen = await initializeEditor();
|
|
245
|
-
await addBlock( screen, 'Paragraph' );
|
|
246
|
-
|
|
247
|
-
// Act
|
|
248
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
249
|
-
fireEvent.press( paragraphBlock );
|
|
250
|
-
const paragraphTextInput =
|
|
251
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
252
|
-
typeInRichText(
|
|
253
|
-
paragraphTextInput,
|
|
254
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
255
|
-
{ finalSelectionStart: 2, finalSelectionEnd: 7 }
|
|
256
|
-
);
|
|
257
|
-
fireEvent.press( screen.getByLabelText( 'Strikethrough' ) );
|
|
258
|
-
|
|
259
|
-
// Assert
|
|
260
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
261
|
-
"<!-- wp:paragraph -->
|
|
262
|
-
<p>A <s>quick</s> brown fox jumps over the lazy dog.</p>
|
|
263
|
-
<!-- /wp:paragraph -->"
|
|
264
|
-
` );
|
|
265
|
-
} );
|
|
266
|
-
|
|
267
|
-
it( 'should left align text', async () => {
|
|
268
|
-
// Arrange
|
|
269
|
-
const screen = await initializeEditor();
|
|
270
|
-
await addBlock( screen, 'Paragraph' );
|
|
271
|
-
|
|
272
|
-
// Act
|
|
273
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
274
|
-
fireEvent.press( paragraphBlock );
|
|
275
|
-
const paragraphTextInput =
|
|
276
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
277
|
-
typeInRichText(
|
|
278
|
-
paragraphTextInput,
|
|
279
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
280
|
-
);
|
|
281
|
-
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
282
|
-
fireEvent.press( screen.getByLabelText( 'Align text left' ) );
|
|
283
|
-
|
|
284
|
-
// Assert
|
|
285
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
286
|
-
"<!-- wp:paragraph {"style":{"typography":{"textAlign":"left"}}} -->
|
|
287
|
-
<p class="has-text-align-left">A quick brown fox jumps over the lazy dog.</p>
|
|
288
|
-
<!-- /wp:paragraph -->"
|
|
289
|
-
` );
|
|
290
|
-
} );
|
|
291
|
-
|
|
292
|
-
it( 'should center align text', async () => {
|
|
293
|
-
// Arrange
|
|
294
|
-
const screen = await initializeEditor();
|
|
295
|
-
await addBlock( screen, 'Paragraph' );
|
|
296
|
-
|
|
297
|
-
// Act
|
|
298
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
299
|
-
fireEvent.press( paragraphBlock );
|
|
300
|
-
const paragraphTextInput =
|
|
301
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
302
|
-
typeInRichText(
|
|
303
|
-
paragraphTextInput,
|
|
304
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
305
|
-
);
|
|
306
|
-
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
307
|
-
fireEvent.press( screen.getByLabelText( 'Align text center' ) );
|
|
308
|
-
|
|
309
|
-
// Assert
|
|
310
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
311
|
-
"<!-- wp:paragraph {"style":{"typography":{"textAlign":"center"}}} -->
|
|
312
|
-
<p class="has-text-align-center">A quick brown fox jumps over the lazy dog.</p>
|
|
313
|
-
<!-- /wp:paragraph -->"
|
|
314
|
-
` );
|
|
315
|
-
} );
|
|
316
|
-
|
|
317
|
-
it( 'should right align text', async () => {
|
|
318
|
-
// Arrange
|
|
319
|
-
const screen = await initializeEditor();
|
|
320
|
-
await addBlock( screen, 'Paragraph' );
|
|
321
|
-
|
|
322
|
-
// Act
|
|
323
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
324
|
-
fireEvent.press( paragraphBlock );
|
|
325
|
-
const paragraphTextInput =
|
|
326
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
327
|
-
typeInRichText(
|
|
328
|
-
paragraphTextInput,
|
|
329
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
330
|
-
);
|
|
331
|
-
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
332
|
-
fireEvent.press( screen.getByLabelText( 'Align text right' ) );
|
|
333
|
-
|
|
334
|
-
// Assert
|
|
335
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
336
|
-
"<!-- wp:paragraph {"style":{"typography":{"textAlign":"right"}}} -->
|
|
337
|
-
<p class="has-text-align-right">A quick brown fox jumps over the lazy dog.</p>
|
|
338
|
-
<!-- /wp:paragraph -->"
|
|
339
|
-
` );
|
|
340
|
-
} );
|
|
341
|
-
|
|
342
|
-
it( 'should inherit parent alignment', async () => {
|
|
343
|
-
// Arrange
|
|
344
|
-
const screen = await initializeEditor();
|
|
345
|
-
await addBlock( screen, 'Quote' );
|
|
346
|
-
await triggerBlockListLayout( getBlock( screen, 'Quote' ) );
|
|
347
|
-
|
|
348
|
-
// Act
|
|
349
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
350
|
-
fireEvent.press( paragraphBlock );
|
|
351
|
-
const paragraphTextInput =
|
|
352
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
353
|
-
typeInRichText(
|
|
354
|
-
paragraphTextInput,
|
|
355
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
356
|
-
);
|
|
357
|
-
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
358
|
-
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
359
|
-
fireEvent.press( screen.getByLabelText( 'Align text right' ) );
|
|
360
|
-
|
|
361
|
-
// Assert
|
|
362
|
-
// This not an ideal assertion, as it relies implementation details of the
|
|
363
|
-
// component: prop names. However, the only aspect we can assert is the prop
|
|
364
|
-
// passed to Aztec, the native module controlling visual alignment. A less
|
|
365
|
-
// brittle alternative might be snapshotting, but RNTL does not yet support
|
|
366
|
-
// focused snapshots, which means the snapshot would be huge.
|
|
367
|
-
// https://github.com/facebook/react/pull/25329
|
|
368
|
-
expect(
|
|
369
|
-
screen.UNSAFE_queryAllByProps( {
|
|
370
|
-
value: '<p>A quick brown fox jumps over the lazy dog.</p>',
|
|
371
|
-
placeholder: 'Start writing…',
|
|
372
|
-
textAlign: 'right',
|
|
373
|
-
} ).length
|
|
374
|
-
).toBe( 2 ); // One for Aztec mock, one for the TextInput.
|
|
375
|
-
} );
|
|
376
|
-
|
|
377
|
-
it( 'should preserve alignment when split', async () => {
|
|
378
|
-
// Arrange
|
|
379
|
-
const screen = await initializeEditor();
|
|
380
|
-
await addBlock( screen, 'Paragraph' );
|
|
381
|
-
|
|
382
|
-
// Act
|
|
383
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
384
|
-
fireEvent.press( paragraphBlock );
|
|
385
|
-
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
386
|
-
fireEvent.press( screen.getByLabelText( 'Align text center' ) );
|
|
387
|
-
const paragraphTextInput =
|
|
388
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
389
|
-
const string = 'A quick brown fox jumps over the lazy dog.';
|
|
390
|
-
typeInRichText( paragraphTextInput, string, {
|
|
391
|
-
finalSelectionStart: string.length / 2,
|
|
392
|
-
finalSelectionEnd: string.length / 2,
|
|
393
|
-
} );
|
|
394
|
-
fireEvent( paragraphTextInput, 'onKeyDown', {
|
|
395
|
-
nativeEvent: {},
|
|
396
|
-
preventDefault() {},
|
|
397
|
-
keyCode: ENTER,
|
|
398
|
-
} );
|
|
399
|
-
|
|
400
|
-
// Assert
|
|
401
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
402
|
-
"<!-- wp:paragraph {"style":{"typography":{"textAlign":"center"}}} -->
|
|
403
|
-
<p class="has-text-align-center">A quick brown fox jum</p>
|
|
404
|
-
<!-- /wp:paragraph -->
|
|
405
|
-
|
|
406
|
-
<!-- wp:paragraph {"style":{"typography":{"textAlign":"center"}}} -->
|
|
407
|
-
<p class="has-text-align-center">ps over the lazy dog.</p>
|
|
408
|
-
<!-- /wp:paragraph -->"
|
|
409
|
-
` );
|
|
410
|
-
} );
|
|
411
|
-
|
|
412
|
-
it( 'should link text without selection', async () => {
|
|
413
|
-
// Arrange
|
|
414
|
-
const screen = await initializeEditor();
|
|
415
|
-
await addBlock( screen, 'Paragraph' );
|
|
416
|
-
|
|
417
|
-
// Act
|
|
418
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
419
|
-
fireEvent.press( paragraphBlock );
|
|
420
|
-
fireEvent.press( screen.getByLabelText( 'Link' ) );
|
|
421
|
-
|
|
422
|
-
fireEvent.changeText(
|
|
423
|
-
screen.getByPlaceholderText( 'Add link text' ),
|
|
424
|
-
'WordPress'
|
|
425
|
-
);
|
|
426
|
-
fireEvent.press(
|
|
427
|
-
screen.getByLabelText( 'Link to, Search or type URL' )
|
|
428
|
-
);
|
|
429
|
-
const typeURLInput = await waitFor( () =>
|
|
430
|
-
screen.getByPlaceholderText( 'Search or type URL' )
|
|
431
|
-
);
|
|
432
|
-
fireEvent.changeText( typeURLInput, 'wordpress.org' );
|
|
433
|
-
await waitForElementToBeRemoved( () =>
|
|
434
|
-
screen.getByTestId( 'link-picker-loading' )
|
|
435
|
-
);
|
|
436
|
-
// Back navigation from link picker uses `setTimeout`
|
|
437
|
-
await withFakeTimers( () => {
|
|
438
|
-
fireEvent.press( screen.getByLabelText( 'Apply' ) );
|
|
439
|
-
act( () => jest.runOnlyPendingTimers() );
|
|
440
|
-
} );
|
|
441
|
-
|
|
442
|
-
// Assert
|
|
443
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
444
|
-
"<!-- wp:paragraph -->
|
|
445
|
-
<p><a href="http://wordpress.org">WordPress</a></p>
|
|
446
|
-
<!-- /wp:paragraph -->"
|
|
447
|
-
` );
|
|
448
|
-
} );
|
|
449
|
-
|
|
450
|
-
it( 'should link text with selection', async () => {
|
|
451
|
-
// Arrange
|
|
452
|
-
const screen = await initializeEditor();
|
|
453
|
-
await addBlock( screen, 'Paragraph' );
|
|
454
|
-
|
|
455
|
-
// Act
|
|
456
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
457
|
-
fireEvent.press( paragraphBlock );
|
|
458
|
-
const paragraphTextInput =
|
|
459
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
460
|
-
typeInRichText(
|
|
461
|
-
paragraphTextInput,
|
|
462
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
463
|
-
{
|
|
464
|
-
finalSelectionStart: 2,
|
|
465
|
-
finalSelectionEnd: 7,
|
|
466
|
-
}
|
|
467
|
-
);
|
|
468
|
-
fireEvent.press( screen.getByLabelText( 'Link' ) );
|
|
469
|
-
fireEvent.press(
|
|
470
|
-
screen.getByLabelText( 'Link to, Search or type URL' )
|
|
471
|
-
);
|
|
472
|
-
const typeURLInput = await waitFor( () =>
|
|
473
|
-
screen.getByPlaceholderText( 'Search or type URL' )
|
|
474
|
-
);
|
|
475
|
-
fireEvent.changeText( typeURLInput, 'wordpress.org' );
|
|
476
|
-
await waitForElementToBeRemoved( () =>
|
|
477
|
-
screen.getByTestId( 'link-picker-loading' )
|
|
478
|
-
);
|
|
479
|
-
// Back navigation from link picker uses `setTimeout`
|
|
480
|
-
await withFakeTimers( () => {
|
|
481
|
-
fireEvent.press( screen.getByLabelText( 'Apply' ) );
|
|
482
|
-
act( () => jest.runOnlyPendingTimers() );
|
|
483
|
-
} );
|
|
484
|
-
|
|
485
|
-
// Assert
|
|
486
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
487
|
-
"<!-- wp:paragraph -->
|
|
488
|
-
<p>A <a href="http://wordpress.org">quick</a> brown fox jumps over the lazy dog.</p>
|
|
489
|
-
<!-- /wp:paragraph -->"
|
|
490
|
-
` );
|
|
491
|
-
} );
|
|
492
|
-
|
|
493
|
-
it( 'should link text with clipboard contents', async () => {
|
|
494
|
-
// Arrange
|
|
495
|
-
Clipboard.getString.mockResolvedValue( 'https://wordpress.org' );
|
|
496
|
-
const screen = await initializeEditor();
|
|
497
|
-
await addBlock( screen, 'Paragraph' );
|
|
498
|
-
|
|
499
|
-
// Act
|
|
500
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
501
|
-
fireEvent.press( paragraphBlock );
|
|
502
|
-
const paragraphTextInput =
|
|
503
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
504
|
-
typeInRichText(
|
|
505
|
-
paragraphTextInput,
|
|
506
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
507
|
-
{
|
|
508
|
-
finalSelectionStart: 2,
|
|
509
|
-
finalSelectionEnd: 7,
|
|
510
|
-
}
|
|
511
|
-
);
|
|
512
|
-
// Await React Navigation: https://github.com/WordPress/gutenberg/issues/35685#issuecomment-961919931
|
|
513
|
-
await act( () => fireEvent.press( screen.getByLabelText( 'Link' ) ) );
|
|
514
|
-
// Await React Navigation: https://github.com/WordPress/gutenberg/issues/35685#issuecomment-961919931
|
|
515
|
-
await act( () =>
|
|
516
|
-
fireEvent.press(
|
|
517
|
-
screen.getByLabelText( 'Link to, Search or type URL' )
|
|
518
|
-
)
|
|
519
|
-
);
|
|
520
|
-
|
|
521
|
-
// Assert
|
|
522
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
523
|
-
"<!-- wp:paragraph -->
|
|
524
|
-
<p>A <a href="https://wordpress.org">quick</a> brown fox jumps over the lazy dog.</p>
|
|
525
|
-
<!-- /wp:paragraph -->"
|
|
526
|
-
` );
|
|
527
|
-
|
|
528
|
-
Clipboard.getString.mockReset();
|
|
529
|
-
} );
|
|
530
|
-
|
|
531
|
-
it( 'should not remove leading or trailing whitespace when formatting', async () => {
|
|
532
|
-
// Arrange
|
|
533
|
-
const screen = await initializeEditor();
|
|
534
|
-
await addBlock( screen, 'Paragraph' );
|
|
535
|
-
|
|
536
|
-
// Act
|
|
537
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
538
|
-
fireEvent.press( paragraphBlock );
|
|
539
|
-
const paragraphTextInput =
|
|
540
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
541
|
-
typeInRichText( paragraphTextInput, ' some text ', {
|
|
542
|
-
finalSelectionStart: 5,
|
|
543
|
-
finalSelectionEnd: 14,
|
|
544
|
-
} );
|
|
545
|
-
fireEvent.press( screen.getByLabelText( 'Italic' ) );
|
|
546
|
-
|
|
547
|
-
// Assert
|
|
548
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
549
|
-
"<!-- wp:paragraph -->
|
|
550
|
-
<p> <em>some text</em> </p>
|
|
551
|
-
<!-- /wp:paragraph -->"
|
|
552
|
-
` );
|
|
553
|
-
} );
|
|
554
|
-
|
|
555
|
-
it( 'should set a text color', async () => {
|
|
556
|
-
// Arrange
|
|
557
|
-
const screen = await initializeEditor();
|
|
558
|
-
await addBlock( screen, 'Paragraph' );
|
|
559
|
-
|
|
560
|
-
// Act
|
|
561
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
562
|
-
fireEvent.press( paragraphBlock );
|
|
563
|
-
const paragraphTextInput =
|
|
564
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
565
|
-
typeInRichText(
|
|
566
|
-
paragraphTextInput,
|
|
567
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
568
|
-
);
|
|
569
|
-
// Open Block Settings.
|
|
570
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
571
|
-
|
|
572
|
-
// Wait for Block Settings to be visible.
|
|
573
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
574
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
575
|
-
|
|
576
|
-
// Open Text color settings
|
|
577
|
-
fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
|
|
578
|
-
|
|
579
|
-
// Tap one color
|
|
580
|
-
fireEvent.press( screen.getByLabelText( 'Pale pink' ) );
|
|
581
|
-
// TODO(jest-console): Fix the warning and remove the expect below.
|
|
582
|
-
expect( console ).toHaveWarnedWith(
|
|
583
|
-
`Non-serializable values were found in the navigation state. Check:\n\nColor > params.onColorChange (Function)\n\nThis can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use components with callbacks in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state for more details.`
|
|
584
|
-
);
|
|
585
|
-
|
|
586
|
-
// Dismiss the Block Settings modal.
|
|
587
|
-
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
588
|
-
|
|
589
|
-
// Assert
|
|
590
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
591
|
-
"<!-- wp:paragraph {"textColor":"pale-pink"} -->
|
|
592
|
-
<p class="has-pale-pink-color has-text-color">A quick brown fox jumps over the lazy dog.</p>
|
|
593
|
-
<!-- /wp:paragraph -->"
|
|
594
|
-
` );
|
|
595
|
-
} );
|
|
596
|
-
|
|
597
|
-
it( 'should set a background color', async () => {
|
|
598
|
-
// Arrange
|
|
599
|
-
const screen = await initializeEditor();
|
|
600
|
-
await addBlock( screen, 'Paragraph' );
|
|
601
|
-
|
|
602
|
-
// Act
|
|
603
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
604
|
-
fireEvent.press( paragraphBlock );
|
|
605
|
-
const paragraphTextInput =
|
|
606
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
607
|
-
typeInRichText(
|
|
608
|
-
paragraphTextInput,
|
|
609
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
610
|
-
);
|
|
611
|
-
// Open Block Settings.
|
|
612
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
613
|
-
|
|
614
|
-
// Wait for Block Settings to be visible.
|
|
615
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
616
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
617
|
-
|
|
618
|
-
// Open Background color settings
|
|
619
|
-
fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
|
|
620
|
-
|
|
621
|
-
// Tap one color
|
|
622
|
-
fireEvent.press( screen.getByLabelText( 'Luminous vivid orange' ) );
|
|
623
|
-
|
|
624
|
-
// Dismiss the Block Settings modal.
|
|
625
|
-
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
626
|
-
|
|
627
|
-
// Assert
|
|
628
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
629
|
-
"<!-- wp:paragraph {"backgroundColor":"luminous-vivid-orange"} -->
|
|
630
|
-
<p class="has-luminous-vivid-orange-background-color has-background">A quick brown fox jumps over the lazy dog.</p>
|
|
631
|
-
<!-- /wp:paragraph -->"
|
|
632
|
-
` );
|
|
633
|
-
} );
|
|
634
|
-
|
|
635
|
-
it( 'should set a text and background color', async () => {
|
|
636
|
-
// Arrange
|
|
637
|
-
const screen = await initializeEditor();
|
|
638
|
-
await addBlock( screen, 'Paragraph' );
|
|
639
|
-
|
|
640
|
-
// Act
|
|
641
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
642
|
-
fireEvent.press( paragraphBlock );
|
|
643
|
-
const paragraphTextInput =
|
|
644
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
645
|
-
typeInRichText(
|
|
646
|
-
paragraphTextInput,
|
|
647
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
648
|
-
);
|
|
649
|
-
// Open Block Settings.
|
|
650
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
651
|
-
|
|
652
|
-
// Wait for Block Settings to be visible.
|
|
653
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
654
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
655
|
-
|
|
656
|
-
// Open Text color settings
|
|
657
|
-
fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
|
|
658
|
-
|
|
659
|
-
// Tap one color
|
|
660
|
-
fireEvent.press( screen.getByLabelText( 'White' ) );
|
|
661
|
-
|
|
662
|
-
// Go back to the settings menu
|
|
663
|
-
fireEvent.press( screen.getByLabelText( 'Go back' ) );
|
|
664
|
-
|
|
665
|
-
// Open Background color settings
|
|
666
|
-
fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
|
|
667
|
-
|
|
668
|
-
// Tap one color
|
|
669
|
-
fireEvent.press( screen.getByLabelText( 'Luminous vivid orange' ) );
|
|
670
|
-
|
|
671
|
-
// Dismiss the Block Settings modal.
|
|
672
|
-
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
673
|
-
|
|
674
|
-
// Assert
|
|
675
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
676
|
-
"<!-- wp:paragraph {"backgroundColor":"luminous-vivid-orange","textColor":"white"} -->
|
|
677
|
-
<p class="has-white-color has-luminous-vivid-orange-background-color has-text-color has-background">A quick brown fox jumps over the lazy dog.</p>
|
|
678
|
-
<!-- /wp:paragraph -->"
|
|
679
|
-
` );
|
|
680
|
-
} );
|
|
681
|
-
|
|
682
|
-
it( 'should remove text and background colors', async () => {
|
|
683
|
-
// Arrange
|
|
684
|
-
const screen = await initializeEditor( {
|
|
685
|
-
initialHtml: `<!-- wp:paragraph {"backgroundColor":"luminous-vivid-orange","textColor":"white"} -->
|
|
686
|
-
<p class="has-white-color has-luminous-vivid-orange-background-color has-text-color has-background">A quick brown fox jumps over the lazy dog.</p>
|
|
687
|
-
<!-- /wp:paragraph -->`,
|
|
688
|
-
} );
|
|
689
|
-
|
|
690
|
-
// Act
|
|
691
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
692
|
-
fireEvent.press( paragraphBlock );
|
|
693
|
-
|
|
694
|
-
// Open Block Settings.
|
|
695
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
696
|
-
|
|
697
|
-
// Wait for Block Settings to be visible.
|
|
698
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
699
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
700
|
-
|
|
701
|
-
// Open Text color settings
|
|
702
|
-
fireEvent.press( screen.getByLabelText( 'Text. Empty' ) );
|
|
703
|
-
|
|
704
|
-
// Reset color
|
|
705
|
-
fireEvent.press( await screen.findByText( 'Reset' ) );
|
|
706
|
-
|
|
707
|
-
// Go back to the settings menu
|
|
708
|
-
fireEvent.press( screen.getByLabelText( 'Go back' ) );
|
|
709
|
-
|
|
710
|
-
// Open Background color settings
|
|
711
|
-
fireEvent.press( screen.getByLabelText( 'Background. Empty' ) );
|
|
712
|
-
|
|
713
|
-
// Reset color
|
|
714
|
-
fireEvent.press( await screen.findByText( 'Reset' ) );
|
|
715
|
-
|
|
716
|
-
// Dismiss the Block Settings modal.
|
|
717
|
-
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
718
|
-
|
|
719
|
-
// Assert
|
|
720
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
721
|
-
"<!-- wp:paragraph -->
|
|
722
|
-
<p>A quick brown fox jumps over the lazy dog.</p>
|
|
723
|
-
<!-- /wp:paragraph -->"
|
|
724
|
-
` );
|
|
725
|
-
} );
|
|
726
|
-
|
|
727
|
-
it( 'should not have a gradient background color option', async () => {
|
|
728
|
-
// Arrange
|
|
729
|
-
const screen = await initializeEditor();
|
|
730
|
-
await addBlock( screen, 'Paragraph' );
|
|
731
|
-
|
|
732
|
-
// Act
|
|
733
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
734
|
-
fireEvent.press( paragraphBlock );
|
|
735
|
-
const paragraphTextInput =
|
|
736
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
737
|
-
typeInRichText(
|
|
738
|
-
paragraphTextInput,
|
|
739
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
740
|
-
);
|
|
741
|
-
// Open Block Settings.
|
|
742
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
743
|
-
|
|
744
|
-
// Wait for Block Settings to be visible.
|
|
745
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
746
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
747
|
-
|
|
748
|
-
// Open Background color settings
|
|
749
|
-
fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
|
|
750
|
-
|
|
751
|
-
// Assert
|
|
752
|
-
const colorButton = screen.getByLabelText( 'Luminous vivid orange' );
|
|
753
|
-
expect( colorButton ).toBeDefined();
|
|
754
|
-
|
|
755
|
-
const gradientButton = screen.queryByLabelText( 'Gradient' );
|
|
756
|
-
expect( gradientButton ).toBeNull();
|
|
757
|
-
} );
|
|
758
|
-
|
|
759
|
-
it( 'should set a theme text color', async () => {
|
|
760
|
-
// Arrange
|
|
761
|
-
const screen = await initializeEditor( { withGlobalStyles: true } );
|
|
762
|
-
await addBlock( screen, 'Paragraph' );
|
|
763
|
-
|
|
764
|
-
// Act
|
|
765
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
766
|
-
fireEvent.press( paragraphBlock );
|
|
767
|
-
const paragraphTextInput =
|
|
768
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
769
|
-
typeInRichText(
|
|
770
|
-
paragraphTextInput,
|
|
771
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
772
|
-
);
|
|
773
|
-
// Open Block Settings.
|
|
774
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
775
|
-
|
|
776
|
-
// Wait for Block Settings to be visible.
|
|
777
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
778
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
779
|
-
|
|
780
|
-
// Open Text color settings
|
|
781
|
-
fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
|
|
782
|
-
|
|
783
|
-
// Tap one color
|
|
784
|
-
fireEvent.press( screen.getByLabelText( 'Tertiary' ) );
|
|
785
|
-
|
|
786
|
-
// Dismiss the Block Settings modal.
|
|
787
|
-
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
788
|
-
|
|
789
|
-
// Assert
|
|
790
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
791
|
-
"<!-- wp:paragraph {"textColor":"tertiary"} -->
|
|
792
|
-
<p class="has-tertiary-color has-text-color">A quick brown fox jumps over the lazy dog.</p>
|
|
793
|
-
<!-- /wp:paragraph -->"
|
|
794
|
-
` );
|
|
795
|
-
} );
|
|
796
|
-
|
|
797
|
-
it( 'should show the contrast check warning', async () => {
|
|
798
|
-
// Arrange
|
|
799
|
-
const screen = await initializeEditor( {
|
|
800
|
-
initialHtml: `<!-- wp:paragraph {"backgroundColor":"white","textColor":"white"} -->
|
|
801
|
-
<p class="has-white-color has-white-background-color has-text-color has-background">A quick brown fox jumps over the lazy dog.</p>
|
|
802
|
-
<!-- /wp:paragraph -->`,
|
|
803
|
-
} );
|
|
804
|
-
|
|
805
|
-
// Act
|
|
806
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
807
|
-
fireEvent.press( paragraphBlock );
|
|
808
|
-
|
|
809
|
-
// Open Block Settings.
|
|
810
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
811
|
-
|
|
812
|
-
// Wait for Block Settings to be visible.
|
|
813
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
814
|
-
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
815
|
-
|
|
816
|
-
// Assert
|
|
817
|
-
const contrastCheckElement = screen.getByText(
|
|
818
|
-
/This color combination/
|
|
819
|
-
);
|
|
820
|
-
expect( contrastCheckElement ).toBeDefined();
|
|
821
|
-
} );
|
|
822
|
-
|
|
823
|
-
it( 'should highlight text with selection', async () => {
|
|
824
|
-
// Arrange
|
|
825
|
-
const screen = await initializeEditor( { withGlobalStyles: true } );
|
|
826
|
-
await addBlock( screen, 'Paragraph' );
|
|
827
|
-
|
|
828
|
-
// Act
|
|
829
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
830
|
-
fireEvent.press( paragraphBlock );
|
|
831
|
-
const paragraphTextInput =
|
|
832
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
833
|
-
typeInRichText(
|
|
834
|
-
paragraphTextInput,
|
|
835
|
-
'A quick brown fox jumps over the lazy dog.',
|
|
836
|
-
{ finalSelectionStart: 2, finalSelectionEnd: 7 }
|
|
837
|
-
);
|
|
838
|
-
fireEvent.press( screen.getByLabelText( 'Text color' ) );
|
|
839
|
-
fireEvent.press( await screen.findByLabelText( 'Tertiary' ) );
|
|
840
|
-
// TODO(jest-console): Fix the warning and remove the expect below.
|
|
841
|
-
expect( console ).toHaveWarnedWith(
|
|
842
|
-
`Non-serializable values were found in the navigation state. Check:\n\ntext-color > Palette > params.onColorChange (Function)\n\nThis can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use components with callbacks in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state for more details.`
|
|
843
|
-
);
|
|
844
|
-
|
|
845
|
-
// Assert
|
|
846
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
847
|
-
"<!-- wp:paragraph -->
|
|
848
|
-
<p>A <mark style="background-color:rgba(0, 0, 0, 0);color:#2411a4" class="has-inline-color has-tertiary-color">quick</mark> brown fox jumps over the lazy dog.</p>
|
|
849
|
-
<!-- /wp:paragraph -->"
|
|
850
|
-
` );
|
|
851
|
-
} );
|
|
852
|
-
|
|
853
|
-
it( 'should show the expected font sizes values', async () => {
|
|
854
|
-
// Arrange
|
|
855
|
-
const screen = await initializeEditor( { withGlobalStyles: true } );
|
|
856
|
-
await addBlock( screen, 'Paragraph' );
|
|
857
|
-
|
|
858
|
-
// Act
|
|
859
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
860
|
-
fireEvent.press( paragraphBlock );
|
|
861
|
-
const paragraphTextInput =
|
|
862
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
863
|
-
typeInRichText(
|
|
864
|
-
paragraphTextInput,
|
|
865
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
866
|
-
);
|
|
867
|
-
// Open Block Settings.
|
|
868
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
869
|
-
|
|
870
|
-
// Wait for Block Settings to be visible.
|
|
871
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
872
|
-
await waitForModalVisible( blockSettingsModal );
|
|
873
|
-
|
|
874
|
-
// Open Font size settings
|
|
875
|
-
fireEvent.press( screen.getByLabelText( 'Font Size, Custom' ) );
|
|
876
|
-
await waitFor( () => screen.getByLabelText( 'Selected: Default' ) );
|
|
877
|
-
|
|
878
|
-
// Assert
|
|
879
|
-
const modalContent = within( blockSettingsModal );
|
|
880
|
-
expect( modalContent.getByLabelText( 'Small' ) ).toBeVisible();
|
|
881
|
-
expect( modalContent.getByText( '14px' ) ).toBeVisible();
|
|
882
|
-
expect( modalContent.getByLabelText( 'Medium' ) ).toBeVisible();
|
|
883
|
-
expect( modalContent.getByText( '17px' ) ).toBeVisible();
|
|
884
|
-
expect( modalContent.getByLabelText( 'Large' ) ).toBeVisible();
|
|
885
|
-
expect( modalContent.getByText( '30px' ) ).toBeVisible();
|
|
886
|
-
expect( modalContent.getByLabelText( 'Extra Large' ) ).toBeVisible();
|
|
887
|
-
expect( modalContent.getByText( '40px' ) ).toBeVisible();
|
|
888
|
-
expect(
|
|
889
|
-
modalContent.getByLabelText( 'Extra Extra Large' )
|
|
890
|
-
).toBeVisible();
|
|
891
|
-
expect( modalContent.getByText( '52px' ) ).toBeVisible();
|
|
892
|
-
} );
|
|
893
|
-
|
|
894
|
-
it( 'should set a font size value', async () => {
|
|
895
|
-
// Arrange
|
|
896
|
-
const screen = await initializeEditor( { withGlobalStyles: true } );
|
|
897
|
-
await addBlock( screen, 'Paragraph' );
|
|
898
|
-
|
|
899
|
-
// Act
|
|
900
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
901
|
-
fireEvent.press( paragraphBlock );
|
|
902
|
-
const paragraphTextInput =
|
|
903
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
904
|
-
typeInRichText(
|
|
905
|
-
paragraphTextInput,
|
|
906
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
907
|
-
);
|
|
908
|
-
// Open Block Settings.
|
|
909
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
910
|
-
|
|
911
|
-
// Wait for Block Settings to be visible.
|
|
912
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
913
|
-
await waitForModalVisible( blockSettingsModal );
|
|
914
|
-
|
|
915
|
-
// Open Font size settings
|
|
916
|
-
fireEvent.press( screen.getByLabelText( 'Font Size, Custom' ) );
|
|
917
|
-
|
|
918
|
-
// Tap one font size
|
|
919
|
-
fireEvent.press( screen.getByLabelText( 'Large' ) );
|
|
920
|
-
|
|
921
|
-
// Dismiss the Block Settings modal.
|
|
922
|
-
await dismissModal( blockSettingsModal );
|
|
923
|
-
|
|
924
|
-
// Assert
|
|
925
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
926
|
-
} );
|
|
927
|
-
|
|
928
|
-
it( 'should set a line height value', async () => {
|
|
929
|
-
// Arrange
|
|
930
|
-
const screen = await initializeEditor( { withGlobalStyles: true } );
|
|
931
|
-
await addBlock( screen, 'Paragraph' );
|
|
932
|
-
|
|
933
|
-
// Act
|
|
934
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
935
|
-
fireEvent.press( paragraphBlock );
|
|
936
|
-
const paragraphTextInput =
|
|
937
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
938
|
-
typeInRichText(
|
|
939
|
-
paragraphTextInput,
|
|
940
|
-
'A quick brown fox jumps over the lazy dog.'
|
|
941
|
-
);
|
|
942
|
-
// Open Block Settings.
|
|
943
|
-
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
944
|
-
|
|
945
|
-
// Wait for Block Settings to be visible.
|
|
946
|
-
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
947
|
-
await waitForModalVisible( blockSettingsModal );
|
|
948
|
-
|
|
949
|
-
const lineHeightControl = screen.getByLabelText( /Line Height/ );
|
|
950
|
-
fireEvent.press(
|
|
951
|
-
within( lineHeightControl ).getByText( '1.5', { hidden: true } )
|
|
952
|
-
);
|
|
953
|
-
const lineHeightTextInput = within(
|
|
954
|
-
lineHeightControl
|
|
955
|
-
).getByDisplayValue( '1.5', { hidden: true } );
|
|
956
|
-
fireEvent.changeText( lineHeightTextInput, '1.8' );
|
|
957
|
-
|
|
958
|
-
// Dismiss the Block Settings modal.
|
|
959
|
-
await dismissModal( blockSettingsModal );
|
|
960
|
-
|
|
961
|
-
// Assert
|
|
962
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
963
|
-
} );
|
|
964
|
-
|
|
965
|
-
it( 'should focus on the previous Paragraph block when backspacing in an empty Paragraph block', async () => {
|
|
966
|
-
// Arrange
|
|
967
|
-
const screen = await initializeEditor();
|
|
968
|
-
await addBlock( screen, 'Paragraph' );
|
|
969
|
-
|
|
970
|
-
// Act
|
|
971
|
-
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
972
|
-
fireEvent.press( paragraphBlock );
|
|
973
|
-
const paragraphTextInput =
|
|
974
|
-
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
975
|
-
typeInRichText( paragraphTextInput, 'A quick brown fox jumps' );
|
|
976
|
-
|
|
977
|
-
await addBlock( screen, 'Paragraph' );
|
|
978
|
-
const secondParagraphBlock = getBlock( screen, 'Paragraph', {
|
|
979
|
-
rowIndex: 2,
|
|
980
|
-
} );
|
|
981
|
-
fireEvent.press( secondParagraphBlock );
|
|
982
|
-
|
|
983
|
-
// Clear mock history
|
|
984
|
-
TextInputState.focusTextInput.mockClear();
|
|
985
|
-
|
|
986
|
-
const secondParagraphTextInput =
|
|
987
|
-
within( secondParagraphBlock ).getByPlaceholderText(
|
|
988
|
-
'Start writing…'
|
|
989
|
-
);
|
|
990
|
-
fireEvent( secondParagraphTextInput, 'onKeyDown', {
|
|
991
|
-
nativeEvent: {},
|
|
992
|
-
preventDefault() {},
|
|
993
|
-
keyCode: BACKSPACE,
|
|
994
|
-
} );
|
|
995
|
-
|
|
996
|
-
// Assert
|
|
997
|
-
expect( TextInputState.focusTextInput ).toHaveBeenCalled();
|
|
998
|
-
} );
|
|
999
|
-
} );
|