Comments (9)
Ember.run.cancel to cancel anything outstanding on the run loop queue. It's something you want to get into the habit with testing.
from ember-moment.
@jasonmit Perhaps I misunderstood you, or you misunderstood me...
the testing code looks like this:
test: function() {
visit("/pending-users");
andThen(function() {
assert(...page contains what is expected...);
}
}
Where would I place the cancel? The only place that makes sense is between the visit
to the andThen
.
What timer should I pass to the cancel? it accepts a parameter, but there is no way to know the runlater timer set by ember-moment.
Attempting to use instead the (private) method Ember.run.cancelTimers()
failed even more tests... I did not debug exactly why.
from ember-moment.
@Iftahh sorry, I do think I misunderstood. Is your project public so I can step through this?
@stefanpenner have anything better in mind than replacing the Ember.run.later with setTimeout + Ember.run?
https://github.com/stefanpenner/ember-moment/blob/master/addon/helpers/moment-from-now.js#L12
from ember-moment.
@jasonmit seems like the timer should be canceled in destroy()
of that helper
from ember-moment.
👍 will fix shortly
from ember-moment.
that wont help the above issue, as the timerwaiters in the test helpers are not granular enough.
The solution in ember will land shortly have async/await is supported in jshint, which will revamp the test helpers. Long story, upside @teddyzeenny and myself spike it was ember conf, it was wonderful and glorious but was blocked on tooling (just jshint) support, and stage 2 TC39 support.
In the interim: you should work-around this, by doing both: #80 (comment)
and the suggested raw setTimeout + Ember.run trick, which wont insert a test waiter, like run.later will.
from ember-moment.
Thank you @jasonmit and @stefanpenner for your quick responses and fix !
@jasonmit my code isn't open source but you should be able to reproduce it very easily -
use ember cli to generate acceptance-test and visit a page containing moment-from-now
helper somewhere in the template - that should be enough.
from ember-moment.
3.5.1 published, take it for a spin and report if this issue persists.
P.S., I only fixed this because of your avatar photo.
from ember-moment.
Thanks @jasonmit
from ember-moment.
Related Issues (20)
- Timezone doesn't apply HOT 3
- [ember-moment] attempted to set timezone, but moment-timezone is not setup. HOT 2
- "Invalid date" in Safari HOT 1
- Using ember-moment in Ember 3.18 fails to produce production build HOT 8
- When calling `deprecate` you must provide `for` in options. Missing options.for in "ember-moment.addon.helpers.moment-to-now" deprecation
- Import `computed.bool` from the right package HOT 8
- error starting ember with ember-moment HOT 1
- Ember Global deprecation warning due to old version of ember-cli-babel
- `services/moment.js` bug in `defaultFormat` HOT 3
- moment-timezone dependency added HOT 5
- toggling locales does not take effect
- Is ember-cli-moment-shim still required for ember-moment? HOT 3
- Timezone not accesible after upgrading to version 9 HOT 2
- Environment configuration does not work as documented HOT 3
- Update dependency `@embroider/addon-shim` to `^1.0.0`
- Display an optional message when date is null/invalid/undefined
- Documentation incorrect for environment settings HOT 1
- ember-moment is trying to import from ember-cli-moment-shim but that is not one of its explicit dependencies Error thrown while using Embroider compat build HOT 15
- Error importing moment-timezone with ember-auto-import 2.6.2 HOT 3
- Error: Could not find module `moment` imported from `(require)` on Ember 4.12 during embroider-safe scenario HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-moment.