3279-empty-markdown-source.jsx 863 字节
Newer Older
K
Kyle Shockey 已提交
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 26 27 28 29 30 31 32 33 34 35 36 37
/* eslint-env mocha */
import React from "react"
import expect from "expect"
import { render } from "enzyme"
import Markdown from "components/providers/markdown"

describe("UI-3279: Empty Markdown inputs causing bare `undefined` in output", function(){
  it("should return no text for `null` as source input", function(){
    let props = {
      source: null
    }

    let el = render(<Markdown {...props}/>)

    expect(el.text()).toEqual("")
  })

  it("should return no text for `undefined` as source input", function(){
    let props = {
      source: undefined
    }

    let el = render(<Markdown {...props}/>)

    expect(el.text()).toEqual("")
  })

  it("should return no text for empty string as source input", function(){
    let props = {
      source: ""
    }

    let el = render(<Markdown {...props}/>)

    expect(el.text()).toEqual("")
  })
})