@wordpress/block-library 8.17.1 → 8.18.0

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/cover/edit/index.js +3 -1
  3. package/build/cover/edit/index.js.map +1 -1
  4. package/build/cover/shared.js +26 -21
  5. package/build/cover/shared.js.map +1 -1
  6. package/build/embed/embed-link-settings.native.js +0 -1
  7. package/build/embed/embed-link-settings.native.js.map +1 -1
  8. package/build/post-content/edit.js +1 -1
  9. package/build/post-content/edit.js.map +1 -1
  10. package/build/post-template/index.js +1 -1
  11. package/build/query/edit/inspector-controls/index.js +28 -3
  12. package/build/query/edit/inspector-controls/index.js.map +1 -1
  13. package/build/query/edit/query-content.js +2 -1
  14. package/build/query/edit/query-content.js.map +1 -1
  15. package/build/query/index.js +9 -2
  16. package/build/query/index.js.map +1 -1
  17. package/build/query/view.js +75 -0
  18. package/build/query/view.js.map +1 -0
  19. package/build/query-pagination-next/index.js +1 -1
  20. package/build/query-pagination-numbers/edit.js +50 -5
  21. package/build/query-pagination-numbers/edit.js.map +1 -1
  22. package/build/query-pagination-numbers/index.js +7 -1
  23. package/build/query-pagination-numbers/index.js.map +1 -1
  24. package/build/query-pagination-previous/index.js +1 -1
  25. package/build/search/edit.js +3 -1
  26. package/build/search/edit.js.map +1 -1
  27. package/build/search/utils.js +2 -4
  28. package/build/search/utils.js.map +1 -1
  29. package/build/social-link/edit.native.js +1 -3
  30. package/build/social-link/edit.native.js.map +1 -1
  31. package/build-module/cover/edit/index.js +3 -1
  32. package/build-module/cover/edit/index.js.map +1 -1
  33. package/build-module/cover/shared.js +26 -21
  34. package/build-module/cover/shared.js.map +1 -1
  35. package/build-module/embed/embed-link-settings.native.js +0 -1
  36. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  37. package/build-module/post-content/edit.js +1 -1
  38. package/build-module/post-content/edit.js.map +1 -1
  39. package/build-module/post-template/index.js +1 -1
  40. package/build-module/query/edit/inspector-controls/index.js +29 -4
  41. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  42. package/build-module/query/edit/query-content.js +2 -1
  43. package/build-module/query/edit/query-content.js.map +1 -1
  44. package/build-module/query/index.js +9 -2
  45. package/build-module/query/index.js.map +1 -1
  46. package/build-module/query/view.js +72 -0
  47. package/build-module/query/view.js.map +1 -0
  48. package/build-module/query-pagination-next/index.js +1 -1
  49. package/build-module/query-pagination-numbers/edit.js +51 -6
  50. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  51. package/build-module/query-pagination-numbers/index.js +7 -1
  52. package/build-module/query-pagination-numbers/index.js.map +1 -1
  53. package/build-module/query-pagination-previous/index.js +1 -1
  54. package/build-module/search/edit.js +4 -2
  55. package/build-module/search/edit.js.map +1 -1
  56. package/build-module/search/utils.js +0 -1
  57. package/build-module/search/utils.js.map +1 -1
  58. package/build-module/social-link/edit.native.js +1 -3
  59. package/build-module/social-link/edit.native.js.map +1 -1
  60. package/build-style/query/style-rtl.css +140 -0
  61. package/build-style/query/style.css +140 -0
  62. package/build-style/site-logo/style-rtl.css +1 -0
  63. package/build-style/site-logo/style.css +1 -0
  64. package/build-style/style-rtl.css +1 -0
  65. package/build-style/style.css +1 -0
  66. package/package.json +32 -32
  67. package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
  68. package/src/cover/edit/index.js +3 -1
  69. package/src/cover/shared.js +25 -20
  70. package/src/cover/test/edit.native.js +1 -5
  71. package/src/embed/embed-link-settings.native.js +0 -1
  72. package/src/embed/test/index.native.js +9 -9
  73. package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
  74. package/src/image/index.php +5 -0
  75. package/src/post-content/edit.js +2 -2
  76. package/src/post-content/index.php +0 -6
  77. package/src/post-featured-image/index.php +0 -6
  78. package/src/post-template/block.json +2 -1
  79. package/src/post-template/index.php +19 -4
  80. package/src/query/block.json +9 -2
  81. package/src/query/edit/inspector-controls/index.js +46 -3
  82. package/src/query/edit/query-content.js +1 -0
  83. package/src/query/index.php +94 -1
  84. package/src/query/style.scss +63 -0
  85. package/src/query/view.js +82 -0
  86. package/src/query-no-results/index.php +1 -5
  87. package/src/query-pagination-next/block.json +7 -1
  88. package/src/query-pagination-next/index.php +20 -3
  89. package/src/query-pagination-numbers/block.json +7 -1
  90. package/src/query-pagination-numbers/edit.js +64 -16
  91. package/src/query-pagination-numbers/index.php +27 -4
  92. package/src/query-pagination-previous/block.json +7 -1
  93. package/src/query-pagination-previous/index.php +19 -2
  94. package/src/search/edit.js +8 -2
  95. package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
  96. package/src/search/utils.js +0 -1
  97. package/src/site-logo/style.scss +1 -0
  98. package/src/social-link/edit.native.js +1 -1
  99. package/src/social-link/editor.native.scss +0 -4
  100. package/src/social-links/test/edit.native.js +30 -0
  101. package/src/social-link/test/index.native.js +0 -132
@@ -4,7 +4,6 @@
4
4
  export const PC_WIDTH_DEFAULT = 50;
5
5
  export const PX_WIDTH_DEFAULT = 350;
6
6
  export const MIN_WIDTH = 220;
7
- export const MIN_WIDTH_UNIT = 'px';
8
7
 
9
8
  /**
10
9
  * Returns a boolean whether passed unit is percentage
@@ -5,6 +5,7 @@
5
5
 
6
6
  a {
7
7
  display: inline-block;
8
+ line-height: 0;
8
9
  }
9
10
 
10
11
  // Provide a sane starting point for the size.
@@ -158,7 +158,7 @@ const SocialLinkEdit = ( {
158
158
  );
159
159
 
160
160
  return (
161
- <View style={ styles.container }>
161
+ <View>
162
162
  { isSelected && (
163
163
  <>
164
164
  <BlockControls>
@@ -1,9 +1,5 @@
1
1
  @import "./socials-with-bg.scss";
2
2
 
3
- .container {
4
- margin: $block-selected-margin;
5
- }
6
-
7
3
  .linkSettingsPanel {
8
4
  padding-left: 0;
9
5
  padding-right: 0;
@@ -3,12 +3,14 @@
3
3
  */
4
4
  import {
5
5
  addBlock,
6
+ dismissModal,
6
7
  fireEvent,
7
8
  getEditorHtml,
8
9
  initializeEditor,
9
10
  within,
10
11
  getBlock,
11
12
  waitFor,
13
+ waitForModalVisible,
12
14
  } from 'test/helpers';
13
15
 
14
16
  /**
@@ -197,4 +199,32 @@ describe( 'Social links block', () => {
197
199
 
198
200
  expect( getEditorHtml() ).toMatchSnapshot();
199
201
  } );
202
+
203
+ it( "should set a icon's URL", async () => {
204
+ const screen = await initializeEditor();
205
+ await addBlock( screen, 'Social Icons' );
206
+ fireEvent.press( screen.getByLabelText( 'Facebook social icon' ) );
207
+ fireEvent.press( screen.getByLabelText( 'Add link to Facebook' ) );
208
+
209
+ await waitForModalVisible(
210
+ screen.getByTestId( 'link-settings-navigation' )
211
+ );
212
+ fireEvent.changeText(
213
+ screen.getByPlaceholderText( 'Add URL' ),
214
+ 'https://facebook.com'
215
+ );
216
+ dismissModal( screen.getByTestId( 'link-settings-navigation' ) );
217
+
218
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
219
+ "<!-- wp:social-links -->
220
+ <ul class="wp-block-social-links"><!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->
221
+
222
+ <!-- wp:social-link {"url":"https://facebook.com","service":"facebook","label":"","rel":""} /-->
223
+
224
+ <!-- wp:social-link {"service":"twitter"} /-->
225
+
226
+ <!-- wp:social-link {"service":"instagram"} /--></ul>
227
+ <!-- /wp:social-links -->"
228
+ ` );
229
+ } );
200
230
  } );
@@ -1,132 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { fireEvent, initializeEditor, waitFor, within } from 'test/helpers';
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { registerCoreBlocks } from '@wordpress/block-library';
9
- import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
10
-
11
- const unregisterBlocks = () => {
12
- const blocks = getBlockTypes();
13
-
14
- blocks.forEach( ( { name } ) => unregisterBlockType( name ) );
15
- };
16
-
17
- describe( '<SocialLinkEdit/>', () => {
18
- beforeAll( () => {
19
- registerCoreBlocks();
20
- } );
21
-
22
- afterAll( () => {
23
- unregisterBlocks();
24
- } );
25
-
26
- /**
27
- * GIVEN an EDITOR is displayed;
28
- * WHEN a SOCIAL ICONS BLOCK is selected from the BLOCK INSERTER;
29
- */
30
- it( 'should display WORDPRESS, FACEBOOK, TWITTER, INSTAGRAM by default.', async () => {
31
- // Arrange
32
- const subject = await initializeEditor( {} );
33
-
34
- // Act
35
- fireEvent.press(
36
- await waitFor( () => subject.getByLabelText( 'Add block' ) )
37
- );
38
- fireEvent.changeText(
39
- await waitFor( () =>
40
- subject.getByPlaceholderText( 'Search blocks' )
41
- ),
42
- 'social icons'
43
- );
44
- fireEvent.press(
45
- await subject.findByLabelText( 'Social Icons block' )
46
- );
47
- const [ socialIconsBlock ] = subject.getAllByLabelText(
48
- /Social Icons Block. Row 1/
49
- );
50
- fireEvent(
51
- within( socialIconsBlock ).getByTestId( 'block-list-wrapper' ),
52
- 'layout',
53
- { nativeEvent: { layout: { width: 100 } } }
54
- );
55
-
56
- // Assert
57
- expect(
58
- await waitFor( () =>
59
- subject.getByLabelText( /WordPress social icon/ )
60
- )
61
- ).toBeDefined();
62
- expect(
63
- await waitFor( () =>
64
- subject.getByLabelText( /Facebook social icon/ )
65
- )
66
- ).toBeDefined();
67
- expect(
68
- await waitFor( () =>
69
- subject.getByLabelText( /Twitter social icon/ )
70
- )
71
- ).toBeDefined();
72
- expect(
73
- await waitFor( () =>
74
- subject.getByLabelText( /Instagram social icon/ )
75
- )
76
- ).toBeDefined();
77
- } );
78
-
79
- /**
80
- * GIVEN an EDITOR is displayed;
81
- * WHEN a SOCIAL ICONS BLOCK is selected from the BLOCK INSERTER;
82
- */
83
- it( `should display WORDPRESS with a URL set by default
84
- AND should display FACEBOOK, TWITTER, INSTAGRAM with NO URL set by default.`, async () => {
85
- // Arrange
86
- const subject = await initializeEditor( {} );
87
-
88
- // Act
89
- fireEvent.press(
90
- await waitFor( () => subject.getByLabelText( 'Add block' ) )
91
- );
92
- fireEvent.changeText(
93
- await waitFor( () =>
94
- subject.getByPlaceholderText( 'Search blocks' )
95
- ),
96
- 'social icons'
97
- );
98
- fireEvent.press(
99
- await subject.findByLabelText( 'Social Icons block' )
100
- );
101
- const [ socialIconsBlock ] = subject.getAllByLabelText(
102
- /Social Icons Block. Row 1/
103
- );
104
- fireEvent(
105
- within( socialIconsBlock ).getByTestId( 'block-list-wrapper' ),
106
- 'layout',
107
- { nativeEvent: { layout: { width: 100 } } }
108
- );
109
-
110
- // Assert
111
- expect(
112
- await waitFor( () =>
113
- subject.getByA11yHint( /WordPress has URL set/ )
114
- )
115
- ).toBeDefined();
116
- expect(
117
- await waitFor( () =>
118
- subject.getByA11yHint( /Facebook has no URL set/ )
119
- )
120
- ).toBeDefined();
121
- expect(
122
- await waitFor( () =>
123
- subject.getByA11yHint( /Twitter has no URL set/ )
124
- )
125
- ).toBeDefined();
126
- expect(
127
- await waitFor( () =>
128
- subject.getByA11yHint( /Instagram has no URL set/ )
129
- )
130
- ).toBeDefined();
131
- } );
132
- } );