-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.js
47 lines (40 loc) · 1.06 KB
/
index.js
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
/**
* External dependencies
*/
import { equal } from 'assert';
import fs from 'fs';
import path from 'path';
/**
* Internal dependencies
*/
import rawHandler from '../../index';
import serialize from '../../../serializer';
import { registerCoreBlocks } from '../../../../test/helpers';
const types = [
'plain',
'classic',
'apple',
'google-docs',
'ms-word',
'ms-word-online',
'evernote',
'iframe-embed',
'one-image',
'two-images',
];
describe( 'raw handling: integration', () => {
beforeAll( () => {
// Load all hooks that modify blocks
require( 'blocks/hooks' );
registerCoreBlocks();
} );
types.forEach( ( type ) => {
it( type, () => {
const input = fs.readFileSync( path.join( __dirname, `${ type }-in.html` ), 'utf8' ).trim();
const output = fs.readFileSync( path.join( __dirname, `${ type }-out.html` ), 'utf8' ).trim();
const converted = rawHandler( { HTML: input, canUserUseUnfilteredHTML: true } );
const serialized = typeof converted === 'string' ? converted : serialize( converted );
equal( output, serialized );
} );
} );
} );