@@ -431,5 +431,120 @@ describe('Static Prefixer', () => {
431431 expect ( prefix ( input ) ) . toEqual ( output )
432432 } )
433433 } )
434+
435+ describe ( 'grid' , ( ) => {
436+ it ( 'should prefix display values' , ( ) => {
437+ const input = { display : 'grid' }
438+ const inlineInput = { display : 'inline-grid' }
439+ const output = { display : [ '-ms-grid' , 'grid' ] }
440+ const inlineOutput = { display : [ '-ms-inline-grid' , 'inline-grid' ] }
441+ expect ( prefix ( input ) ) . toEqual ( output )
442+ expect ( prefix ( inlineInput ) ) . toEqual ( inlineOutput )
443+ } )
444+
445+ it ( 'should prefix basic alignment values' , ( ) => {
446+ const input = { alignSelf : 'stretch' , justifySelf : 'end' }
447+ const output = {
448+ WebkitAlignSelf : 'stretch' ,
449+ alignSelf : 'stretch' ,
450+ justifySelf : 'end' ,
451+ msFlexItemAlign : 'stretch' ,
452+ msGridColumnAlign : 'end' ,
453+ msGridRowAlign : 'stretch' ,
454+ }
455+ expect ( prefix ( input ) ) . toEqual ( output )
456+ } )
457+
458+ describe ( 'template' , ( ) => {
459+ it ( 'should prefix column templating' , ( ) => {
460+ const input = { gridTemplateColumns : '1fr auto' }
461+ const output = {
462+ gridTemplateColumns : '1fr auto' ,
463+ msGridColumns : '1fr auto' ,
464+ }
465+ expect ( prefix ( input ) ) . toEqual ( output )
466+ } )
467+
468+ it ( 'should prefix row templating' , ( ) => {
469+ const input = { gridTemplateRows : '1fr auto' }
470+ const output = {
471+ gridTemplateRows : '1fr auto' ,
472+ msGridRows : '1fr auto' ,
473+ }
474+ expect ( prefix ( input ) ) . toEqual ( output )
475+ } )
476+
477+ it ( 'should prefix templating even with named grid lines' , ( ) => {
478+ const input = { gridTemplateColumns : '1fr [header content] auto' }
479+ const output = {
480+ gridTemplateColumns : '1fr [header content] auto' ,
481+ msGridColumns : '1fr [header content] auto' ,
482+ }
483+ expect ( prefix ( input ) ) . toEqual ( output )
484+ } )
485+ } )
486+
487+ describe ( 'positions' , ( ) => {
488+ it ( 'should prefix a cell with numerical start and end column values' , ( ) => {
489+ const input = { gridColumnStart : 2 , gridColumnEnd : 5 }
490+ const output = {
491+ gridColumnEnd : 5 ,
492+ gridColumnStart : 2 ,
493+ msGridColumn : 2 ,
494+ msGridColumnSpan : 3 ,
495+ }
496+ expect ( prefix ( input ) ) . toEqual ( output )
497+ } )
498+
499+ it ( 'should prefix a cell with numerical start and end row values' , ( ) => {
500+ const input = { gridRowStart : 3 , gridRowEnd : 7 }
501+ const output = {
502+ gridRowEnd : 7 ,
503+ gridRowStart : 3 ,
504+ msGridRow : 3 ,
505+ msGridRowSpan : 4 ,
506+ }
507+ expect ( prefix ( input ) ) . toEqual ( output )
508+ } )
509+
510+ it ( 'should not prefix a cell with non-numerical position values' , ( ) => {
511+ const input = { gridRowStart : 'span 3' , gridRowEnd : 5 }
512+ const output = {
513+ gridRowEnd : 5 ,
514+ gridRowStart : 'span 3' ,
515+ }
516+ expect ( prefix ( input ) ) . toEqual ( output )
517+ } )
518+
519+ it ( 'should expand the shorthand column syntax' , ( ) => {
520+ const input = { gridColumn : '3 / 5' }
521+ const output = {
522+ gridColumn : '3 / 5' ,
523+ msGridColumn : 3 ,
524+ msGridColumnSpan : 2 ,
525+ }
526+ expect ( prefix ( input ) ) . toEqual ( output )
527+ } )
528+
529+ it ( 'should expand the shorthand row syntax' , ( ) => {
530+ const input = { gridRow : '2 / 7' }
531+ const output = {
532+ gridRow : '2 / 7' ,
533+ msGridRow : 2 ,
534+ msGridRowSpan : 5 ,
535+ }
536+ expect ( prefix ( input ) ) . toEqual ( output )
537+ } )
538+
539+ it ( 'should not expand non-numerical values' , ( ) => {
540+ const input = { gridRow : '2 / span 3' }
541+ const output = {
542+ gridRow : '2 / span 3' ,
543+ msGridRow : 2 ,
544+ }
545+ expect ( prefix ( input ) ) . toEqual ( output )
546+ } )
547+ } )
548+ } )
434549 } )
435550} )
0 commit comments