@@ -237,6 +237,70 @@ describe('Parser', () => {
237
237
238
238
} ) ;
239
239
240
+ describe ( 'Booleans' , ( ) => {
241
+ describe ( 'Attributes' , ( ) => {
242
+
243
+ it ( 'handles true as a string' , ( ) => {
244
+ const bool = true ;
245
+ const template = rml `<div something="${ bool } ">Hello</div>` ;
246
+
247
+ expect ( template ) . toEqual ( `<div something="true">Hello</div>` ) ;
248
+ } ) ;
249
+
250
+ it ( 'handles false as a string' , ( ) => {
251
+ const bool = false ;
252
+ const template = rml `<div something="${ bool } ">Hello</div>` ;
253
+
254
+ expect ( template ) . toEqual ( `<div something="false">Hello</div>` ) ;
255
+ } ) ;
256
+
257
+ } ) ;
258
+
259
+ describe ( 'Content' , ( ) => {
260
+
261
+ it ( 'handles true as a string' , ( ) => {
262
+ const bool = true ;
263
+ const template = rml `<div>${ bool } </div>` ;
264
+
265
+ expect ( template ) . toEqual ( `<div>${ bool } </div>` ) ;
266
+ } ) ;
267
+
268
+ it ( 'handles false as a string' , ( ) => {
269
+ const bool = false ;
270
+ const template = rml `<div>${ bool } </div>` ;
271
+
272
+ expect ( template ) . toEqual ( `<div>${ bool } </div>` ) ;
273
+ } ) ;
274
+
275
+ } ) ;
276
+
277
+ } ) ;
278
+
279
+ describe . skip ( 'Symbols' , ( ) => {
280
+ describe ( 'Attributes' , ( ) => {
281
+
282
+ it ( 'handles symbols as strings' , ( ) => {
283
+ const sym = Symbol ( 'test' ) ;
284
+ const template = rml `<div something="${ sym } ">Hello</div>` ;
285
+
286
+ expect ( template ) . toEqual ( `<div something="${ sym . toString ( ) } ">Hello</div>` ) ;
287
+ } ) ;
288
+
289
+ } ) ;
290
+
291
+ describe ( 'Content' , ( ) => {
292
+
293
+ it ( 'handles symbols as strings' , ( ) => {
294
+ const sym = Symbol ( 'test' ) ;
295
+ const template = rml `<div>${ sym } </div>` ;
296
+
297
+ expect ( template ) . toEqual ( `<div>${ sym . toString ( ) } </div>` ) ;
298
+ } ) ;
299
+
300
+ } ) ;
301
+
302
+ } ) ;
303
+
240
304
} ) ;
241
305
242
306
describe ( 'Sources' , ( ) => {
@@ -384,6 +448,28 @@ describe('Parser', () => {
384
448
) ;
385
449
} ) ;
386
450
451
+ it ( 'always defers onmount' , ( ) => {
452
+ const fn = ( ) => alert ( 123 ) ;
453
+ const a = { 'onmount' : fn } ;
454
+ const template = rml `<div ...${ a } >Hello</div>` ;
455
+
456
+ expect ( template ) . toMatch ( / < d i v .* r e s o l v e = " R M L R E F \+ 0 " .* > H e l l o < \/ d i v > / ) ;
457
+ expect ( waitingElementHanlders . get ( 'RMLREF+0' ) ! [ 0 ] ) . toStrictEqual (
458
+ { type : 'sink' , t : 'mixin' , source : { 'onmount' : fn } , sink : AttributeObjectSink } ,
459
+ ) ;
460
+ } ) ;
461
+
462
+ it ( 'always defers rml:onmount' , ( ) => {
463
+ const fn = ( ) => alert ( 123 ) ;
464
+ const a = { 'rml:onmount' : fn } ;
465
+ const template = rml `<div ...${ a } >Hello</div>` ;
466
+
467
+ expect ( template ) . toMatch ( / < d i v .* r e s o l v e = " R M L R E F \+ 0 " .* > H e l l o < \/ d i v > / ) ;
468
+ expect ( waitingElementHanlders . get ( 'RMLREF+0' ) ! [ 0 ] ) . toStrictEqual (
469
+ { type : 'sink' , t : 'mixin' , source : { 'rml:onmount' : fn } , sink : AttributeObjectSink } ,
470
+ ) ;
471
+ } ) ;
472
+
387
473
} ) ;
388
474
389
475
0 commit comments