2018-06-20 17:43:53 +00:00
|
|
|
/** @format */
|
|
|
|
|
2018-05-16 14:59:03 +00:00
|
|
|
// Set up `wp.*` aliases. Doing this because any tests importing wp stuff will
|
|
|
|
// likely run into this.
|
|
|
|
global.wp = {
|
|
|
|
shortcode: {
|
|
|
|
next() {},
|
|
|
|
regexp: jest.fn().mockReturnValue( new RegExp() ),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
'components',
|
|
|
|
'utils',
|
|
|
|
'blocks',
|
|
|
|
'editor',
|
|
|
|
'data',
|
|
|
|
'core-data',
|
|
|
|
'edit-post',
|
|
|
|
'viewport',
|
|
|
|
'plugins',
|
|
|
|
].forEach( entryPointName => {
|
|
|
|
Object.defineProperty( global.wp, entryPointName, {
|
|
|
|
get: () => require( 'gutenberg/' + entryPointName ),
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
Object.defineProperty( global.wp, 'element', {
|
|
|
|
get: () => require( 'gutenberg/packages/element' ),
|
|
|
|
} );
|
2018-05-21 15:26:04 +00:00
|
|
|
|
|
|
|
Object.defineProperty( global.wp, 'dom', {
|
|
|
|
get: () => require( 'gutenberg/packages/dom' ),
|
|
|
|
} );
|
2018-06-20 17:43:53 +00:00
|
|
|
|
|
|
|
global.wcSettings = {
|
|
|
|
adminUrl: 'https://vagrant.local/wp/wp-admin/',
|
|
|
|
locale: 'en-US',
|
|
|
|
currency: { code: 'USD', precision: 2, symbol: '$' },
|
2018-07-04 01:50:12 +00:00
|
|
|
date: {
|
|
|
|
dow: 0,
|
|
|
|
},
|
2018-06-20 17:43:53 +00:00
|
|
|
};
|
2018-05-28 10:55:19 +00:00
|
|
|
|
|
|
|
Object.defineProperty( global.wp, 'date', {
|
|
|
|
get: () => require( 'gutenberg/packages/date' ),
|
|
|
|
} );
|