File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,6 +231,26 @@ export class FunctionTests {
231231 Expect ( result ) . toBe ( 3 * returnValue ) ;
232232 }
233233
234+ @Test ( "Function bind" )
235+ public functionBind ( ) : void {
236+ const source = `const abc = function (a: string) { console.log(this.a + a); }
237+ abc.bind({ a: 4 })("b");` ;
238+
239+ const result = util . transpileAndExecute ( source ) ;
240+
241+ Expect ( result ) . toBe ( "4b" ) ;
242+ }
243+
244+ @Test ( "Function apply" )
245+ public functionApply ( ) : void {
246+ const source = `const abc = function (a: string) { console.log(this.a + a); }
247+ abc.apply({ a: 4 }, ["b"]);` ;
248+
249+ const result = util . transpileAndExecute ( source ) ;
250+
251+ Expect ( result ) . toBe ( "4b" ) ;
252+ }
253+
234254 @Test ( "Invalid property access call transpilation" )
235255 public invalidPropertyCall ( ) : void {
236256 const transpiler = util . makeTestTranspiler ( ) ;
You can’t perform that action at this time.
0 commit comments