From 465e28d6a4842f885ac16d10f7c5631da44dd2be Mon Sep 17 00:00:00 2001 From: Kuitos Date: Tue, 22 Jun 2021 21:07:55 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20fix=20test=20case=20about=20window?= =?UTF-8?q?=20reference=20binding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sandbox/__tests__/proxySandbox.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sandbox/__tests__/proxySandbox.test.ts b/src/sandbox/__tests__/proxySandbox.test.ts index 4b221180f..3deec820d 100644 --- a/src/sandbox/__tests__/proxySandbox.test.ts +++ b/src/sandbox/__tests__/proxySandbox.test.ts @@ -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', () => { - const { proxy } = new ProxySandbox('mustBeBoundWithWindowReference'); - proxy.nativeWindowFunction = function nativeWindowFunction(this: any) { + window.nativeWindowFunction = function nativeWindowFunction(this: any) { if (this !== undefined && this !== window) { throw new Error('Illegal Invocation!'); } @@ -358,5 +357,6 @@ it('native window function calling should always be bound with window', () => { return 'success'; }; + const { proxy } = new ProxySandbox('mustBeBoundWithWindowReference'); expect(proxy.nativeWindowFunction()).toBe('success'); });