-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scoped Named Expressions bugfix (#647)
* test * bugfix for namedexpressions * doc * linter * Pu/issue638 (#649) * scope for listing named expressions * minor fix * doc
- Loading branch information
Showing
8 changed files
with
123 additions
and
48 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {HyperFormula} from '../src' | ||
import {adr} from './testUtils' | ||
|
||
describe('scoped named expressions', () => { | ||
it('should be removed when sheet is removed', () => { | ||
const engine = HyperFormula.buildFromSheets({'Sheet1': [[]], 'Sheet2': [[]]}) | ||
engine.addNamedExpression('TRUE', true, 'Sheet1') | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
expect(engine._namedExpressions.getAllNamedExpressionsNames()).toEqual(['TRUE']) | ||
engine.removeSheet('Sheet1') | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore | ||
expect(engine._namedExpressions.getAllNamedExpressionsNames()).toEqual([]) | ||
}) | ||
|
||
it('removal should work with undo of sheet', () => { | ||
const engine = HyperFormula.buildFromArray([['=TRUE']]) | ||
engine.addNamedExpression('TRUE', true, 'Sheet1') | ||
engine.removeSheet('Sheet1') | ||
engine.undo() | ||
expect(engine.getCellValue(adr('A1'))).toEqual(true) | ||
}) | ||
|
||
it('removal should work with undo of named expression', () => { | ||
const engine = HyperFormula.buildFromArray([['=TRUE']]) | ||
engine.addNamedExpression('TRUE', true, 'Sheet1') | ||
engine.removeNamedExpression('TRUE', 'Sheet1') | ||
engine.undo() | ||
expect(engine.getCellValue(adr('A1'))).toEqual(true) | ||
}) | ||
}) |