tests.js 932 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. var data = {
  3. anchor: { arg: 'bar"baz"', expected: '<a name="bar&quot;baz&quot;">foo</a>' },
  4. big: '<big>foo</big>',
  5. blink: '<blink>foo</blink>',
  6. bold: '<b>foo</b>',
  7. fixed: '<tt>foo</tt>',
  8. fontcolor: { arg: 'blue"red"green', expected: '<font color="blue&quot;red&quot;green">foo</font>' },
  9. fontsize: { arg: '10"large"small', expected: '<font size="10&quot;large&quot;small">foo</font>' },
  10. italics: '<i>foo</i>',
  11. link: { arg: 'url"http://"', expected: '<a href="url&quot;http://&quot;">foo</a>' },
  12. small: '<small>foo</small>',
  13. strike: '<strike>foo</strike>',
  14. sub: '<sub>foo</sub>',
  15. sup: '<sup>foo</sup>'
  16. };
  17. module.exports = function (method, name, t) {
  18. var result = data[name] || {};
  19. var expected = typeof result === 'string' ? result : result.expected;
  20. var actual = typeof result === 'string' ? method('foo') : method('foo', result.arg);
  21. t.equal(actual, expected, name + ': got expected result');
  22. };