File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 144144 this . _markdown = '```\n' + snippet + '\n' + '```' ;
145145
146146 // Stamp the template.
147- Polymer . dom ( this ) . appendChild ( document . importNode ( template . content , true ) ) ;
147+ if ( ! template . is ) {
148+ Polymer . dom ( this ) . appendChild ( document . importNode ( template . content , true ) ) ;
149+ }
148150 } ,
149151
150152 _copyToClipboard : function ( ) {
Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ <h4>Demo of an element with custom styles</h4>
7575 < paper-checkbox checked class ="red "> Checkbox</ paper-checkbox >
7676 </ template >
7777 </ demo-snippet >
78+
79+ < h4 > Demo of an element with bindings</ h4 >
80+ < demo-snippet class ="centered-demo small-text ">
81+ < template is ="dom-bind ">
82+ < paper-checkbox checked ="[[active]] "> One-Way Binding</ paper-checkbox >
83+ < paper-checkbox checked ="{{active}} "> Two-Way Binding</ paper-checkbox >
84+ </ template >
85+ </ demo-snippet >
7886 </ div >
7987</ body >
8088</ html >
Original file line number Diff line number Diff line change 5555 </ template >
5656 </ demo-snippet >
5757
58+ < demo-snippet id ="typeExtensionDemo ">
59+ < template is ="dom-bind ">
60+ < paper-checkbox checked ="{{checked}} "> </ paper-checkbox >
61+ < input value ="[[checked]] ">
62+ </ template >
63+ </ demo-snippet >
64+
5865 < script >
5966 suite ( 'display' , function ( ) {
6067 var emptyHeight ;
108115 expect ( markdownElement . markdown ) . to . be . equal (
109116 '```\n\n<paper-checkbox disabled></paper-checkbox>\n\n```' ) ;
110117 } ) ;
118+
119+ test ( 'elements are only rendered once when using a custom type-extension' , function ( ) {
120+ var element = document . getElementById ( 'typeExtensionDemo' ) ;
121+
122+ // Render the distributed children.
123+ Polymer . dom . flush ( ) ;
124+
125+ var inputs = element . querySelectorAll ( 'input' ) ;
126+ expect ( inputs . length ) . to . be . equal ( 1 ) ;
127+ } ) ;
128+
129+ test ( 'can support databinding between elements' , function ( done ) {
130+ var element = document . getElementById ( 'typeExtensionDemo' ) ;
131+ var input = Polymer . dom ( element ) . querySelector ( 'input' ) ;
132+ var checkbox = Polymer . dom ( element ) . querySelector ( 'paper-checkbox' )
133+
134+ // Render the distributed children.
135+ Polymer . dom . flush ( ) ;
136+
137+ checkbox . set ( 'checked' , true ) ;
138+
139+ flush ( function ( ) {
140+ expect ( checkbox . checked ) . to . be . equal ( true ) ;
141+ expect ( input . value ) . to . be . equal ( 'true' ) ;
142+ done ( ) ;
143+ } ) ;
144+ } ) ;
111145 } ) ;
112146
113147 suite ( 'parsing' , function ( ) {
You can’t perform that action at this time.
0 commit comments