Merged
Conversation
740f5e1 to
93be960
Compare
c5f3cb2 to
69f5412
Compare
5829e0a to
4d8126d
Compare
This is a rewrite following our conventions to Class instance. It replaces jQuery methods with vanilla Javascript, switching to Fetch API instead of Ajax. Additions are using try..catch block and 'getState` function which get the current state of resouces stored in `resourceState` object.
Import and instantiate new UpdateContent module Remove Morphom import and assignment as UpdateContent now imports it directly.
In UpdateContent we have replace the jQuery event fire with vanilla JS which have differing structure, so we need to udpate this event listener to fired event get's picked up.
This updates tests with the new module. What tests test has not been changed. The change is the way tests are executed and time in them advanced. Most of our test have an immediate response so for them we have mock response and mock of the fetch implementation. For test where we test a response that takes longer we mock a delay response in `mockResponseDelay` and override the default implementation. To working with the Promise nature of fetch, we advance time with `jest.advanceTimersByTimeAsync` https://jestjs.io/docs/jest-object#jestadvancetimersbytimeasyncmstorun that allows any scheduled promise callbacks to execute before running the timers. Note: `advanceTimersByTimeAsync` is available as of 29.5 as of Jest and 'modern' fake timers have been the default since 27.0.
4d8126d to
f9f9f84
Compare
f9f9f84 to
b164684
Compare
tombye
requested changes
Apr 15, 2026
Contributor
tombye
left a comment
There was a problem hiding this comment.
Spotted a few leftover Promise.resolve()s from when we had to clear up promises in the js tests.
Otherwise, this is great. I particularly liked:
- use of
Setforstate.renderers, to ensure it only includes unique render functions - use of
DomParserfor HTML-to-DOM-node jest.advanceTimersByTimeAsyncletting us to test our asynchronous code in a clear, synchronous format without hacks like extraPromise.resolve()s to tidy up
Co-authored-by: Tom Byers <tombaromba@gmail.com>
27fa0f0 to
589d552
Compare
tombye
approved these changes
Apr 15, 2026
Contributor
tombye
left a comment
There was a problem hiding this comment.
Thanks for making the changes. This now looks good to go 👍🏻
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
We want to migrate all of our legacy Javascript files to ESM, so this is the latest in the series of conversions.
[Trello ticket](https://trello.com/c/Us5BzeMd/1576-modernise-our-javascript-updatecontent
Rewrite follows the same conventions we previously used for RadioSelect, FocusBanner, Collapsible checkboxes, ColourPreview, FileUpload, Autofocus, PreviewPane, CopyToClipboard and others.
It replaces jQuery methods with vanilla Javascript, switching to Fetch API instead of AJAX.
In this PR we:
How to review
/service-settings/daily-message-limit/emailor filtered notifications page