-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add arrayofobjects feature #240
base: main
Are you sure you want to change the base?
Add arrayofobjects feature #240
Conversation
@@ -20,6 +20,9 @@ class ComponentAttributeDefinition { | |||
* @param {boolean} [props.required] - Attribute is required. | |||
* @param {ComponentAttributeDefinition[]} [props.definedAttributes] - Defined attributes for | |||
* this type. | |||
* @param {ComponentAttributeDefinition[]} [props.itemDefinition] - Definition of the structure | |||
* for individual array elements. | |||
* @param {string} [props.itemType] - Type of individual array elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing explanation on, type we can set on and if defined type is Object an itemDefinition must be provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/models/ComponentAttribute.js
Outdated
|
||
// eslint-disable-next-line valid-typeof | ||
return this.value.some((item) => typeof item.value !== itemType); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line valid-typeof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remote this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (this.definition.type === 'Link') { | ||
return !Array.isArray(this.value) || this.value.some((link) => typeof link !== 'string'); | ||
} | ||
let typeofvalue = typeof this.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you need esilnt disable here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was no eslint error so I didnt use it.
}; | ||
expect(componentAttribute.hasError()).toBeFalsy(); | ||
|
||
// componentAttribute.definition.rules.values = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -340,6 +347,39 @@ describe('Test class: ComponentAttribute', () => { | |||
|
|||
componentAttribute.definition.rules.values = null; | |||
}); | |||
it('Check type array of object', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to Check if item in array is valid
And add test to check hasError
return false when itemtype are not valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -307,7 +307,10 @@ describe('Test class: ComponentAttribute', () => { | |||
it('Check if respect all conditions', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put test with according class (in commit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. | |||
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) | |||
## [Unreleased] | |||
|
|||
### Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing guides migration update, to explain that now with have to set itemtype on Array type with some examples. Please read other migration guide to know how to write it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
changelog.md
Outdated
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. | |||
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) | |||
## [Unreleased] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing break line before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
changelog.md
Outdated
|
||
### Changed | ||
|
||
- Change `__typeOfValueValidation` in `ComponentAttribute`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation what chane is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
a6fb187
to
1910d0c
Compare
acf6835
to
790681a
Compare
790681a
to
7c1a9ee
Compare
No description provided.