-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adrien Denat
committed
Mar 12, 2018
1 parent
8a10eeb
commit eb37f1f
Showing
4 changed files
with
45 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
// This is a custom Jest transformer turning style imports into empty objects. | ||
// http://facebook.github.io/jest/docs/en/webpack.html | ||
|
||
module.exports = { | ||
process() { | ||
return 'module.exports = {};'; | ||
}, | ||
getCacheKey() { | ||
// The output is always the same. | ||
return 'cssTransform'; | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1 +1,25 @@ | ||
import SimpleBar from './simplebar'; | ||
import SimpleBar from './simplebar'; | ||
|
||
beforeEach(() => { | ||
jest.resetModules(); | ||
|
||
// Set up our document body | ||
document.body.innerHTML = '<div id="simplebar"></div>'; | ||
}); | ||
|
||
test('should call constructor', () => { | ||
const SimpleBar = require('./simplebar').default; | ||
jest.mock('./simplebar'); | ||
|
||
const simpleBar = new SimpleBar(document.getElementById('simplebar')); | ||
|
||
expect(SimpleBar).toHaveBeenCalledTimes(1); | ||
}); | ||
test('should return right scroll element', () => { | ||
const simpleBar = new SimpleBar(document.getElementById('simplebar')); | ||
const scrollElementY = simpleBar.getScrollElement(); | ||
const scrollElementX = simpleBar.getScrollElement('x'); | ||
|
||
expect(scrollElementY).toBe(simpleBar.scrollContentEl); | ||
expect(scrollElementX).toBe(simpleBar.contentEl); | ||
}); |