Closed ghost closed 6 years ago
Hi, I think I would need a little more information.
$timeout
should only be used with IE/Edge. Is this what you are seeing?
A locale should be loaded initially when one of these things happen
Relevant code https://github.com/lgalfaso/angular-dynamic-locale/blob/master/dist/tmhDynamicLocale.js#L237-L239
Are you calling tmhDynamicLocaleProvider.defaultLocale(...)
?
Are you using a storage that is not the default?
If you are using the default local storage (this is based on the browser local storage). Are you cleaning the local storage between tests?
Note, you can change the storage key by doing tmhDynamicLocaleProvider.storageKey('newKey')
.
Hey @lgalfaso , first of all, thanks for the library.
I've recently integrated it with a project I'm working on and noticed that a couple karma tests we have started failing with:
deferred tasks to flush (1): {id: 0, time: 0}
It was a shared behavior between 4 components that weren't
$timeout.flush()
ing before doing adescribe
.After some digging on your library, I found that the culprit seems to be https://github.com/lgalfaso/angular-dynamic-locale/blob/master/dist/tmhDynamicLocale.js#L231 where it will trigger an unwanted $timeout even if a starting locale isn't set. Since this is inside the provider, it will be called no matter what.
Let me know if you need more information :).
Thanks!