|
| 1 | +import React from 'react'; |
| 2 | +import { render, unmountComponentAtNode } from 'react-dom'; |
| 3 | +import { Scrollbar } from "react-scrollbars-custom"; |
| 4 | + |
| 5 | +describe('rendering', () => { |
| 6 | + let node; |
| 7 | + beforeEach(() => { |
| 8 | + node = document.createElement('div'); |
| 9 | + document.body.appendChild(node); |
| 10 | + }); |
| 11 | + afterEach(() => { |
| 12 | + unmountComponentAtNode(node); |
| 13 | + document.body.removeChild(node); |
| 14 | + }); |
| 15 | + |
| 16 | + describe("when <Scrollbar /> is rendered", function () { |
| 17 | + it('renders tracks', (done) => { |
| 18 | + render(<Scrollbar />, node, function () { |
| 19 | + expect(this.trackVertical).to.be.an.instanceof(Node); |
| 20 | + expect(this.trackHorizontal).to.be.an.instanceof(Node); |
| 21 | + |
| 22 | + done(); |
| 23 | + }); |
| 24 | + }); |
| 25 | + it('renders thumbs', (done) => { |
| 26 | + render(<Scrollbar />, node, function () { |
| 27 | + expect(this.thumbVertical).to.be.an.instanceof(Node); |
| 28 | + expect(this.thumbHorizontal).to.be.an.instanceof(Node); |
| 29 | + |
| 30 | + done(); |
| 31 | + }); |
| 32 | + }); |
| 33 | + it('renders content wrapper', (done) => { |
| 34 | + render(<Scrollbar />, node, function () { |
| 35 | + expect(this.wrapper).to.be.an.instanceof(Node); |
| 36 | + |
| 37 | + done(); |
| 38 | + }); |
| 39 | + }); |
| 40 | + it('renders content', (done) => { |
| 41 | + render(<Scrollbar />, node, function () { |
| 42 | + expect(this.content).to.be.an.instanceof(Node); |
| 43 | + |
| 44 | + done(); |
| 45 | + }); |
| 46 | + }); |
| 47 | + }); |
| 48 | +}); |
0 commit comments