@@ -28,15 +28,32 @@ describe('template-instance', () => {
2828 root . appendChild ( instance )
2929 expect ( root . innerHTML ) . to . equal ( `<div>Hello world</div>` )
3030 } )
31- it ( 'applies data to nested templated element nodes' , ( ) => {
31+ it ( 'applies data to nested templated element nodes with the default processPropertyIdentity ' , ( ) => {
3232 const root = document . createElement ( 'div' )
3333 const template = Object . assign ( document . createElement ( 'template' ) , {
3434 innerHTML : '<template><div>{{x}}</div></template>' ,
3535 } )
36- root . appendChild ( new TemplateInstance ( template , { x : 'Hello world' } ) )
36+ const instance = new TemplateInstance ( template , { x : 'Hello world' } )
3737
38+ root . appendChild ( instance )
3839 expect ( root . innerHTML ) . to . equal ( '<template><div>Hello world</div></template>' )
3940 expect ( template . innerHTML ) . to . equal ( '<template><div>{{x}}</div></template>' )
41+ instance . update ( { x : 'Goodbye world' } )
42+ expect ( root . innerHTML ) . to . equal ( '<template><div>Goodbye world</div></template>' )
43+ expect ( template . innerHTML ) . to . equal ( '<template><div>{{x}}</div></template>' )
44+ } )
45+ it ( 'applies data to nested templated element nodes with propertyIdentityOrBooleanAttribute' , ( ) => {
46+ const template = Object . assign ( document . createElement ( 'template' ) , {
47+ innerHTML : '<template><div hidden="{{hidden}}"></div></template>' ,
48+ } )
49+ const instance = new TemplateInstance ( template , { hidden : true } , propertyIdentityOrBooleanAttribute )
50+
51+ const root = document . createElement ( 'div' )
52+ root . appendChild ( instance )
53+ expect ( root . innerHTML ) . to . equal ( '<template><div hidden=""></div></template>' )
54+ expect ( template . innerHTML ) . to . equal ( '<template><div hidden="{{hidden}}"></div></template>' )
55+ instance . update ( { hidden : false } )
56+ expect ( root . innerHTML ) . to . equal ( '<template><div></div></template>' )
4057 } )
4158 it ( 'applies data to templated DocumentFragment nodes' , ( ) => {
4259 const template = document . createElement ( 'template' )
@@ -367,7 +384,7 @@ describe('template-instance', () => {
367384 part . replace ( )
368385 }
369386 } else {
370- processPropertyIdentity ( part , value , state )
387+ processPropertyIdentity ( part , value )
371388 }
372389 } )
373390 const template = Object . assign ( document . createElement ( 'template' ) , {
@@ -382,12 +399,12 @@ describe('template-instance', () => {
382399 expect ( root . innerHTML ) . to . equal ( 'x' )
383400 } )
384401
385- it ( 'makes outer state available to InnerTemplatePart elements without attributes' , ( ) => {
402+ it ( 'makes outer state available to InnerTemplatePart elements without attributes with default propertyIdentity processing ' , ( ) => {
386403 let callCount = 0
387- const processor = createProcessor ( ( part , value , state ) => {
404+ const processor = createProcessor ( ( part , value ) => {
388405 if ( part instanceof InnerTemplatePart && value === part . expression ) {
389406 callCount += 1
390- processPropertyIdentity ( part , value , state )
407+ processPropertyIdentity ( part , value )
391408 }
392409 } )
393410 const template = Object . assign ( document . createElement ( 'template' ) , {
0 commit comments