testset.2.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // TESTS: Combination of model with lazy-metadata + Validation
  2. import { Validators } from '@angular/forms';
  3. const model = {
  4. field: '',
  5. fieldTwo: '',
  6. nestedGroup: {
  7. fieldA: '',
  8. validationTest: '',
  9. fieldB: 'Value 2',
  10. fieldC: 'Maybe',
  11. anotherNestedGroup: {
  12. fieldE: '',
  13. fieldF: 555,
  14. yetAnotherNestedGroup: {
  15. fieldH: true,
  16. OooOooAhhAhh: false
  17. }
  18. },
  19. z: 'THE END'
  20. }
  21. };
  22. const meta = {
  23. nestedGroup: {
  24. meta: {
  25. validationTest: {
  26. validators: [ Validators.required, Validators.minLength(4) ],
  27. // perhaps have some standard messages for standard failures in the Object.prototype ??
  28. valFailureMessages: {
  29. 'required': 'This field is required',
  30. 'minlength': 'Please type something longer'
  31. }
  32. },
  33. fieldB: { type: 'checkbutton' },
  34. fieldC: { label: 'Property Three', type: 'radio', options: ['Yes', 'No', 'Maybe'], horizontal: 1 },
  35. anotherNestedGroup: {
  36. meta: {
  37. fieldE: { type: 'radio', 'label': 'Does it work yet?', validators: Validators.required },
  38. fieldF: { type: 'datepicker' }
  39. }
  40. }
  41. }
  42. }
  43. };
  44. export { model, meta };