Skip to content

Commit

Permalink
Merge pull request #62 from zerkms/TESTS_MAXSIZE_MINSIZE
Browse files Browse the repository at this point in the history
Implemented tests for maxSize and minSize
  • Loading branch information
tomkp committed Apr 1, 2016
2 parents e2be48a + ba83b54 commit bf85fff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
26 changes: 19 additions & 7 deletions test/horizontal-split-pane-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,34 @@ describe('Horizontal SplitPane', function () {
describe('Resizer move up and down', function () {

const splitPane = (
<SplitPane split="horizontal" defaultSize={200}>
<SplitPane split="horizontal" defaultSize={200} minSize={50} maxSize={450}>
<div>one</div>
<div>two</div>
</SplitPane>
);

const moveToRight = { y: 200 };
const moveDown = { y: 200 };

it('after move down, the first pane should be larger then before', function () {
asserter(splitPane, true).assertResizeByDragging(moveToRight, { height: '400px' });
it('after move down, the first pane should be larger than before', function () {
asserter(splitPane, true).assertResizeByDragging(moveDown, { height: '400px' });
});

const moveToLeft = { y: -120 };
const moveUp = { y: -120 };

it('after move up, the first pane should be smaller then before', function () {
asserter(splitPane, true).assertResizeByDragging(moveToLeft, { height: '80px' });
it('after move up, the first pane should be smaller than before', function () {
asserter(splitPane, true).assertResizeByDragging(moveUp, { height: '80px' });
});

const moveUpExtreme = { y: -190 };

it('after move up, the first pane should not be smaller than `minSize`', function () {
asserter(splitPane, true).assertResizeByDragging(moveUpExtreme, { height: '50px' });
});

const moveDownExtreme = { y: 300 };

it('after move down, the first pane should not be larger than `maxSize`', function () {
asserter(splitPane, true).assertResizeByDragging(moveDownExtreme, { height: '450px' });
});
});

Expand Down
18 changes: 15 additions & 3 deletions test/vertical-split-pane-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,35 @@ describe('Vertical SplitPane', function () {
describe('Resizer move to the right and left', function () {

const splitPane = (
<SplitPane split="vertical" defaultSize={200}>
<SplitPane split="vertical" defaultSize={200} minSize={50} maxSize={450}>
<div>one</div>
<div>two</div>
</SplitPane>
);

const moveToRight = { x: 200 };

it('after move to right, the first pane should be larger then before', function () {
it('after move to right, the first pane should be larger than before', function () {
asserter(splitPane, true).assertResizeByDragging(moveToRight, { width: '400px' });
});

const moveToLeft = { x: -120 };

it('after move to left, the first pane should be smaller then before', function () {
it('after move to left, the first pane should be smaller than before', function () {
asserter(splitPane, true).assertResizeByDragging(moveToLeft, { width: '80px' });
});

const moveLeftExtreme = { x: -190 };

it('after move to left, the first pane should not be smaller than `minSize`', function () {
asserter(splitPane, true).assertResizeByDragging(moveLeftExtreme, { width: '50px' });
});

const moveRightExtreme = { x: 300 };

it('after move to right, the first pane should not be larger than `minSize`', function () {
asserter(splitPane, true).assertResizeByDragging(moveRightExtreme, { width: '450px' });
});
});

describe('Resizer move to the right and left and primary prop is set to second', function () {
Expand Down

0 comments on commit bf85fff

Please sign in to comment.