OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
swagger-ui-5.17.14
/
test
/
unit
/
components
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:33:57 AM
rwxr-xr-x
📄
filter.jsx
1.23 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
highlight-code.jsx
1.65 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
info-wrapper.jsx
1.68 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
live-response.jsx
3.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
markdown.jsx
5.43 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
online-validator-badge.jsx
2.3 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
operation-tag.jsx
1.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
operation.jsx
900 bytes
08/07/2024 04:33:56 AM
rw-r--r--
📄
operations.jsx
3.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
parameter-row.jsx
9.79 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
response-body.jsx
2.23 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
version-pragma-filter.jsx
1.96 KB
08/07/2024 04:33:56 AM
rw-r--r--
Editing: highlight-code.jsx
Close
import React from "react" import expect from "expect" import { shallow, mount } from "enzyme" import HighlightCode from "core/plugins/syntax-highlighting/components/HighlightCode" import SyntaxHighlighter from "core/plugins/syntax-highlighting/components/SyntaxHighlighter" const fakeGetConfigs = () => ({ syntaxHighlight: { activated: true, theme: "agate" }}) const fakeGetComponent = (name, isContainer) => { const components = { HighlightCode, SyntaxHighlighter } const Component = components[name] if (isContainer) { return ({ ...props }) => { return <Component getConfigs={fakeGetConfigs} getComponent={fakeGetComponent} {...props} /> } } return Component } describe("<HighlightCode />", () => { it("should render a Download button if downloadable", () => { const props = { downloadable: true, getConfigs: fakeGetConfigs, getComponent: fakeGetComponent } const wrapper = shallow(<HighlightCode {...props} />) expect(wrapper.find(".download-contents").length).toEqual(1) }) it("should render a Copy To Clipboard button if copyable", () => { const props = { canCopy: true, getConfigs: fakeGetConfigs, getComponent: fakeGetComponent } const wrapper = shallow(<HighlightCode {...props} />) expect(wrapper.find("CopyToClipboard").length).toEqual(1) }) it("should render values in a preformatted element", () => { const value = "test text" const props = { children: value , getConfigs: fakeGetConfigs, getComponent: fakeGetComponent } const wrapper = mount(<HighlightCode {...props} />) const preTag = wrapper.find("pre") expect(preTag.length).toEqual(1) expect(preTag.text()).toEqual(value) }) })