fix(response-body): show download button both for non-empty Blob and string responses (#9343)
Co-authored-by: Vladimír Gorej <vladimir.gorej@gmail.com> Refs #9298
This commit is contained in:
@@ -28,7 +28,6 @@ describe("<ResponseBody />", function () {
|
||||
it("renders ResponseBody as 'image/svg'", function () {
|
||||
props.contentType = "image/svg"
|
||||
const wrapper = shallow(<ResponseBody {...props} />)
|
||||
console.warn(wrapper.debug())
|
||||
expect(wrapper.find("highlightCodeComponent").length).toEqual(0)
|
||||
})
|
||||
|
||||
@@ -36,17 +35,26 @@ describe("<ResponseBody />", function () {
|
||||
props.contentType = "text/plain"
|
||||
props.content = "test text"
|
||||
const wrapper = shallow(<ResponseBody {...props} />)
|
||||
console.warn(wrapper.debug())
|
||||
expect(wrapper.find("highlightCodeComponent[canCopy]").length).toEqual(1)
|
||||
})
|
||||
|
||||
it("should render Download file link for non-empty response", function () {
|
||||
it("should render Download file link for non-empty Blob response", function () {
|
||||
props.contentType = "application/octet-stream"
|
||||
props.content = new Blob(["\"test\""], { type: props.contentType })
|
||||
const wrapper = shallow(<ResponseBody {...props} />)
|
||||
expect(wrapper.text()).toMatch(/Download file/)
|
||||
})
|
||||
|
||||
it("should render Download file link for non-empty text response", function () {
|
||||
props.contentType = "text/plain"
|
||||
props.content = "test text"
|
||||
props.headers = {
|
||||
"Content-Disposition": "attachment; filename=\"test.txt\"",
|
||||
}
|
||||
const wrapper = shallow(<ResponseBody {...props} />)
|
||||
expect(wrapper.text()).toMatch(/Download file/)
|
||||
})
|
||||
|
||||
it("should not render Download file link for empty response", function () {
|
||||
props.contentType = "application/octet-stream"
|
||||
props.content = new Blob()
|
||||
|
||||
Reference in New Issue
Block a user