mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: jest 单测问题
This commit is contained in:
parent
18f7087406
commit
8acd4ca5a7
@ -25,6 +25,29 @@ global.ResizeObserver = require('resize-observer-polyfill');
|
||||
|
||||
global.__buildVersion = '';
|
||||
|
||||
global.BroadcastChannel = class {
|
||||
constructor(channelName) {
|
||||
this.channelName = channelName;
|
||||
this.listeners = [];
|
||||
}
|
||||
postMessage(message) {
|
||||
this.listeners.forEach(listener => listener({data: message}));
|
||||
}
|
||||
addEventListener(event, listener) {
|
||||
if (event === 'message') {
|
||||
this.listeners.push(listener);
|
||||
}
|
||||
}
|
||||
removeEventListener(event, listener) {
|
||||
if (event === 'message') {
|
||||
this.listeners = this.listeners.filter(l => l !== listener);
|
||||
}
|
||||
}
|
||||
close() {
|
||||
this.listeners = [];
|
||||
}
|
||||
};
|
||||
|
||||
global.beforeAll(async () => {
|
||||
console.warn =
|
||||
console.groupCollapsed =
|
||||
|
Loading…
Reference in New Issue
Block a user