@@ -530,39 +530,19 @@ class InteroperabilityTest {
530
530
@ Test def handleDefaultParameters (): Unit = {
531
531
val obj = js.eval("""
532
532
var interoperabilityTestDefaultParam = {
533
- fun: function() { return arguments; }
533
+ fun: function() { return Array.prototype.slice.call( arguments) ; }
534
534
};
535
535
interoperabilityTestDefaultParam;
536
536
""" ).asInstanceOf [InteroperabilityTestDefaultParam ]
537
537
538
- // Helpers
539
- val keys = js.Dynamic .global.Object .keys
540
- val undef = js.undefined
538
+ assertJSArrayEquals[Any ](js.Array (1 ), obj.simple(1 ))
539
+ assertJSArrayEquals[Any ](js.Array (1 , 5 ), obj.simple(1 , 5 ))
541
540
542
- assertEquals( 1 , keys( obj.simple( 1 )).length )
543
- assertEquals( 1 , obj.simple( 1 )( " 0 " ))
541
+ assertJSArrayEquals[ Any ](js. Array (js.undefined, 5 ), obj.named(y = 5 ) )
542
+ assertJSArrayEquals[ Any ](js. Array ( 5 ) , obj.named(x = 5 ))
544
543
545
- assertEquals(2 , keys(obj.simple(1 , 5 )).length)
546
- assertEquals(1 , obj.simple(1 , 5 )(" 0" ))
547
- assertEquals(5 , obj.simple(1 , 5 )(" 1" ))
548
-
549
- assertEquals(2 , keys(obj.named(y = 5 )).length)
550
- assertEquals(undef, obj.named(y = 5 )(" 0" ))
551
- assertEquals(5 , obj.named(y = 5 )(" 1" ))
552
-
553
- assertEquals(1 , keys(obj.named(x = 5 )).length)
554
- assertEquals(5 , obj.named(x = 5 )(" 0" ))
555
-
556
- assertEquals(5 , keys(obj.multi()(1 ,2 ,3 ,4 )()).length)
557
- assertEquals(undef, obj.multi()(1 ,2 ,3 ,4 )()(" 0" ))
558
- assertEquals(1 , obj.multi()(1 ,2 ,3 ,4 )()(" 1" ))
559
- assertEquals(2 , obj.multi()(1 ,2 ,3 ,4 )()(" 2" ))
560
- assertEquals(3 , obj.multi()(1 ,2 ,3 ,4 )()(" 3" ))
561
- assertEquals(4 , obj.multi()(1 ,2 ,3 ,4 )()(" 4" ))
562
-
563
- assertEquals(2 , keys(obj.multi(2 )()(5 )).length)
564
- assertEquals(2 , obj.multi(2 )()(5 )(" 0" ))
565
- assertEquals(5 , obj.multi(2 )()(5 )(" 1" ))
544
+ assertJSArrayEquals[Any ](js.Array (js.undefined, 1 , 2 , 3 , 4 ), obj.multi()(1 , 2 , 3 , 4 )())
545
+ assertJSArrayEquals[Any ](js.Array (2 , 5 ), obj.multi(2 )()(5 ))
566
546
}
567
547
568
548
@ Test def defaultParametersForConstructors_Issue791 (): Unit = {
@@ -808,11 +788,11 @@ object InteroperabilityTest {
808
788
@ js.native
809
789
trait InteroperabilityTestDefaultParam extends js.Object {
810
790
@ JSName (" fun" )
811
- def simple (x : Int , y : Int = 5 ): js.Dictionary [Any ] = js.native
791
+ def simple (x : Int , y : Int = 5 ): js.Array [Any ] = js.native
812
792
@ JSName (" fun" )
813
- def named (x : Int = 1 , y : Int = 1 , z : Int = 1 ): js.Dictionary [Any ] = js.native
793
+ def named (x : Int = 1 , y : Int = 1 , z : Int = 1 ): js.Array [Any ] = js.native
814
794
@ JSName (" fun" )
815
- def multi (x : Int = 1 )(ys : Int * )(z : Int = 1 ): js.Dictionary [Any ] = js.native
795
+ def multi (x : Int = 1 )(ys : Int * )(z : Int = 1 ): js.Array [Any ] = js.native
816
796
}
817
797
818
798
@ js.native
0 commit comments