Skip to content

Commit

Permalink
Add HyperFormula#numberOfSheets()
Browse files Browse the repository at this point in the history
  • Loading branch information
swistak35 committed Nov 22, 2019
1 parent 6e59469 commit 2ec72e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/HyperFormula.ts
Expand Up @@ -534,6 +534,13 @@ export class HyperFormula {
return this.sheetMapping.hasSheetWithName(sheetName)
}

/**
* Returns number of existing sheets
*/
public numberOfSheets(): number {
return this.sheetMapping.numberOfSheets()
}

/**
* Run multiple operations and recompute formulas at the end
*
Expand Down
14 changes: 14 additions & 0 deletions test/engine.spec.ts
Expand Up @@ -184,4 +184,18 @@ describe('Integration', () => {

expect(engine.doesSheetExist('foobar')).toBe(false)
})

it('#numberOfSheets for zero', () => {
const engine = HyperFormula.buildEmpty()

expect(engine.numberOfSheets()).toBe(0)
})

it('#numberOfSheets', () => {
const engine = HyperFormula.buildEmpty()

engine.addSheet('foo')

expect(engine.numberOfSheets()).toBe(1)
})
})

0 comments on commit 2ec72e0

Please sign in to comment.