rtlcss-stringMap.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. module.exports = [
  2. {
  3. 'should': 'Should rename "left", "Left", "LEFT" (autoRename:true). ',
  4. 'expected': 'div.right, div.Right, div.RIGHT, div.respectLeft { width:10px;}',
  5. 'input': 'div.left, div.Left, div.LEFT, div.respectLeft { width:10px;}',
  6. 'reversable': true,
  7. 'options': { 'autoRename': true }
  8. },
  9. {
  10. 'should': 'Should rename "left", "Left", "LEFT" (autoRename:true, greedy). ',
  11. 'expected': 'div.right, div.Right, div.RIGHT, div.respectRight { width:10px;}',
  12. 'input': 'div.left, div.Left, div.LEFT, div.respectLeft { width:10px;}',
  13. 'reversable': true,
  14. 'options': {
  15. 'autoRename': true,
  16. 'greedy': true
  17. }
  18. },
  19. {
  20. 'should': 'Should rename "ltr", "Ltr", "LTR" (autoRename:true). ',
  21. 'expected': 'div.rtl, div.Rtl, div.RTL, div.Ultra { width:10px;}',
  22. 'input': 'div.ltr, div.Ltr, div.LTR, div.Ultra { width:10px;}',
  23. 'reversable': true,
  24. 'options': { 'autoRename': true }
  25. },
  26. {
  27. 'should': 'Should rename "ltr", "Ltr", "LTR" (autoRename:true, greedy). ',
  28. 'expected': 'div.rtl, div.Rtl, div.RTL, div.Urtla { width:10px;}',
  29. 'input': 'div.ltr, div.Ltr, div.LTR, div.Ultra { width:10px;}',
  30. 'reversable': true,
  31. 'options': {
  32. 'autoRename': true,
  33. 'greedy': true
  34. }
  35. },
  36. {
  37. 'should': 'Should rename "prev"/"next" (autoRename:true, custom stringMap - *)',
  38. 'expected': 'div.next, div.Right { width:10px;}',
  39. 'input': 'div.prev, div.Left { width:10px;}',
  40. 'reversable': true,
  41. 'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
  42. },
  43. {
  44. 'should': 'Should rename "prev"/"next" (autoRename:true, custom stringMap - selector)',
  45. 'expected': 'div.next, div.Right { width:10px;}',
  46. 'input': 'div.prev, div.Left { width:10px;}',
  47. 'reversable': true,
  48. 'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'selector' } }] }
  49. },
  50. {
  51. 'should': 'Should not rename "prev"/"next" (autoRename:true, custom stringMap - url)',
  52. 'expected': 'div.prev, div.Right { width:10px;}',
  53. 'input': 'div.prev, div.Left { width:10px;}',
  54. 'reversable': true,
  55. 'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
  56. },
  57. {
  58. 'should': 'Should not swap "prev"/"next" in Url or Selector (autoRename:true, custom stringMap - url)',
  59. 'expected': 'div.prev { background-image: url(/content/pix/prev.png);}',
  60. 'input': 'div.prev { background-image: url(/content/pix/prev.png);}',
  61. 'reversable': true,
  62. 'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
  63. },
  64. {
  65. 'should': 'Should not swap "prev"/"next" in Url and Rename in selector (autoRename:true, custom stringMap - *)',
  66. 'expected': 'div.next { display:block }; div.next { background-image: url(/content/pix/next.png);}',
  67. 'input': 'div.prev { display:block }; div.prev { background-image: url(/content/pix/next.png);}',
  68. 'reversable': true,
  69. 'options': { 'autoRename': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
  70. },
  71. {
  72. 'should': 'Should swap "prev"/"next" in Url (autoRename:true, processUrls:true)',
  73. 'expected': 'div.prev { background-image: url(/content/pix/next.png);}',
  74. 'input': 'div.prev { background-image: url(/content/pix/prev.png);}',
  75. 'reversable': true,
  76. 'options': { 'autoRename': true, 'processUrls': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: 'url' } }] }
  77. },
  78. {
  79. 'should': 'Should swap "prev"/"next" in Url and Rename in selector (autoRename:true, processUrls:true)',
  80. 'expected': 'div.next { display:block }; div.prev { background-image: url(/content/pix/prev.png);}',
  81. 'input': 'div.prev { display:block }; div.prev { background-image: url(/content/pix/next.png);}',
  82. 'reversable': true,
  83. 'options': { 'autoRename': true, 'processUrls': true, 'stringMap': [{ 'search': 'prev', 'replace': 'next', 'options': { scope: '*' } }] }
  84. },
  85. {
  86. 'should': 'Should rename "previous" to "nextious" (autoRename:true, greedy: true)',
  87. 'expected': 'div.nextious{ width:10px;}',
  88. 'input': 'div.previous{ width:10px;}',
  89. 'reversable': true,
  90. 'options': { 'autoRename': true, 'stringMap': [{ 'name': 'prev-next', 'search': 'prev', 'replace': 'next', 'options': { 'greedy': true } }] }
  91. },
  92. {
  93. 'should': 'Should escape strings used in stringMap (processUrls: true, custom stringMap)',
  94. 'expected': '@import url("//a.b/c-rtl.css"); @import url("//a.b/css");',
  95. 'input': '@import url("//a.b/c.css"); @import url("//a.b/css");',
  96. 'reversable': true,
  97. 'options': { 'processUrls': true, 'stringMap': [{ 'name': 'import-stylesheet', 'priority': 1, 'exclusive': true, 'search': ['.css'], 'replace': ['-rtl.css'], 'options': { 'scope': 'url' } }] }
  98. }
  99. ]