diff --git a/src/components/day/Day.unit.js b/src/components/day/Day.unit.js index 313a82f212..56d404c671 100644 --- a/src/components/day/Day.unit.js +++ b/src/components/day/Day.unit.js @@ -11,7 +11,8 @@ import { comp4, comp5, comp6, - comp7 + comp7, + comp8 } from './fixtures'; import PanelComponent from '../panel/Panel'; @@ -265,6 +266,7 @@ describe('Day Component', () => { }, 500); }).catch(done); }); + it('Should translate placeholder text', () => { const element = document.createElement('div'); return Formio.createForm(element, comp7, { @@ -283,4 +285,16 @@ describe('Day Component', () => { assert.equal(dayComponent.refs.year.placeholder, 'Year3'); }) }); + + it('Should translate requiredDayField to {{ field }} is required', (done) => { + Formio.createForm(document.createElement('div'), comp8, {}).then((form) => { + const dayComponent = form.getComponent('dayTable'); + const buttonComponent = form.getComponent('submit'); + buttonComponent.refs.button.click(); + setTimeout(()=>{ + assert.equal(dayComponent.errors[0].message, 'Day - Table is required'); + done(); + },200); + }); + }); }); diff --git a/src/components/day/fixtures/comp8.js b/src/components/day/fixtures/comp8.js new file mode 100644 index 0000000000..e8a9287858 --- /dev/null +++ b/src/components/day/fixtures/comp8.js @@ -0,0 +1,38 @@ +export default { + "components": [ + { + "label": "Day - Table", + "hideInputLabels": false, + "inputsLabelPosition": "top", + "useLocaleSettings": false, + "alwaysEnabled": false, + "tableView": false, + "fields": { + "day": { + "hide": false, + "required": true + }, + "month": { + "hide": false, + "required": true + }, + "year": { + "hide": false, + "required": true + } + }, + "key": "dayTable", + "type": "day", + "input": true + }, + { + "label": "Submit", + "showValidations": false, + "alwaysEnabled": false, + "tableView": false, + "key": "submit", + "type": "button", + "input": true + } + ] +} diff --git a/src/components/day/fixtures/index.js b/src/components/day/fixtures/index.js index a94dca0b41..9b740a1c92 100644 --- a/src/components/day/fixtures/index.js +++ b/src/components/day/fixtures/index.js @@ -5,4 +5,5 @@ import comp4 from './comp4'; import comp5 from './comp5'; import comp6 from './comp6'; import comp7 from './comp7'; -export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 }; +import comp8 from './comp8'; +export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 }; diff --git a/src/translations/en.js b/src/translations/en.js index 23710ff1d1..ebf893f203 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -74,5 +74,5 @@ export default { apiKey: 'API Key is not unique: {{key}}', typeRemaining: '{{ remaining }} {{ type }} remaining.', typeCount: '{{ count }} {{ type }}', - requiredDayField: '{{field}} is required' + requiredDayField: '{{ field }} is required' };