Show toast in more cases after submitting iframe form - #1869
Show toast in more cases after submitting iframe form#1869matthew-white wants to merge 2 commits into
Conversation
|
d02469a to
80ae622
Compare
Closes #2188.
80ae622 to
312f734
Compare
matthew-white
left a comment
There was a problem hiding this comment.
Notes about decisions I made and questions I have
| // Note that the Problem may be wrapped in another element, for example, | ||
| // a <pre> element. |
There was a problem hiding this comment.
Maybe this comment should be moved above, above where I define textContent?
| "submit": "Data download should begin soon. Once it begins, you can close this message. If it hasn’t started in 20 seconds, please try again.", | ||
| "parseError": "Something went wrong while requesting your data." | ||
| "parseError": "Something went wrong while requesting your data.", | ||
| "somethingWentWrong": "@:alert.parseError" |
There was a problem hiding this comment.
I want to rename parseError to somethingWentWrong. That's because I want to use the same message for more cases (the cases that this PR addresses). In other words, I just want to rekey the message. @: is Vue I18n syntax. We could also use @transifexKey instead. Usually we use @transifexKey, but @: is possible in this case because it's a rekey within the same file.
| const clock = sinon.useFakeTimers(Date.now()); | ||
| const modal = await setup(event => { | ||
| event.preventDefault(); | ||
| // TODO. Mock the iframe document so that it throws. |
There was a problem hiding this comment.
This is where I got stuck. I want to make it so that accessing window.document throws. Can I use sinon.replaceGetter() for that (specifying a getter that throws)? Or will that not work, since window.document isn't originally a getter?
| modal.should.alert('danger', 'Something went wrong while requesting your data.'); | ||
| }); | ||
|
|
||
| it('logs the response', async () => { |
There was a problem hiding this comment.
I should probably update and/or copy this test as well. Both because there are new cases that do logging and because the existing case does more logging than before.
This PR is a work in progress that I started during development on v2026.3, when I was looking at getodk/central#2080. This PR closes getodk/central#2188.
The main left to do is to add more tests. I feel pretty good about the changes to src/ itself.
What has been done to verify that this works as intended?
I've added one new test so far, but there's still more to test.