Skip to content

Commit 7370d11

Browse files
committed
[test] Update tests for Fix #144 [context-generator] Rename method -> oldMethod, cachedMethod -> method, keeping cachedMethod as an alias for method
1 parent 8eda54a commit 7370d11

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

test/basic/basic-test-original.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta charset="utf-8">
99
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
1010
<title>Thin Hook Preprocessor Basic Test</title>
11-
<script src="../../../thin-hook/test/hook.min.js?version=basic&xno-hook-authorization=log-no-hook-authorization&sw-root=./&no-hook=true&hook-name=__hook__&context-generator-name=cachedMethod&discard-hook-errors=false&fallback-page=fallback.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=true"></script>
11+
<script src="../../../thin-hook/test/hook.min.js?version=basic&xno-hook-authorization=log-no-hook-authorization&sw-root=./&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=fallback.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=true"></script>
1212
<script context-generator src="no-hook-authorization.js?no-hook=true"></script>
1313
<script src="hook-callback.js?no-hook=true"></script>
1414
<script src="../../../web-component-tester/browser.js?no-hook=true"></script>

test/basic/basic-test.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta charset="utf-8">
99
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
1010
<title>Thin Hook Preprocessor Basic Test</title>
11-
<script src="../../../thin-hook/test/hook.min.js?version=basic&xno-hook-authorization=log-no-hook-authorization&sw-root=./&no-hook=true&hook-name=__hook__&context-generator-name=cachedMethod&discard-hook-errors=false&fallback-page=fallback.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=false"></script></head></html><!--
11+
<script src="../../../thin-hook/test/hook.min.js?version=basic&xno-hook-authorization=log-no-hook-authorization&sw-root=./&no-hook=true&hook-name=__hook__&context-generator-name=method&discard-hook-errors=false&fallback-page=fallback.html&hook-property=true&hook-global=true&hook-prefix=_pp_&compact=true&service-worker-ready=false"></script></head></html><!--
1212
<script context-generator src="no-hook-authorization.js?no-hook=true"></script>
1313
<script src="hook-callback.js?no-hook=true"></script>
1414
<script src="../../../web-component-tester/browser.js?no-hook=true"></script>

test/basic/basic-test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
4343
'method': Function,
4444
'cachedMethod': Function,
4545
'cachedMethodDebug': Function,
46+
'oldMethod': Function,
4647
},
4748
__hook__: Function,
4849
__hook_except_properties__: Function,
@@ -93,7 +94,7 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
9394
return [
9495
'__hook__', // [0] hookName
9596
[[this.context, {}]], // [1] initialContext
96-
'cachedMethod', // [2] contextGeneratorName
97+
'method', // [2] contextGeneratorName
9798
true, // [3] metaHooking
9899
true, // [4] _hookProperty
99100
null, // [5] _sourceMap
@@ -1456,14 +1457,14 @@ Copyright (c) 2017, Tetsuya Mori <[email protected]>. All rights reserved.
14561457
},
14571458
{
14581459
code: `{ let a = 1; eval('1'); }`,
1459-
hooked: `{let a=1;$hook$.eval('__hook__',[['HookApiTest',{}]],'cachedMethod',{a:true})('1',(script,eval)=>eval(script));}`,
1460+
hooked: `{let a=1;$hook$.eval('__hook__',[['HookApiTest',{}]],'method',{a:true})('1',(script,eval)=>eval(script));}`,
14601461
eval: () => true,
14611462
},
14621463
{
14631464
code: `var a; new Promise(resolve => { a = resolve; setTimeout('let resolve = a; a = null; resolve(1);', 100); });`,
14641465
hooked: `$hook$.global(__hook__,'HookApiTest','a','var')._pp_a;` +
14651466
`__hook__(Promise,null,[(...args)=>(__hook__(resolve=>{$hook$.global(__hook__,'HookApiTest','a','set')._pp_a=resolve;` +
1466-
`$hook$.setTimeout('__hook__',[['HookApiTest',{}]],'cachedMethod')('let resolve = a; a = null; resolve(1);',100);},null,args,'HookApiTest'))],'HookApiTest',true);`,
1467+
`$hook$.setTimeout('__hook__',[['HookApiTest',{}]],'method')('let resolve = a; a = null; resolve(1);',100);},null,args,'HookApiTest'))],'HookApiTest',true);`,
14671468
asynchronous: true,
14681469
},
14691470
{

0 commit comments

Comments
 (0)