-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathactions.js
More file actions
59 lines (53 loc) · 1.39 KB
/
actions.js
File metadata and controls
59 lines (53 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* Internal dependencies
*/
import {
addFormatTypes,
removeFormatTypes,
disableFormatTypeInBlock,
enableFormatTypeInBlock,
} from '../actions';
describe( 'actions', () => {
describe( 'addFormatTypes', () => {
it( 'should cast format types as an array', () => {
const formatTypes = { name: 'core/test-format' };
const expected = {
type: 'ADD_FORMAT_TYPES',
formatTypes: [ formatTypes ],
};
expect( addFormatTypes( formatTypes ) ).toEqual( expected );
} );
} );
describe( 'removeFormatTypes', () => {
it( 'should cast format types as an array', () => {
const names = 'core/test-format';
const expected = {
type: 'REMOVE_FORMAT_TYPES',
names: [ names ],
};
expect( removeFormatTypes( names ) ).toEqual( expected );
} );
} );
describe( 'disableFormatTypeInBlock', () => {
it( 'should return the correct action object', () => {
expect(
disableFormatTypeInBlock( 'core/heading', 'core/italic' )
).toEqual( {
type: 'DISABLE_FORMAT_TYPE_IN_BLOCK',
blockName: 'core/heading',
formatName: 'core/italic',
} );
} );
} );
describe( 'enableFormatTypeInBlock', () => {
it( 'should return the correct action object', () => {
expect(
enableFormatTypeInBlock( 'core/heading', 'core/italic' )
).toEqual( {
type: 'ENABLE_FORMAT_TYPE_IN_BLOCK',
blockName: 'core/heading',
formatName: 'core/italic',
} );
} );
} );
} );