mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-04 16:06:41 +00:00
fix: keep the text typed in the Sieve editor when the script refreshes (bulwarkmail/webmail#1162)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { seedsOnRender } from '../editor-seed';
|
||||
|
||||
describe('seedsOnRender', () => {
|
||||
it('seeds the Sieve editor when it opens, not when the script is refreshed while it is open (#1162)', () => {
|
||||
expect(seedsOnRender(false, true)).toBe(true);
|
||||
expect(seedsOnRender(true, true)).toBe(false);
|
||||
expect(seedsOnRender(true, false)).toBe(false);
|
||||
expect(seedsOnRender(false, false)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Whether an editor sheet takes its content afresh: only when it opens. A
|
||||
* new `content` while it is open (a store refresh) must not replace what the
|
||||
* user typed (#1162).
|
||||
*/
|
||||
export function seedsOnRender(wasVisible: boolean, visible: boolean): boolean {
|
||||
return visible && !wasVisible;
|
||||
}
|
||||
Reference in New Issue
Block a user