Minor changes to animation code ahead of the array animation fix#2313
Minor changes to animation code ahead of the array animation fix#2313
Conversation
etpinard
left a comment
There was a problem hiding this comment.
Thanks for the PR! I'm not sure I understand your first commit. Looking for a better explanation.
|
|
||
| if(numericNameWarningCount > 5) { | ||
| Lib.warn('addFrames: This API call has yielded too many warnings. ' + | ||
| if(numericNameWarningCount === numericNameWarningCountLimit) { |
There was a problem hiding this comment.
Explanation of 1st commit: it looked to me as though Lib.warn continued to be invoked past the 5 warnings, because I didn't see an actual condition that'd bypass this code path, so I added an extra condition in the if line. With the commit, if numericNameWarningCount >= numericNameWarningCountLimit then it doesn't descend in the if, so it won't warn there anymore. The condition for raising the "Too many warnings" is an equality check, because numericNameWarningCount is initially 0 but gets incremented past the condition check ie. before this check. If numericNameWarningCount is 5 here, then we've been through this conditional branch 5 times (with numericNameWarningCount values 1, 2, 3, 4, 5); we emit the "too many warning" things and won't come into this conditional branch again. Hope I got it right but maybe you're seeing an off-by-one error?
There was a problem hiding this comment.
Ok. That makes sense. Can we add a test for this? Using jasmine spyOn(Lib, 'warn') should make this task relatively easy.
| var thisUpdate = {}; | ||
|
|
||
| for(var ai in data[i]) { | ||
| thisUpdate[ai] = [data[i][ai]]; |
There was a problem hiding this comment.
Strange. I wonder what Ricky had in mind here. Good catch 👌
There was a problem hiding this comment.
Could've been just some initial logic that remained there.
…ddFrames` call too
| .then(function() { | ||
| // Five (`var numericNameWarningCountLimit = 5`) warnings and one warning saying that there won't be more warnings | ||
| expect(Lib.warn.calls.count()).toEqual(5 + 1); | ||
| }).catch(fail).then(done); |
|
Good stuff. Thanks for taking on the animation code. 💃 |
These should involve no actual logic change, see the commit texts.