This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('when the user submits it should emit the "register-update" event', () => { | |
| const eventArgs = wrapper.emitted()['register-update'][0] | |
| expect(eventArgs).toBe(registerUserResponse) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('should display the required fields form errors', () => { | |
| expect(getFormErrorElem(wrapper).text()).toBe('Invalid Email.') | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('when the user submits it should call "handleFormSubmit" method', () => { | |
| expect(wrapper.vm.handleFormSubmit).toHaveBeenCalled() | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| import { validateEmail } from './validateEmail.js' | |
| export default { | |
| name: 'RegistrationForm', | |
| props: { | |
| termsAndConditions: { | |
| type: Boolean, | |
| default: false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| import { validateEmail } from './validateEmail.js' | |
| export default { | |
| name: 'RegistrationForm', | |
| props: { | |
| termsAndConditions: { | |
| type: Boolean, | |
| default: false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Implementation: | |
| const callIfArray = (arr, cb) => Array.isArray(arr) ? cb(arr) : arr; | |
| const flattenRec = (arr) => arr.reduce( | |
| (acc, curr) => acc.concat(callIfArray(curr, flattenRec)), | |
| [] | |
| ); | |
| const flattenArray = (arr) => callIfArray(arr, flattenRec); | |
| // Testing: | |
| const tests = [ |
NewerOlder