rtlcss-options.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. module.exports = [
  2. {
  3. 'should': 'Should not rename selectors unless a pair exits (autoRename:true,autoRenameStrict:true )',
  4. 'expected': '.right .rtl .bright .ultra { display:block; }',
  5. 'input': '.right .rtl .bright .ultra { display:block; }',
  6. 'reversable': true,
  7. 'options': { 'autoRename': true, 'autoRenameStrict': true }
  8. },
  9. {
  10. 'should': 'Should rename selectors only if a pair exits (autoRename:true,autoRenameStrict:true )',
  11. 'expected': '.left { display:block; } .right { display:none; }',
  12. 'input': '.right { display:block; } .left { display:none; }',
  13. 'reversable': true,
  14. 'options': { 'autoRename': true, 'autoRenameStrict': true }
  15. },
  16. {
  17. 'should': 'Should not rename selectors having directional decl. (default)',
  18. 'expected': '.right .rtl .bright .ultra { display:block; right:0; }',
  19. 'input': '.right .rtl .bright .ultra { display:block; left:0; }',
  20. 'reversable': true
  21. },
  22. {
  23. 'should': 'Should not auto rename selectors having no directional decl. (default)',
  24. 'expected': '.right .rtl .bright .ultra { display:block; }',
  25. 'input': '.right .rtl .bright .ultra { display:block; }',
  26. 'reversable': true
  27. },
  28. {
  29. 'should': 'Should not auto rename selectors having no directional decl. (greedy)',
  30. 'expected': '.right .rtl .bright .ultra { display:block; }',
  31. 'input': '.right .rtl .bright .ultra { display:block; }',
  32. 'reversable': true,
  33. 'options': { 'greedy': true }
  34. },
  35. {
  36. 'should': 'Should auto rename selectors having no directional decl. (autoRename:true)',
  37. 'expected': '.left .ltr .bright .ultra { display:block; }',
  38. 'input': '.right .rtl .bright .ultra { display:block; }',
  39. 'reversable': true,
  40. 'options': { 'autoRename': true }
  41. },
  42. {
  43. 'should': 'Should auto rename selectors having no directional decl. (autoRename:true,greedy)',
  44. 'expected': '.left .ltr .bleft .urtla { display:block; }',
  45. 'input': '.right .rtl .bright .ultra { display:block; }',
  46. 'reversable': true,
  47. 'options': { 'autoRename': true, 'greedy': true }
  48. },
  49. {
  50. 'should': 'Should not auto rename when rules are flipped via directives (autoRename:true)',
  51. 'expected': 'div.right { display:block; font-family: "Droid Sans", Tahoma, "Droid Arabic Kufi"; }',
  52. 'input': 'div.right { display:block; font-family: "Droid Sans", Tahoma/*!rtl:append:, "Droid Arabic Kufi"*/; }',
  53. 'reversable': false,
  54. 'options': { 'autoRename': true }
  55. },
  56. {
  57. 'should': 'Should not preserve processing directive. (default)',
  58. 'expected': 'div { left:0; }',
  59. 'input': '/*rtl:ignore*/div { left:0; }',
  60. 'reversable': false
  61. },
  62. {
  63. 'should': 'Should preserve processing directive. (clean:false)',
  64. 'expected': '/*rtl:ignore*/div { left:0; }',
  65. 'input': '/*rtl:ignore*/div { left:0; }',
  66. 'reversable': false,
  67. 'options': { 'clean': false }
  68. },
  69. {
  70. 'should': 'Should not process string map in url (default)',
  71. 'expected': 'div { background-image: url(ltr/left.png); right:0; }',
  72. 'input': 'div { background-image: url(ltr/left.png); left:0; }',
  73. 'reversable': true
  74. },
  75. {
  76. 'should': 'Should process urls (processUrls:true)',
  77. 'expected': 'div { background-image: url(rtl/right.png); right:0; }',
  78. 'input': 'div { background-image: url(ltr/left.png); left:0; }',
  79. 'reversable': true,
  80. 'options': { 'processUrls': true }
  81. },
  82. {
  83. 'should': 'Should process urls in declarations (processUrls:{decl:true})',
  84. 'expected': 'div { background-image: url(rtl/right.png); right:0; }',
  85. 'input': 'div { background-image: url(ltr/left.png); left:0; }',
  86. 'reversable': true,
  87. 'options': { 'processUrls': { 'decl': true } }
  88. },
  89. {
  90. 'should': 'Should process @import url (processUrls:true)',
  91. 'expected': 'div{display:none;} @import url("rtl/right.css");',
  92. 'input': 'div{display:none;} @import url("ltr/left.css");',
  93. 'reversable': true,
  94. 'options': { 'processUrls': true }
  95. },
  96. {
  97. 'should': 'Should process url in atrule (processUrls:{atrule:true})',
  98. 'expected': 'div{display:none;} @import url("rtl/right.css");',
  99. 'input': 'div{display:none;} @import url("ltr/left.css");',
  100. 'reversable': true,
  101. 'options': { 'processUrls': { 'atrule': true } }
  102. },
  103. {
  104. 'should': 'Should respect word boundaries when processing @import url (processUrls:true,greedy:false)',
  105. 'expected': 'div{display:none;} @import url("ultr/bright.css");',
  106. 'input': 'div{display:none;} @import url("ultr/bright.css");',
  107. 'reversable': true,
  108. 'options': { 'processUrls': true, 'greedy': false }
  109. },
  110. {
  111. 'should': 'Should not respect word boundaries when processing @import url (processUrls:true,greedy:true)',
  112. 'expected': 'div{display:none;} @import url("urtla/bleft.css");',
  113. 'input': 'div{display:none;} @import url("ultra/bright.css");',
  114. 'reversable': true,
  115. 'options': { 'processUrls': true, 'greedy': true }
  116. },
  117. {
  118. 'should': 'Should preserve comments inside declarations',
  119. 'expected': 'div { border-radius: 40.25px 10.5px /*comment*/ 10.75px 40.3px; }',
  120. 'input': 'div { border-radius: 10.5px 40.25px /*comment*/ 40.3px 10.75px; }',
  121. 'reversable': true
  122. },
  123. {
  124. 'should': 'Should flip background-position when expressed in units (useCalc:true)',
  125. 'expected': 'div { background-position: calc(100% - 10px) 0; transform-origin:calc(100% - 0.5rem) 0; }',
  126. 'input': 'div { background-position: 10px 0; transform-origin:0.5rem 0; }',
  127. 'reversable': false,
  128. 'options': { 'useCalc': true }
  129. },
  130. {
  131. 'should': 'Should flip background-position-x when expressed in units (useCalc:true)',
  132. 'expected': 'div { background-position-x: calc(100% - 10px); }',
  133. 'input': 'div { background-position-x: 10px; }',
  134. 'reversable': false,
  135. 'options': { 'useCalc': true }
  136. },
  137. {
  138. 'should': 'Should flip transform-origin when expressed in units (useCalc:true)',
  139. 'expected': 'div { transform-origin:calc(100% - 0.5rem) 2rem; }',
  140. 'input': 'div { transform-origin:0.5rem 2rem; }',
  141. 'reversable': false,
  142. 'options': { 'useCalc': true }
  143. }
  144. ]