Skip to content

Commit

Permalink
Add missing test for "pageshow" event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
robertknight committed Nov 14, 2024
1 parent 8dd57d6 commit 85828e0
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ describe('CreateEditGroupForm', () => {
assert.isTrue(pageUnloadWarningActive());
});

it('clears modified state when page is loaded from cache', () => {
const { elements } = createWrapper();
act(() => {
elements.nameField.prop('onChangeValue')('modified');
});
assert.isTrue(pageUnloadWarningActive());

act(() => {
window.dispatchEvent(
new PageTransitionEvent('pageshow', { persisted: true }),
);
});
assert.isFalse(pageUnloadWarningActive());
});

it('updates the group', async () => {
const { wrapper, elements } = createWrapper();
const { nameField, descriptionField } = elements;
Expand Down

0 comments on commit 85828e0

Please sign in to comment.