Created
January 27, 2022 13:17
-
-
Save aninde/30a23014d2d97d904832876299ad64c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [ | |
['=SUM(B1:B2)', 1, "=A$1"], | |
['=$B1', 2, '=SUM(A1:A2)'], | |
]; | |
var example1 = document.getElementById('example1'); | |
const hyperformulaInstance = HyperFormula.buildEmpty({ | |
licenseKey: 'internal-use-in-handsontable', | |
}); | |
var hot1 = new Handsontable(example1, { | |
licenseKey: 'non-commercial-and-evaluation', | |
data: data, | |
colHeaders: true, | |
dropdownMenu: true, | |
formulas: { | |
engine: hyperformulaInstance | |
}, | |
filters: true, | |
}); | |
//should filter cell with relative formula in the first cell | |
const filtersPlugin = hot1.getPlugin('filters'); | |
filtersPlugin.addCondition(0, 'by_value', ['3']); | |
filtersPlugin.filter() | |
expect(getData()[0][0]).toBe(3) | |
//should filter cell with absolute formula in the first cell | |
filtersPlugin.addCondition(0, 'by_value', ['1']); | |
filtersPlugin.filter() | |
expect(getData()[0][0]).toBe(3) | |
//should filter cell with absolute formula in the cell | |
filtersPlugin.addCondition(2, 'by_value', ['3']); | |
filtersPlugin.filter() | |
expect(getData()[0][2]).toBe(3) | |
//should filter cell with relative formula in the cell | |
filtersPlugin.addCondition(2, 'by_value', ['4']); | |
filtersPlugin.filter() | |
expect(getData()[0][2]).toBe(4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment