diff --git a/test/spec/components/Feel.spec.js b/test/spec/components/Feel.spec.js index 90ee5cd2..0623e6b4 100644 --- a/test/spec/components/Feel.spec.js +++ b/test/spec/components/Feel.spec.js @@ -189,11 +189,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => null; const result = createFeelField({ container, validate }); @@ -212,11 +208,7 @@ describe('', function() { it('should set invalid', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate }); @@ -234,11 +226,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate }); @@ -256,11 +244,7 @@ describe('', function() { it('should show error message', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate }); @@ -282,11 +266,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate, setValue: setValueSpy }); @@ -691,11 +671,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v === 3) { - return 'error'; - } - }; + const validate = () => null; const result = createFeelNumber({ container, validate }); @@ -714,11 +690,7 @@ describe('', function() { it('should set invalid', function() { // given - const validate = (v) => { - if (v === 3) { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelNumber({ container, validate }); @@ -736,11 +708,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === 3) { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelNumber({ container, validate }); @@ -758,11 +726,7 @@ describe('', function() { it('should show error message', function() { // given - const validate = (v) => { - if (v === 3) { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelNumber({ container, validate }); @@ -784,11 +748,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === 3) { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelNumber({ container, validate, setValue: setValueSpy }); @@ -1151,11 +1111,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => null; const result = createFeelTextArea({ container, validate }); @@ -1174,11 +1130,7 @@ describe('', function() { it('should set invalid', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelTextArea({ container, validate }); @@ -1196,11 +1148,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelTextArea({ container, validate }); @@ -1218,11 +1166,7 @@ describe('', function() { it('should show error message', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelTextArea({ container, validate }); @@ -1244,11 +1188,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelTextArea({ container, validate, setValue: setValueSpy }); @@ -2013,11 +1953,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => null; const result = createFeelField({ container, validate, feel: 'required' }); @@ -2038,11 +1974,7 @@ describe('', function() { it('should set invalid', async function() { // given - const validate = (v) => { - if (v === '=bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate, feel: 'required' }); @@ -2065,11 +1997,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === '=bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate, feel: 'required' }); @@ -2089,11 +2017,7 @@ describe('', function() { it('should show error message', async function() { // given - const validate = (v) => { - if (v === '=bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelField({ container, validate, feel: 'required' }); @@ -2119,11 +2043,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === '=bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createFeelTextArea({ container, validate, setValue: setValueSpy, feel: 'required' }); diff --git a/test/spec/components/NumberField.spec.js b/test/spec/components/NumberField.spec.js index f5bf98bc..efcef73f 100644 --- a/test/spec/components/NumberField.spec.js +++ b/test/spec/components/NumberField.spec.js @@ -208,11 +208,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v % 2 !== 0) { - return 'should be even'; - } - }; + const validate = () => null; const result = createNumberField({ container, validate }); @@ -221,7 +217,7 @@ describe('', function() { const input = domQuery('.bio-properties-panel-input', entry); // when - changeInput(input, 2); + changeInput(input, 1); // then expect(isValid(entry)).to.be.true; @@ -231,11 +227,7 @@ describe('', function() { it('should set invalid', function() { // given - const validate = (v) => { - if (v % 2 !== 0) { - return 'should be even'; - } - }; + const validate = () => 'error'; const result = createNumberField({ container, validate }); @@ -243,7 +235,7 @@ describe('', function() { const input = domQuery('.bio-properties-panel-input', entry); // when - changeInput(input, 3); + changeInput(input, 1); // then expect(isValid(entry)).to.be.false; @@ -253,11 +245,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v % 2 !== 0) { - return 'should be even'; - } - }; + const validate = () => 'error'; const result = createNumberField({ container, validate }); @@ -265,21 +253,17 @@ describe('', function() { const input = domQuery('.bio-properties-panel-input', entry); // when - changeInput(input, 3); + changeInput(input, 1); // then - expect(input.value).to.eql('3'); + expect(input.value).to.eql('1'); }); it('should show error message', function() { // given - const validate = (v) => { - if (v % 2 !== 0) { - return 'should be even'; - } - }; + const validate = () => 'error'; const result = createNumberField({ container, validate }); @@ -287,24 +271,20 @@ describe('', function() { const input = domQuery('.bio-properties-panel-input', entry); // when - changeInput(input, 3); + changeInput(input, 1); const error = domQuery('.bio-properties-panel-error', entry); // then expect(error).to.exist; - expect(error.innerText).to.eql('should be even'); + expect(error.innerText).to.eql('error'); }); it('should pass error to `setValue`', function() { // given - const validate = (v) => { - if (v % 2 !== 0) { - return 'should be even'; - } - }; + const validate = () => 'error'; const setValueSpy = sinon.spy(); @@ -315,7 +295,7 @@ describe('', function() { changeInput(entry, 1); // then - expect(setValueSpy).to.have.been.calledWith(1, 'should be even'); + expect(setValueSpy).to.have.been.calledWith(1, 'error'); }); }); diff --git a/test/spec/components/Select.spec.js b/test/spec/components/Select.spec.js index 0fd30fc4..cce52375 100644 --- a/test/spec/components/Select.spec.js +++ b/test/spec/components/Select.spec.js @@ -323,11 +323,7 @@ describe('', function() { // when - changeInput(select, 'B'); + changeInput(select, 'A'); // then expect(isValid(entry)).to.be.true; @@ -348,11 +344,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === 'A') { - return 'error'; - } - }; + const validate = () => 'error'; const getOptions = () => createOptions(); @@ -396,11 +384,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === 'A') { - return 'error'; - } - }; + const validate = () => 'error'; const getOptions = () => createOptions(); const result = createSelect({ container, validate, getOptions, setValue: setValueSpy }); diff --git a/test/spec/components/Templating.spec.js b/test/spec/components/Templating.spec.js index a1e9e0ee..97787f8f 100644 --- a/test/spec/components/Templating.spec.js +++ b/test/spec/components/Templating.spec.js @@ -295,11 +295,7 @@ describe('', function() { it('should set valid', function() { // given - const validate = (v) => { - if (v === '{{bar}}') { - return 'error'; - } - }; + const validate = () => null; const result = createTemplatingEntry({ container, validate }); @@ -320,11 +316,7 @@ describe('', function() { it('should set invalid', async function() { // given - const validate = (v) => { - if (v === '{{bar}}') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createTemplatingEntry({ container, validate }); @@ -344,11 +336,7 @@ describe('', function() { it('should keep showing invalid value', function() { // given - const validate = (v) => { - if (v === '{{bar}}') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createTemplatingEntry({ container, validate }); @@ -368,11 +356,7 @@ describe('', function() { it('should show error message', async function() { // given - const validate = (v) => { - if (v === 'bar') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createTemplatingEntry({ container, validate }); @@ -395,11 +379,7 @@ describe('', function() { // given const setValueSpy = sinon.spy(); - const validate = (v) => { - if (v === '{{bar}}') { - return 'error'; - } - }; + const validate = () => 'error'; const result = createTemplatingEntry({ container, validate, setValue: setValueSpy }); diff --git a/test/spec/components/TextArea.spec.js b/test/spec/components/TextArea.spec.js index 4f8ac647..9e82d7f1 100644 --- a/test/spec/components/TextArea.spec.js +++ b/test/spec/components/TextArea.spec.js @@ -309,11 +309,7 @@ describe('