File: test/DebugAutoCalc.test.ts

Recommend this page to a friend!
  Packages of ikhsan   jQuery Calx   test/DebugAutoCalc.test.ts   Download  
File: test/DebugAutoCalc.test.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: jQuery Calx
Calculate form input values based on formulas
Author: By
Last change:
Date: 3 months ago
Size: 1,170 bytes
 

Contents

Class file image Download
import { Calx } from '../src/Calx'; describe('Debug Auto Calculate', () => { it('should debug dependency setup', () => { const workbook = Calx.createWorkbook(); const sheet = workbook.createSheet('Sheet1'); sheet.createCell('A1', { value: 10 }); sheet.createCell('A2', { value: 20 }); sheet.createCell('B1', { formula: '=A1+A2' }); workbook.build(); workbook.calculate(); const cellA1 = sheet.getCell('A1'); const cellB1 = sheet.getCell('B1'); console.log('A1 dependents:', Object.keys(cellA1.getDependents())); console.log('B1 precedents:', cellB1.getPrecedents() ? Object.keys(cellB1.getPrecedents()) : null); console.log('B1 value before:', sheet.getCellValue('B1')); console.log('Sheet autoCalculate:', sheet.autoCalculate); cellA1.value = 15; console.log('A1 dependents after change:', Object.keys(cellA1.getDependents())); console.log('B1 value after:', sheet.getCellValue('B1')); console.log('B1 is dirty:', (cellB1 as any)._dirty); console.log('B1 is calculated:', (cellB1 as any)._calculated); }); });