background.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. module.exports = [
  2. {
  3. 'should': 'Should treat 0 as 0%',
  4. 'expected': '.banner { background: 100% top url(topbanner.png) #00D repeat-y fixed; }',
  5. 'input': '.banner { background: 0 top url(topbanner.png) #00D repeat-y fixed; }',
  6. 'reversable': false
  7. },
  8. {
  9. 'should': 'Should complement percentage horizontal position',
  10. 'expected': '.banner { background: 81% top url(topbanner.png) #00D repeat-y fixed; }',
  11. 'input': '.banner { background: 19% top url(topbanner.png) #00D repeat-y fixed; }',
  12. 'reversable': true
  13. },
  14. {
  15. 'should': 'Should complement calc horizontal position',
  16. 'expected': '.banner { background: calc(100% - (19% + 2px)) top url(topbanner.png) #00D repeat-y fixed; }',
  17. 'input': '.banner { background: calc(19% + 2px) top url(topbanner.png) #00D repeat-y fixed; }',
  18. 'reversable': false
  19. },
  20. {
  21. 'should': 'Should mirror keyword horizontal position',
  22. 'expected': '.banner { background: right top url(topbanner.png) #00D repeat-y fixed; }',
  23. 'input': '.banner { background: left top url(topbanner.png) #00D repeat-y fixed; }',
  24. 'reversable': true
  25. },
  26. {
  27. 'should': 'Should mirror keyword horizontal position (with value)',
  28. 'expected': '.banner { background: #00D url(topbanner.png) no-repeat top 50% left 16px; }',
  29. 'input': '.banner { background: #00D url(topbanner.png) no-repeat top 50% right 16px; }',
  30. 'reversable': true
  31. },
  32. {
  33. 'should': 'Should not process string map in url (default)',
  34. 'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  35. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  36. 'reversable': true
  37. },
  38. {
  39. 'should': 'Should process string map in url (processUrls:true)',
  40. 'expected': '.banner { background: 10px top url(rtl-top-left-banner.png) #00D repeat-y fixed; }',
  41. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  42. 'reversable': true,
  43. 'options': { 'processUrls': true }
  44. },
  45. {
  46. 'should': 'Should process string map in url (processUrls:{decl:true})',
  47. 'expected': '.banner { background: 10px top url(rtl-top-left-banner.png) #00D repeat-y fixed; }',
  48. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  49. 'reversable': true,
  50. 'options': { 'processUrls': { 'decl': true } }
  51. },
  52. {
  53. 'should': 'Should not process string map in url (processUrls:{atrule:true})',
  54. 'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  55. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  56. 'reversable': true,
  57. 'options': { 'processUrls': { 'atrule': true } }
  58. },
  59. {
  60. 'should': 'Should not swap bright:bleft, ultra:urtla',
  61. 'expected': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  62. 'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  63. 'reversable': true
  64. },
  65. {
  66. 'should': 'Should swap bright:bleft, ultra:urtla (processUrls: true, greedy)',
  67. 'expected': '.banner { background: 10px top url(urtla/bleft.png) #00D repeat-y fixed; }',
  68. 'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  69. 'reversable': true,
  70. 'options': { 'processUrls': true, 'greedy': true }
  71. },
  72. {
  73. 'should': 'Should not flip hex colors ',
  74. 'expected': '.banner { background: #ff0; }',
  75. 'input': '.banner { background: #ff0; }',
  76. 'reversable': true
  77. },
  78. {
  79. 'should': 'Should treat 0 as 0% (url first)',
  80. 'expected': '.banner { background: url(topbanner.png) 100% top #00D repeat-y fixed; }',
  81. 'input': '.banner { background: url(topbanner.png) 0 top #00D repeat-y fixed; }',
  82. 'reversable': false
  83. },
  84. {
  85. 'should': 'Should complement calc horizontal position (url first)',
  86. 'expected': '.banner { background: url(topbanner.png) calc(100% - (19% + 2px)) top #00D repeat-y fixed; }',
  87. 'input': '.banner { background: url(topbanner.png) calc(19% + 2px) top #00D repeat-y fixed; }',
  88. 'reversable': false
  89. }
  90. ]