From 9d2af0b13192c4c0763009d9a8b3906e96c3c5ce Mon Sep 17 00:00:00 2001 From: Dom Harrington Date: Mon, 13 Aug 2018 13:33:02 -0700 Subject: [PATCH] Make sure to use custom Description component so we have markdown --- example/swagger-files/types.json | 4 ++++ packages/api-explorer/__tests__/Params.test.jsx | 11 +++++++++++ packages/api-explorer/dist/index.js | 2 +- packages/api-explorer/src/Params.jsx | 4 ++-- .../src/form-components/DescriptionField.jsx | 10 +++++----- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/example/swagger-files/types.json b/example/swagger-files/types.json index 8a7361bce..32062253d 100644 --- a/example/swagger-files/types.json +++ b/example/swagger-files/types.json @@ -26,6 +26,10 @@ "type": "string", "description": "This is a string with a description" }, + "string with markdown description": { + "type": "string", + "description": "This is a string with a **markdown** description: [link](ref:action-object)" + }, "string without description": { "type": "string" }, diff --git a/packages/api-explorer/__tests__/Params.test.jsx b/packages/api-explorer/__tests__/Params.test.jsx index 1d4e00892..ad71232a1 100644 --- a/packages/api-explorer/__tests__/Params.test.jsx +++ b/packages/api-explorer/__tests__/Params.test.jsx @@ -2,6 +2,8 @@ const React = require('react'); const { mount } = require('enzyme'); const extensions = require('@readme/oas-extensions'); +const Description = require('../src/form-components/DescriptionField'); + const createParams = require('../src/Params'); const Oas = require('../src/lib/Oas'); @@ -34,6 +36,15 @@ describe('form id attribute', () => { }); }); +test('should use custom description component', () => { + const params = mount( +
+ +
, + ); + expect(params.find(Description).length).toBe(1); +}); + test('boolean should render as