test.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* global describe */
  2. /* global it */
  3. var assert = require('assert')
  4. var rtlcss = require('../lib/rtlcss.js')
  5. var tests = {
  6. '# Background:': require('./data/background.js'),
  7. '# Background Image:': require('./data/background-image.js'),
  8. '# Background Position:': require('./data/background-position.js'),
  9. '# Properties:': require('./data/properties.js'),
  10. '# Values:': require('./data/values.js'),
  11. '# Values (N Value Syntax):': require('./data/values-n-syntax.js'),
  12. '# Transforms:': require('./data/transforms.js'),
  13. '# Transform Origin:': require('./data/transform-origin.js'),
  14. '# RTLCSS (Options):': require('./data/rtlcss-options.js'),
  15. '# RTLCSS (Directives):': require('./data/rtlcss-directives.js'),
  16. '# RTLCSS (String Map):': require('./data/rtlcss-stringMap.js'),
  17. '# RTLCSS (Plugins):': require('./data/rtlcss-plugins.js'),
  18. '# RTLCSS (Hooks):': require('./data/rtlcss-hooks.js'),
  19. '# Special:': require('./data/special.js'),
  20. '# Variables:': require('./data/variables.js')
  21. }
  22. var key
  23. for (key in tests) {
  24. var group = tests[key]
  25. describe(key, function () {
  26. for (var i = 0; i < group.length; i++) {
  27. var item = group[i]
  28. ;(function (test) {
  29. it(test.should, function (done) {
  30. assert.equal(rtlcss.process(test.input, test.options, test.plugins, test.hooks), test.expected)
  31. done()
  32. })
  33. })(item)
  34. if (item.reversable) {
  35. (function (test) {
  36. it(test.should + ' <REVERSED>', function (done) {
  37. assert.equal(rtlcss.process(test.expected, test.options, test.plugins, test.hooks), test.input)
  38. done()
  39. })
  40. })(item)
  41. }
  42. }
  43. })
  44. }