Skip to content

Commit

Permalink
test: getAbsolute* (#33)
Browse files Browse the repository at this point in the history
Namely:
- getAbsoluteTop,
- getAbsoluteRight,
- getAbsoluteLeft.
  • Loading branch information
Thomaash committed Aug 2, 2019
1 parent 3b220fc commit f4cdcc6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/get-absolute.test.ts
@@ -0,0 +1,26 @@
import { expect } from 'chai'
import { stub } from 'sinon'

import { getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop } from '../src'

describe('getAbsolute*', function(): void {
const elem = { getBoundingClientRect: stub() }
elem.getBoundingClientRect.returns({
top: 1,
right: 2,
bottom: 3,
left: 4,
})

it('getAbsoluteTop', function(): void {
expect(getAbsoluteTop(elem as any)).to.equal(1)
})

it('getAbsoluteRight', function(): void {
expect(getAbsoluteRight(elem as any)).to.equal(2)
})

it('getAbsoluteLeft', function(): void {
expect(getAbsoluteLeft(elem as any)).to.equal(4)
})
})

0 comments on commit f4cdcc6

Please sign in to comment.