2018-11-16 15:43:51 +00:00
|
|
|
// Set up `wp.*` aliases. Doing this because any tests importing wp stuff will likely run into this.
|
|
|
|
global.wp = {};
|
|
|
|
|
2018-11-30 20:39:16 +00:00
|
|
|
// wcSettings is required by @woocommerce/* packages
|
|
|
|
global.wcSettings = {
|
|
|
|
adminUrl: 'https://vagrant.local/wp/wp-admin/',
|
2020-05-20 19:33:16 +00:00
|
|
|
shippingMethodsExist: true,
|
2019-09-23 18:07:13 +00:00
|
|
|
countries: [],
|
|
|
|
currency: {
|
|
|
|
code: 'USD',
|
|
|
|
precision: 2,
|
|
|
|
symbol: '$',
|
|
|
|
},
|
2021-02-17 13:01:20 +00:00
|
|
|
currentUserIsAdmin: false,
|
2018-11-30 20:39:16 +00:00
|
|
|
date: {
|
|
|
|
dow: 0,
|
|
|
|
},
|
|
|
|
orderStatuses: {
|
|
|
|
pending: 'Pending payment',
|
|
|
|
processing: 'Processing',
|
|
|
|
'on-hold': 'On hold',
|
|
|
|
completed: 'Completed',
|
|
|
|
cancelled: 'Cancelled',
|
|
|
|
refunded: 'Refunded',
|
|
|
|
failed: 'Failed',
|
|
|
|
},
|
2019-09-23 18:07:13 +00:00
|
|
|
locale: {
|
|
|
|
siteLocale: 'en_US',
|
2018-12-19 15:55:17 +00:00
|
|
|
userLocale: 'en_US',
|
|
|
|
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
|
|
|
|
},
|
2021-01-06 09:22:51 +00:00
|
|
|
shippingCountries: {
|
|
|
|
AT: 'Austria',
|
|
|
|
CA: 'Canada',
|
|
|
|
GB: 'United Kingdom (UK)',
|
|
|
|
},
|
|
|
|
shippingStates: {
|
|
|
|
CA: {
|
|
|
|
ON: 'Ontario',
|
|
|
|
},
|
|
|
|
},
|
2021-02-11 16:49:27 +00:00
|
|
|
countryLocale: {
|
|
|
|
GB: {
|
|
|
|
postcode: { label: 'Postcode' },
|
|
|
|
state: { label: 'County', required: false },
|
|
|
|
},
|
|
|
|
AT: {
|
|
|
|
postcode: { priority: 65 },
|
|
|
|
state: { required: false, hidden: true },
|
|
|
|
},
|
|
|
|
CA: {
|
|
|
|
postcode: { label: 'Postal code' },
|
|
|
|
state: { label: 'Province' },
|
|
|
|
},
|
|
|
|
},
|
2018-11-30 20:39:16 +00:00
|
|
|
};
|
|
|
|
|
2020-07-14 19:46:44 +00:00
|
|
|
global.jQuery = () => ( {
|
|
|
|
on: () => void null,
|
|
|
|
off: () => void null,
|
|
|
|
} );
|
|
|
|
|
2020-09-07 17:31:10 +00:00
|
|
|
global.IntersectionObserver = function () {
|
2020-08-20 14:14:12 +00:00
|
|
|
return {
|
|
|
|
observe: () => void null,
|
|
|
|
unobserve: () => void null,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-11-16 15:43:51 +00:00
|
|
|
const wordPressPackages = [
|
|
|
|
'blocks',
|
|
|
|
'components',
|
|
|
|
'date',
|
|
|
|
'editor',
|
|
|
|
'element',
|
|
|
|
'i18n',
|
|
|
|
];
|
|
|
|
|
|
|
|
wordPressPackages.forEach( ( lib ) => {
|
|
|
|
Object.defineProperty( global.wp, lib, {
|
|
|
|
get: () => require( `@wordpress/${ lib }` ),
|
|
|
|
} );
|
|
|
|
} );
|