fix test case about window reference binding (#1529)

This commit is contained in:
Kuitos 2021-06-22 21:12:28 +08:00 committed by GitHub
parent 4eee5220e3
commit d9810da3ef

View File

@ -349,8 +349,7 @@ it('should return true while [[GetPrototypeOf]] invoked by proxy object', () =>
}); });
it('native window function calling should always be bound with window', () => { it('native window function calling should always be bound with window', () => {
const { proxy } = new ProxySandbox('mustBeBoundWithWindowReference'); window.nativeWindowFunction = function nativeWindowFunction(this: any) {
proxy.nativeWindowFunction = function nativeWindowFunction(this: any) {
if (this !== undefined && this !== window) { if (this !== undefined && this !== window) {
throw new Error('Illegal Invocation!'); throw new Error('Illegal Invocation!');
} }
@ -358,5 +357,6 @@ it('native window function calling should always be bound with window', () => {
return 'success'; return 'success';
}; };
const { proxy } = new ProxySandbox('mustBeBoundWithWindowReference');
expect(proxy.nativeWindowFunction()).toBe('success'); expect(proxy.nativeWindowFunction()).toBe('success');
}); });