QUnit.module('mediawiki'); QUnit.test('Base', function(assert) { assert.expect(1); var content = [ "This is a paragraph with many text styles. This is ''italic'' and this ", "is '''bold'''; this is '''''both'''''. This is underline as is ", "this. This is '''''underlined, bold and italic'''''. ", 'This is strikethrough, as is this. Source ', 'code looks like this. Fixed width text looks like ', 'this.
This sentence is inline pre-formatted, which stops ',
    "'''''this from being bold and italic.'''''
We can also ", 'stop this from being underlined, or just try ', '<pre>interrupting cow style.
This is a blockquote
", '', '== Header 2 ==', "=== Header 3 ''with italics'' ===", '==== Header 4 ====', '===== Header 5 =====', '====== Header 6 ======', '----', '* Item 1a', '* Item 1b', '** Item 2', '*** Item 3', '* Item 1c', '# Item 1a', '# Item 1b', '## Item 2', '### Item 3', '# Item 1c', ";I don't really understand what a definition is", ': But blockquotes are easy', ':: Even larger ones', '::::: And really huge ones', ' This line is pre-formatted and not interpolated', ' This line is also pre-formatted' ].join('\n'); var expected = [ '

This is a paragraph with many text styles. This is italic and ', 'this \nis bold; this is both. This is underline', ' as is \nthis. This is underlined, bold and italic', '. \nThis is strikethrough, as is this. ', 'Source \ncode looks like this. Fixed width text looks like ', '\nthis.

This sentence is inline pre-formatted, which stops',
    " \n'''''this from being bold and italic.'''''
We can also \nstop ", '<u>this from being underlined</u>, or just try \n', '<pre>interrupting cow style.</pre>
This is a ', 'blockquote

Header 2

Header 3 with ', 'italics

Header 4

Header 5
Header 6

', '
  1. Item 1a
  2. Item 1b
  3. ', '
    1. Item 2
      1. Item 3
  4. Item 1c
', "I don't really understand what a definition is
", 'But blockquotes are easy
Even larger ones
', '
And really huge ones
', '
This line is pre-formatted ',
    'and <del>not interpolated</del>\nThis line is also ',
    'pre-formatted\n

' ].join(''); assert.equal(mediawiki.parseFromString(content).innerHTML, expected); }); QUnit.test('singleline-wikichunk', function(assert) { assert.expect(1); var content = [ "Regular line ''with italics''", "=== Header 3 ''with italics'' ===" ].join('\n'); var expected = [ '

Regular line with italics', '

Header 3 with italics

' ].join(''); assert.equal(mediawiki.parseFromString(content).innerHTML, expected); }); QUnit.test('Link', function(assert) { assert.expect(1); var content = [ "[[http://www.example.com/foo|Test text ''with formatting'']]" ].join('\n'); var expected = [ '

Test text with formatting', '

' ].join(''); assert.equal(mediawiki.parseFromString(content).innerHTML, expected); }); QUnit.test('Figure', function(assert) { assert.expect(1); var content = [ "[[File:http://www.example.com/foo|Test image ''with formatting'']]" ].join('\n'); var expected = [ '

Test image ', 'with formatting

' ].join(''); assert.equal(mediawiki.parseFromString(content).innerHTML, expected); }); QUnit.module('badpenny'); QUnit.test('Base', function(assert) { assert.expect(1); var content = [ 'foo{{value1}}bar', 'foo{{(container}}contents{{)nottheend}}more contents{{)container}}bar', 'foo{{[repeated}}testing{{]notthis}}{{)repeated}}zig{{]repeated}}bar' ].join('\n'); var expected = [ 'foovalue1bar\n', 'foocontents{{)nottheend}}more contentsbar\n', 'footesting{{]notthis}}{{)repeated}}zigbar' ].join(''); assert.equal(badpenny.parseFromString(content).innerHTML, expected); });