summaryrefslogtreecommitdiff
path: root/spec/frontend/static_site_editor/rich_content_editor/services/renderers/render_attribute_definition_spec.js
blob: 6d96dd3bbca81024dc68937c52d0c3c18567f8db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import renderer from '~/static_site_editor/rich_content_editor/services/renderers/render_attribute_definition';
import { attributeDefinition } from './mock_data';

describe('rich_content_editor/renderers/render_attribute_definition', () => {
  describe('canRender', () => {
    it.each`
      input                                       | result
      ${{ literal: attributeDefinition }}         | ${true}
      ${{ literal: `FOO${attributeDefinition}` }} | ${false}
      ${{ literal: `${attributeDefinition}BAR` }} | ${false}
      ${{ literal: 'foobar' }}                    | ${false}
    `('returns $result when input is $input', ({ input, result }) => {
      expect(renderer.canRender(input)).toBe(result);
    });
  });

  describe('render', () => {
    it('returns an empty HTML comment', () => {
      expect(renderer.render()).toEqual({
        type: 'html',
        content: '<!-- sse-attribute-definition -->',
      });
    });
  });
});