test: Add tests for leading zero visual input handling
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -509,6 +509,34 @@ test('Number input chaos: leading zeros', () => {
|
||||
checkDisplay('7', 'Can input number with leading zeros after a clear');
|
||||
});
|
||||
|
||||
test('Leading zeros are visually removed during input', () => {
|
||||
press('0');
|
||||
assert.strictEqual(global.last_display_num, '0', 'Input: 0');
|
||||
press('0');
|
||||
assert.strictEqual(global.last_display_num, '0', 'Second 0 should not create "00"');
|
||||
press('7');
|
||||
assert.strictEqual(global.last_display_num, '7', '0 should be replaced by 7');
|
||||
press('R'); press('R');
|
||||
|
||||
press('0');
|
||||
press('0');
|
||||
press('.');
|
||||
assert.strictEqual(global.last_display_num, '0.', 'Input: 00. -> "0."');
|
||||
press('4');
|
||||
assert.strictEqual(global.last_display_num, '0.4', 'Input: 00.4 -> "0.4"');
|
||||
press('R'); press('R');
|
||||
|
||||
// After a calculation, starting a new number
|
||||
press('1+2=');
|
||||
checkDisplay(3);
|
||||
press('0');
|
||||
assert.strictEqual(global.last_display_num, '0', 'Post-calc: 0');
|
||||
press('0');
|
||||
assert.strictEqual(global.last_display_num, '0', 'Post-calc: 00 -> "0"');
|
||||
press('5');
|
||||
assert.strictEqual(global.last_display_num, '5', 'Post-calc: 005 -> "5"');
|
||||
});
|
||||
|
||||
test('Repeated equals', () => {
|
||||
press('2+3=');
|
||||
checkDisplay('5');
|
||||
|
||||
Reference in New Issue
Block a user