summaryrefslogtreecommitdiff
path: root/spec/frontend/content_editor/extensions/horizontal_rule_spec.js
blob: a1bc7f0e8eddb0ba8560e25af78290d9b225b88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { hrInputRuleRegExp } from '~/content_editor/extensions/horizontal_rule';

describe('content_editor/extensions/horizontal_rule', () => {
  describe.each`
    input      | matches
    ${'---'}   | ${true}
    ${'--'}    | ${false}
    ${'---x'}  | ${false}
    ${' ---x'} | ${false}
    ${' --- '} | ${false}
    ${'x---x'} | ${false}
    ${'x---'}  | ${false}
  `('hrInputRuleRegExp', ({ input, matches }) => {
    it(`${matches ? 'matches' : 'does not match'}: "${input}"`, () => {
      const match = new RegExp(hrInputRuleRegExp).test(input);

      expect(match).toBe(matches);
    });
  });
});