| 1 | const { createUtil, createScopedPrismDom } = require('../../helper/prism-dom-util'); |
| 2 | |
| 3 | |
| 4 | describe('Show Invisibles', function () { |
| 5 | const { window } = createScopedPrismDom(this, { |
| 6 | languages: 'javascript', |
| 7 | plugins: 'show-invisibles' |
| 8 | }); |
| 9 | const util = createUtil(window); |
| 10 | |
| 11 | |
| 12 | it('should show invisible characters', function () { |
| 13 | util.assert.highlightElement({ |
| 14 | language: 'javascript', |
| 15 | code: ` \t\n\r\n\t\t`, |
| 16 | expected: `<span class="token space"> </span><span class="token space"> </span><span class="token tab">\t</span><span class="token lf">\n</span><span class="token crlf">\n</span><span class="token tab">\t</span><span class="token tab">\t</span>` |
| 17 | }); |
| 18 | }); |
| 19 | |
| 20 | it('should show invisible characters inside tokens', function () { |
| 21 | util.assert.highlightElement({ |
| 22 | language: 'javascript', |
| 23 | code: `/* \n */`, |
| 24 | expected: `<span class="token comment">/*<span class="token space"> </span><span class="token lf">\n</span><span class="token space"> </span>*/</span>` |
| 25 | }); |
| 26 | }); |
| 27 | |
| 28 | }); |