@@ -919,6 +919,41 @@ describe('Generators - Template', () => {
919919 expect ( output [ BINDING_ATTRIBUTES_KEY ] ) . to . have . length ( 0 )
920920 } )
921921
922+ it ( 'Empty inherited slots do not create the HTML key' , ( ) => {
923+ const source = '<my-tag><slot name="default" slot="default"/></my-tag>'
924+
925+ const { template } = parse ( source )
926+
927+ const input = tagBinding ( template , 'expr0' , FAKE_SRC_FILE , source )
928+ const output = evaluateOutput ( input )
929+ const defaultSlot = output . slots [ 0 ]
930+
931+ expect ( output [ BINDING_SELECTOR_KEY ] ) . to . be . equal ( '[expr0]' )
932+ expect ( output [ BINDING_TYPE_KEY ] ) . to . be . equal ( bindingTypes . TAG )
933+ expect ( output [ BINDING_EVALUATE_KEY ] ( ) ) . to . be . equal ( 'my-tag' )
934+ expect ( defaultSlot [ BINDING_HTML_KEY ] ) . to . be . not . ok
935+ expect ( defaultSlot [ BINDING_ID_KEY ] ) . to . be . equal ( 'default' )
936+ } )
937+
938+ it ( 'Not empty inherited slots do create the HTML key' , ( ) => {
939+ const source =
940+ '<my-tag><slot name="default" slot="default">Hello there</slot></my-tag>'
941+
942+ const { template } = parse ( source )
943+
944+ const input = tagBinding ( template , 'expr0' , FAKE_SRC_FILE , source )
945+ const output = evaluateOutput ( input )
946+ const defaultSlot = output . slots [ 0 ]
947+
948+ expect ( output [ BINDING_SELECTOR_KEY ] ) . to . be . equal ( '[expr0]' )
949+ expect ( output [ BINDING_TYPE_KEY ] ) . to . be . equal ( bindingTypes . TAG )
950+ expect ( output [ BINDING_EVALUATE_KEY ] ( ) ) . to . be . equal ( 'my-tag' )
951+ expect ( defaultSlot [ BINDING_HTML_KEY ] ) . to . be . equal (
952+ '<slot expr34="expr34" name="default" slot="default"></slot>' ,
953+ )
954+ expect ( defaultSlot [ BINDING_ID_KEY ] ) . to . be . equal ( 'default' )
955+ } )
956+
922957 it ( 'Tag binding on a custom input element' , ( ) => {
923958 const source = '<input is="bar" value="1"/>'
924959 const { template } = parse ( source )
0 commit comments