/* global describe it */

import {h} from 'preact';  /** @jsx h */

import { MarkdownBlock } from '../../src/views/MarkdownBlock';

import chai, {expect} from 'chai';
import assertJsx from 'preact-jsx-chai';

chai.use(assertJsx);

describe('Rendering the markdown block component', () => {
  it('with an empty string should render a blank render html', () => {
    expect(<MarkdownBlock />)
      .to.contain(<span dangerouslySetInnerHTML={{'__html': ''}} />);
  });

  it('with a plain text string should render a paragraph', () => {
    expect(<MarkdownBlock content='Just some text.' />)
      .to.contain(<span dangerouslySetInnerHTML={{'__html': '<p>Just some text.</p>\n'}} />);
  });

  it('with a header string should render the header', () => {
    expect(<MarkdownBlock content='# Hello World!' />)
      .to.contain(<span dangerouslySetInnerHTML={{'__html': '<h1>Hello World!</h1>\n'}} />);
  });

  it('with a html string should render the html bacl', () => {
    expect(<MarkdownBlock content='<img src="test.png" />' />)
      .to.contain(<span dangerouslySetInnerHTML={{'__html': '<img src="test.png" />'}} />);
  });
});
