Improve local rules persistence and dirty-state handling
This commit is contained in:
16
test/web/rule-editor-contract.test.js
Normal file
16
test/web/rule-editor-contract.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '../..');
|
||||
const component = fs.readFileSync(path.join(root, 'src/web/components/ClientOverviewPage.jsx'), 'utf8');
|
||||
const styles = fs.readFileSync(path.join(root, 'src/web/styles.css'), 'utf8');
|
||||
|
||||
test('rule editor add latency stays constant and dirty exits are guarded', () => {
|
||||
const rowRule = /\.client-local-rule \{([\s\S]*?)\n\}/.exec(styles)?.[1] || '';
|
||||
assert.doesNotMatch(rowRule, /--rule-index|calc\(/);
|
||||
assert.match(component, /addEventListener\('beforeunload', warnBeforeUnload\)/);
|
||||
assert.match(component, /requestCloseLocalRules\(\)/);
|
||||
assert.match(component, /localRulesPendingRestart/);
|
||||
});
|
||||
Reference in New Issue
Block a user