Skip to content

Commit

Permalink
Add child tests for getPageInfo (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjbradshaw committed Oct 1, 2015
1 parent 11765eb commit 64f096b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/childSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ define(['iframeResizerContent','jquery'], function(mockMsgListener,$) {
expect(msgObject.source.postMessage.calls.argsFor(0)[0]).toContain(':reset');
});

it('getPageInfo', function(done) {
win.parentIFrame.getPageInfo(function(pageInfo){
expect(pageInfo.clientHeight).toBe(645);
expect(pageInfo.clientWidth).toBe(1295);
expect(pageInfo.offsetLeft).toBe(20);
expect(pageInfo.offsetTop).toBe(85);
expect(pageInfo.scrollTop).toBe(0);
expect(pageInfo.scrollLeft).toBe(0);
done();
});
expect(msgObject.source.postMessage).toHaveBeenCalledWith('[iFrameSizer]parentIFrameTests:0:0:pageInfo', '*');
mockMsgListener(createMsg('pageInfo:{"clientHeight":645,"clientWidth":1295,"offsetLeft":20,"offsetTop":85,"scrollLeft":0,"scrollTop":0}'));
});

it('scrollTo', function() {
win.parentIFrame.scrollTo(10,10);
expect(msgObject.source.postMessage).toHaveBeenCalledWith('[iFrameSizer]parentIFrameTests:10:10:scrollTo', '*');
Expand Down

0 comments on commit 64f096b

Please sign in to comment.