Skip to content
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

test(ui): fixes default values not set TCTC-4635 #1602

Merged
merged 9 commits into from
Nov 14, 2022
Merged

Conversation

davinov
Copy link
Member

@davinov davinov commented Nov 14, 2022

For an unknown reason, the default value of a prop seemed never applied.
We found some issues about this in vue-class-component's repo, but non e of the solutions worked.
So I switched to defineComponent, which works like a charm.

@davinov davinov added the ui label Nov 14, 2022
@davinov davinov self-assigned this Nov 14, 2022
@render
Copy link

render bot commented Nov 14, 2022

},

availableVariables: {
type: Array as PropType<VariablesBucket>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are required or default to undefined? In which case `as PropType< VariablesBucket | undefined>
Same for above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure about this? Seems like the TS figures that out itself. Example:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok cool! It has been improved then! It used to be a problem

@@ -97,91 +96,161 @@ type OperatorOption = {

export const DEFAULT_FILTER = { column: '', value: '', operator: 'eq' };

@Component({
const nullOperators: Readonly<OperatorOption[]> = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Can probably be in a registry util

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by a registry util?
In a dedicated file with constants (outside the component file)?
(If yes, I agree!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! If it's OK, I prefer to do this later on, to first unblock Tucana's testswith the new version of weaverbird

Doesn't solve our pbs though
It's already run by yarn format: ci, so we can speed up eslint
@davinov davinov changed the title test(ui): fixes test of FilterSimpleCondition TCTC-4635 test(ui): fixes default values not set TCTC-4635 Nov 14, 2022
@@ -412,7 +412,7 @@ describe.skip('Widget FilterSimpleCondition', () => {
it('should not pass the variables props if hideColumnVariables is true', () => {
const customProps = {
availableVariables: ['test'],
variableDelimiters: ['test'],
variableDelimiters: {start:'te', end: 'st'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien vu!

@@ -255,7 +259,7 @@ export default defineComponent({
created() {
// In absence of condition, emit directly to the parent the default value
if (isEqual(this.value, DEFAULT_FILTER)) {
this.$emit('input', DEFAULT_FILTER);
this.$emit('input', { ...DEFAULT_FILTER });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Une raison de pas faire this.value plutôt? Ca éviterait de faire deux spread operator et la value est déjà isolée non 🤔 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu as raison, mieux vaut ne pas changer l'existant - ce n'est pas le but de cette PR. Je remet!

Copy link
Contributor

@alice-sevin alice-sevin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davinov davinov merged commit df4a5f3 into master Nov 14, 2022
@davinov davinov deleted the ui/fixes-new-build branch November 14, 2022 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants