Closed minedeljkovic closed 8 years ago
Hi @minedeljkovic ! thanks for pointing out.
Yes it's inconsistent, honestly I'm not that proud of that code, it's the fruit of too many tweaks.
Working on this...
p.s. it's difficult to find a test case that raises an inconsistent behaviour. Do you have a "failing" test case at hand?
It is not easy to write a proper test in current test suite, since it depends on setState and that requires components to be mounted. I hacked it heavily and tried to back it up with comments. You can find it here: https://github.com/minedeljkovic/tcomb-form/blob/master/test/components/Component.js#L165
I am not sure if this is helpful. :(
Thanks a lot @minedeljkovic, just pushed a fix on master
One of the consequences is that if struct or list item type has properties of types that are parsed by their own transformers (e.g. number type), and valid strings are set for those properties, case 1. will not find validation errors (since those strings are parsed by their components, when their validate method is called), but case 2. will find validation errors (since those strings are not parsed)