background.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 not process string map in url (default)',
  28. 'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  29. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  30. 'reversable': true
  31. },
  32. {
  33. 'should': 'Should process string map in url (processUrls:true)',
  34. 'expected': '.banner { background: 10px top url(rtl-top-left-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. 'options': { 'processUrls': true }
  38. },
  39. {
  40. 'should': 'Should process string map in url (processUrls:{decl:true})',
  41. 'expected': '.banner { background: 10px top url(rtl-top-left-banner.png) #00D repeat-y fixed; }',
  42. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  43. 'reversable': true,
  44. 'options': { 'processUrls': { 'decl': true } }
  45. },
  46. {
  47. 'should': 'Should not process string map in url (processUrls:{atrule:true})',
  48. 'expected': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  49. 'input': '.banner { background: 10px top url(ltr-top-right-banner.png) #00D repeat-y fixed; }',
  50. 'reversable': true,
  51. 'options': { 'processUrls': { 'atrule': true } }
  52. },
  53. {
  54. 'should': 'Should not swap bright:bleft, ultra:urtla',
  55. 'expected': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  56. 'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  57. 'reversable': true
  58. },
  59. {
  60. 'should': 'Should swap bright:bleft, ultra:urtla (processUrls: true, greedy)',
  61. 'expected': '.banner { background: 10px top url(urtla/bleft.png) #00D repeat-y fixed; }',
  62. 'input': '.banner { background: 10px top url(ultra/bright.png) #00D repeat-y fixed; }',
  63. 'reversable': true,
  64. 'options': { 'processUrls': true, 'greedy': true }
  65. },
  66. {
  67. 'should': 'Should not flip hex colors ',
  68. 'expected': '.banner { background: #ff0; }',
  69. 'input': '.banner { background: #ff0; }',
  70. 'reversable': true
  71. },
  72. {
  73. 'should': 'Should treat 0 as 0% (url first)',
  74. 'expected': '.banner { background: url(topbanner.png) 100% top #00D repeat-y fixed; }',
  75. 'input': '.banner { background: url(topbanner.png) 0 top #00D repeat-y fixed; }',
  76. 'reversable': false
  77. },
  78. {
  79. 'should': 'Should complement calc horizontal position (url first)',
  80. 'expected': '.banner { background: url(topbanner.png) calc(100% - (19% + 2px)) top #00D repeat-y fixed; }',
  81. 'input': '.banner { background: url(topbanner.png) calc(19% + 2px) top #00D repeat-y fixed; }',
  82. 'reversable': false
  83. }
  84. ]