From 677e572eafbd8bfff2085ba8b943fdbe01bd1c1a Mon Sep 17 00:00:00 2001 From: Derek P Sifford Date: Sat, 9 Dec 2017 17:58:12 -0500 Subject: [PATCH] improve required format messages for manual data fields. closes #388 --- lib/before-test.ts | 4 +- lib/types/ABT.d.ts | 5 +- package.json | 2 +- src/js/dialogs/add/meta-fields.tsx | 11 +- .../__snapshots__/result-list-test.tsx.snap | 2 + .../pubmed/__tests__/result-list-test.tsx | 5 +- .../reference-list-test.tsx.snap | 14 +- src/php/fieldmaps.php | 342 ++++-------------- 8 files changed, 85 insertions(+), 300 deletions(-) diff --git a/lib/before-test.ts b/lib/before-test.ts index 60f179fb..c911c8f8 100644 --- a/lib/before-test.ts +++ b/lib/before-test.ts @@ -3,8 +3,8 @@ const { configure } = require('enzyme'); import * as Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); -const { i18n, state, wpInfo } = require('../fixtures.ts'); -const styles = require('../../src/vendor/citation-styles.json'); +const { i18n, state, wpInfo } = require('./fixtures.ts'); +const styles = require('../src/vendor/citation-styles.json'); window.ABT = { state, diff --git a/lib/types/ABT.d.ts b/lib/types/ABT.d.ts index 3eaa11c9..432e4fe3 100644 --- a/lib/types/ABT.d.ts +++ b/lib/types/ABT.d.ts @@ -97,12 +97,9 @@ declare namespace ABT { | 'translator' | 'recipient'; - interface Field { + interface Field extends React.HTMLAttributes { value: string; label: string; - required: boolean; - pattern: string; - placeholder: string; } interface FieldMap { diff --git a/package.json b/package.json index fe81661e..5ecb9242 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "mapCoverage": true, "moduleDirectories": ["node_modules", "./src/js"], "moduleFileExtensions": ["ts", "tsx", "js"], - "setupFiles": ["raf/polyfill", "./lib/scripts/before-test.ts"], + "setupFiles": ["raf/polyfill", "./lib/before-test.ts"], "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", "transform": { ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" diff --git a/src/js/dialogs/add/meta-fields.tsx b/src/js/dialogs/add/meta-fields.tsx index c31fc03c..0fedc164 100644 --- a/src/js/dialogs/add/meta-fields.tsx +++ b/src/js/dialogs/add/meta-fields.tsx @@ -61,17 +61,16 @@ interface FieldProps { class Field extends React.Component { render(): JSX.Element { const { onChange, field, meta } = this.props; + const { label, value, ...attrs } = field; return (
-