Skip to content

Commit bab0067

Browse files
committed
Rename blocks.query as blocks.matchers
1 parent 9def798 commit bab0067

File tree

22 files changed

+49
-49
lines changed

22 files changed

+49
-49
lines changed

blocks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ add_action( 'enqueue_block_editor_assets', 'random_image_enqueue_block_editor_as
117117
// block.js
118118
( function( blocks, element ) {
119119
var el = element.createElement,
120-
query = blocks.query;
120+
matchers = blocks.matchers;
121121

122122
function RandomImage( props ) {
123123
var src = 'http://lorempixel.com/400/200/' + props.category;
@@ -136,7 +136,7 @@ add_action( 'enqueue_block_editor_assets', 'random_image_enqueue_block_editor_as
136136
category: 'media',
137137

138138
attributes: {
139-
category: query.attr( 'img', 'alt' )
139+
category: matchers.attr( 'img', 'alt' )
140140
},
141141

142142
edit: function( props ) {

blocks/api/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* External dependencies
33
*/
4-
import * as query from './query';
4+
import * as matchers from './matchers';
55

6-
export { query };
6+
export { matchers };
77
export { createBlock, switchToBlockType } from './factory';
88
export { default as parse } from './parser';
99
export { default as pasteHandler } from './paste';
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ import { renderToString } from 'element';
1111
/**
1212
* Internal dependencies
1313
*/
14-
import * as query from '../query';
14+
import * as matchers from '../matchers';
1515

16-
describe( 'query', () => {
16+
describe( 'matchers', () => {
1717
it( 'should generate matchers which apply internal flag', () => {
18-
for ( const matcherFn in query ) {
19-
expect( query[ matcherFn ]()._wpBlocksKnownMatcher ).toBe( true );
18+
for ( const matcherFn in matchers ) {
19+
expect( matchers[ matcherFn ]()._wpBlocksKnownMatcher ).toBe( true );
2020
}
2121
} );
2222

2323
describe( 'children()', () => {
2424
it( 'should return a matcher function', () => {
25-
const matcher = query.children();
25+
const matcher = matchers.children();
2626

2727
expect( typeof matcher ).toBe( 'function' );
2828
} );
@@ -31,15 +31,15 @@ describe( 'query', () => {
3131
// Assumption here is that we can cleanly convert back and forth
3232
// between a string and WPElement representation
3333
const html = '<blockquote><p>A delicious sundae dessert</p></blockquote>';
34-
const match = parse( html, query.children() );
34+
const match = parse( html, matchers.children() );
3535

3636
expect( renderToString( match ) ).toBe( html );
3737
} );
3838
} );
3939

4040
describe( 'node()', () => {
4141
it( 'should return a matcher function', () => {
42-
const matcher = query.node();
42+
const matcher = matchers.node();
4343

4444
expect( typeof matcher ).toBe( 'function' );
4545
} );
@@ -48,7 +48,7 @@ describe( 'query', () => {
4848
// Assumption here is that we can cleanly convert back and forth
4949
// between a string and WPElement representation
5050
const html = '<blockquote><p>A delicious sundae dessert</p></blockquote>';
51-
const match = parse( html, query.node() );
51+
const match = parse( html, matchers.node() );
5252

5353
expect( wp.element.renderToString( match ) ).toBe( `<body>${ html }</body>` );
5454
} );

blocks/api/test/parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { noop } from 'lodash';
66
/**
77
* Internal dependencies
88
*/
9-
import { text } from '../query';
9+
import { text } from '../matchers';
1010
import {
1111
getBlockAttributes,
1212
parseBlockAttributes,
@@ -43,7 +43,7 @@ describe( 'block parser', () => {
4343
} );
4444
} );
4545

46-
it( 'should use the query object implementation', () => {
46+
it( 'should use the matchers object implementation', () => {
4747
const attributes = {
4848
emphasis: text( 'strong' ),
4949
ignoredDomMatcher: ( node ) => node.innerHTML,

blocks/library/button/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { IconButton } from 'components';
99
*/
1010
import './style.scss';
1111
import './block.scss';
12-
import { registerBlockType, query } from '../../api';
12+
import { registerBlockType, matchers } from '../../api';
1313
import Editable from '../../editable';
1414
import BlockControls from '../../block-controls';
1515
import BlockAlignmentToolbar from '../../block-alignment-toolbar';
1616

17-
const { attr, children } = query;
17+
const { attr, children } = matchers;
1818

1919
registerBlockType( 'core/button', {
2020
title: __( 'Button' ),

blocks/library/code/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { __ } from 'i18n';
1212
* Internal dependencies
1313
*/
1414
import './style.scss';
15-
import { registerBlockType, query } from '../../api';
15+
import { registerBlockType, matchers } from '../../api';
1616

17-
const { prop } = query;
17+
const { prop } = matchers;
1818

1919
registerBlockType( 'core/code', {
2020
title: __( 'Code' ),

blocks/library/cover-image/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import classnames from 'classnames';
1010
*/
1111
import './style.scss';
1212
import './block.scss';
13-
import { registerBlockType, query } from '../../api';
13+
import { registerBlockType, matchers } from '../../api';
1414
import Editable from '../../editable';
1515
import MediaUploadButton from '../../media-upload-button';
1616
import BlockControls from '../../block-controls';
@@ -19,7 +19,7 @@ import InspectorControls from '../../inspector-controls';
1919
import ToggleControl from '../../inspector-controls/toggle-control';
2020
import BlockDescription from '../../block-description';
2121

22-
const { text } = query;
22+
const { text } = matchers;
2323

2424
const validAlignments = [ 'left', 'center', 'right', 'wide', 'full' ];
2525

blocks/library/embed/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import { Button, Placeholder, Spinner, SandBox } from 'components';
1515
* Internal dependencies
1616
*/
1717
import './style.scss';
18-
import { registerBlockType, query } from '../../api';
18+
import { registerBlockType, matchers } from '../../api';
1919
import Editable from '../../editable';
2020
import BlockControls from '../../block-controls';
2121
import BlockAlignmentToolbar from '../../block-alignment-toolbar';
2222

23-
const { attr, children } = query;
23+
const { attr, children } = matchers;
2424

2525
// These embeds do not work in sandboxes
2626
const HOSTS_NO_PREVIEWS = [ 'facebook.com' ];

blocks/library/freeform/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { __ } from 'i18n';
77
* Internal dependencies
88
*/
99
import './style.scss';
10-
import { registerBlockType, query, setUnknownTypeHandler } from '../../api';
10+
import { registerBlockType, matchers, setUnknownTypeHandler } from '../../api';
1111
import OldEditor from './old-editor';
1212

13-
const { prop } = query;
13+
const { prop } = matchers;
1414

1515
registerBlockType( 'core/freeform', {
1616
title: __( 'Classic Text' ),

0 commit comments

Comments
 (0)