@@ -783,6 +783,44 @@ if (EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION) {
783
783
} ) ;
784
784
}
785
785
786
+ '@test merges class attribute with `...attributes` in yielded contextual component ("splattributes")' ( ) {
787
+ this . registerComponent ( 'foo-bar' , {
788
+ ComponentClass : Component . extend ( { tagName : '' } ) ,
789
+ template : '{{yield (hash baz=(component "foo-bar/baz"))}}' ,
790
+ } ) ;
791
+ this . registerComponent ( 'foo-bar/baz' , {
792
+ ComponentClass : Component . extend ( { tagName : '' } ) ,
793
+ template : '<div class="default-class" ...attributes>hello</div>' ,
794
+ } ) ;
795
+
796
+ this . render ( '<FooBar as |fb|><fb.baz class="custom-class" title="foo"></fb.baz></FooBar>' ) ;
797
+
798
+ this . assertElement ( this . firstChild , {
799
+ tagName : 'div' ,
800
+ attrs : { class : classes ( 'default-class custom-class' ) , title : 'foo' } ,
801
+ content : 'hello' ,
802
+ } ) ;
803
+ }
804
+
805
+ '@test the attributes passed on invocation trump over the default ones on elements with `...attributes` in yielded contextual component ("splattributes")' ( ) {
806
+ this . registerComponent ( 'foo-bar' , {
807
+ ComponentClass : Component . extend ( { tagName : '' } ) ,
808
+ template : '{{yield (hash baz=(component "foo-bar/baz"))}}' ,
809
+ } ) ;
810
+ this . registerComponent ( 'foo-bar/baz' , {
811
+ ComponentClass : Component . extend ( { tagName : '' } ) ,
812
+ template : '<div title="bar" ...attributes>hello</div>' ,
813
+ } ) ;
814
+
815
+ this . render ( '<FooBar as |fb|><fb.baz title="foo"></fb.baz></FooBar>' ) ;
816
+
817
+ this . assertElement ( this . firstChild , {
818
+ tagName : 'div' ,
819
+ attrs : { title : 'foo' } ,
820
+ content : 'hello' ,
821
+ } ) ;
822
+ }
823
+
786
824
'@test can include `...attributes` in multiple elements in tagless component ("splattributes")' ( ) {
787
825
this . registerComponent ( 'foo-bar' , {
788
826
ComponentClass : Component . extend ( { tagName : '' } ) ,
0 commit comments