From 833151ad1ea9811b9ecd362dc204677eeba12357 Mon Sep 17 00:00:00 2001 From: Jakub Jankowski Date: Fri, 13 Aug 2021 12:29:18 +0200 Subject: [PATCH] feat: do not wrap string validations --- .../__snapshots__/index.spec.tsx.snap | 56 +++++++++---------- src/components/shared/Validations.tsx | 6 +- .../shared/__tests__/Validations.spec.tsx | 6 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/__tests__/__snapshots__/index.spec.tsx.snap b/src/__tests__/__snapshots__/index.spec.tsx.snap index 7195bf4b..4a293ced 100644 --- a/src/__tests__/__snapshots__/index.spec.tsx.snap +++ b/src/__tests__/__snapshots__/index.spec.tsx.snap @@ -349,8 +349,8 @@ exports[`HTML Output given anyOf combiner placed next to allOf given allOf mergi
Allowed values: - \\"admin\\" - \\"editor\\" + admin + editor
@@ -562,8 +562,8 @@ exports[`HTML Output given oneOf combiner placed next to allOf given allOf mergi
Allowed values: - \\"admin\\" - \\"editor\\" + admin + editor
@@ -1006,12 +1006,12 @@ exports[`HTML Output should match arrays/of-complex-objects.json 1`] = `
Allowed value: - \\"Constant name\\" + Constant name
Example values: - \\"Example name\\" - \\"Different name\\" + Example name + Different name
@@ -1126,12 +1126,12 @@ exports[`HTML Output should match arrays/of-complex-objects.json 1`] = `
>= 2 characters
Default value: - \\"default@email.com\\" + default@email.com
Example values: - \\"one@email.com\\" - \\"two@email.com\\" + one@email.com + two@email.com
@@ -2461,9 +2461,9 @@ exports[`HTML Output should match combiners/allOfs/with-type.json 1`] = `
Allowed values: - \\"Cancel\\" - \\"Confirm\\" - \\"Update\\" + Cancel + Confirm + Update
@@ -2589,7 +2589,7 @@ exports[`HTML Output should match combiners/oneof-with-array-type.json 1`] = `
Allowed value: - \\"test\\" + test
@@ -2644,7 +2644,7 @@ exports[`HTML Output should match combiners/oneof-within-array-item.json 1`] = `
Allowed value: - \\"test\\" + test
@@ -2687,12 +2687,12 @@ exports[`HTML Output should match default-schema.json 1`] = `
Allowed value: - \\"Constant name\\" + Constant name
Example values: - \\"Example name\\" - \\"Different name\\" + Example name + Different name
@@ -2807,12 +2807,12 @@ exports[`HTML Output should match default-schema.json 1`] = `
>= 2 characters
Default value: - \\"default@email.com\\" + default@email.com
Example values: - \\"one@email.com\\" - \\"two@email.com\\" + one@email.com + two@email.com
@@ -3439,12 +3439,12 @@ exports[`HTML Output should match tickets.schema.json 1`] = `
Allowed values: - \\"COMPLETED\\" - \\"ACTIVE\\" + COMPLETED + ACTIVE
Default value: - \\"ACTIVE\\" + ACTIVE
@@ -3529,10 +3529,10 @@ exports[`HTML Output should match tickets.schema.json 1`] = `
Allowed values: - \\"HOMEPRINT\\" - \\"TICKETLESS\\" - \\"PRINT_AT_KIOSK\\" - \\"SECURE_PAPER\\" + HOMEPRINT + TICKETLESS + PRINT_AT_KIOSK + SECURE_PAPER
diff --git a/src/components/shared/Validations.tsx b/src/components/shared/Validations.tsx index f9e36ccf..d5812f39 100644 --- a/src/components/shared/Validations.tsx +++ b/src/components/shared/Validations.tsx @@ -63,11 +63,11 @@ const createValidationsFormatter = (name: string, options?: { exact?: boolean; n }; const validationFormatters: Record ValidationFormat | null> = { - enum: createValidationsFormatter('Allowed'), - examples: createValidationsFormatter('Example'), + enum: createValidationsFormatter('Allowed', { nowrap: true }), + examples: createValidationsFormatter('Example', { nowrap: true }), multipleOf: createValidationsFormatter('Multiple of', { exact: true }), pattern: createValidationsFormatter('Match pattern', { exact: true, nowrap: true }), - default: createValidationsFormatter('Default'), + default: createValidationsFormatter('Default', { nowrap: true }), }; const oasFormats = { diff --git a/src/components/shared/__tests__/Validations.spec.tsx b/src/components/shared/__tests__/Validations.spec.tsx index e7baf2f3..681e5dee 100644 --- a/src/components/shared/__tests__/Validations.spec.tsx +++ b/src/components/shared/__tests__/Validations.spec.tsx @@ -43,9 +43,9 @@ describe('Validations component', () => { const wrapper = mount(); expect(wrapper).toIncludeText('>= 2 characters<= 4 characters'); - expect(wrapper).toIncludeText('Default value:"foo"'); - expect(wrapper).toIncludeText('Example values:"Example 1""Example 2"'); - expect(wrapper).toIncludeText('Allowed value:"bar"'); + expect(wrapper).toIncludeText('Default value:foo'); + expect(wrapper).toIncludeText('Example values:Example 1Example 2'); + expect(wrapper).toIncludeText('Allowed value:bar'); }); it('should not render hidden example validations', () => {