Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcrowe committed Oct 10, 2017
1 parent 4d7b246 commit 3975e02
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ describe('get best cross axis droppable', () => {
id: 'sibling1',
direction: axis.direction,
clientRect: getClientRect({
top: 20,
left: 20,
right: 40,
// long droppable inside a shorter container - this should be clipped
bottom: 80,
}),
containerRect: getClientRect({
// not the same top value as source
top: 20,
// shares the left edge with the source
Expand Down Expand Up @@ -266,6 +273,25 @@ describe('get best cross axis droppable', () => {
expect(result).toBe(sibling2);
});

it('should account for container clipping', () => {
// inside sibling1's droppable bounds, but outside its clipped bounds
const center: Position = {
y: 50,
x: 10,
};

// if we're clipping dimensions correctly we should land in sibling2
// if not, we'll land in sibling1
const result: ?DroppableDimension = getBestCrossAxisDroppable({
isMovingForward: true,
pageCenter: center,
source,
droppables,
});

expect(result).toBe(sibling2);
});

describe('center point is not contained within a droppable', () => {
it('should return the droppable that has the closest corner', () => {
// Choosing a point that is above the first sibling
Expand Down

0 comments on commit 3975e02

Please sign in to comment.