-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fixes #1047: preventDefault() #1122
Fixes #1047: preventDefault() #1122
Conversation
dfb7ad6
to
124cbed
Compare
so we don't download the actual file
124cbed
to
f09eaed
Compare
This test failure is a weird one! I've spent some time looking into it, and I can't quite figure it out. I actually don't think that the test failure has to do with the fact that the test causes a file to be downloaded. The first commit in this PR called
It looks like it's this line that's failing: a.attributes().download.should.equal('trees 20241231012345.csv'); In other words, the Another strange thing I noticed is that if I remove the Sinon timer, the -const clock = sinon.useFakeTimers(Date.parse('2024-12-31T01:23:45')); The test still fails, because the There also seems to be something going on with test order:
I really don't see anything weird about the other test in the Otherwise, I think it makes sense to merge this PR. This PR calls |
I ran only two tests in One suggestion over there is to add following:
So I added that and it worked. It didn't make sense to me so I removed the Then I thought it has to do something with As you noted, tests works without Sinon as well, only that we can't assert the timestamp in the filename. Maybe latest versions of Chrome are reloading the page only if async is used, which is triggering this code in Karma. Or maybe Sinon is doing something that is cause Chrome to misbehave. I don't know who is the culprit here Sinon, Karma or Chrome 🤷♂️ I think #11289 is a |
I know, it's all very perplexing! I like how #1129 looks, and I just approved that. But this PR also looks good if you'd prefer to merge this one. Your call! Thank you for fixing this test. 🙏 |
Closing in favor of #1129. |
Closes #1047
Builds are failing on the master branch as well, this fix is necessary now.
What has been done to verify that this works as intended?
All tests are passing and no file is created on the file system.
Why is this the best possible solution? Were any other approaches considered?
This solves the problem, but I am open to hearing other options. @matthew-white mentioned something about
preventDefault
in tests in the issue, I don't where to set that.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
No
Does this change require updates to user documentation? If so, please file an issue here and include the link below.
Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes