Skip to content

Commit

Permalink
Merge pull request #2228 from cramforce/document-title
Browse files Browse the repository at this point in the history
Transmit the document.title in the documentLoaded message to the viewer.
  • Loading branch information
cramforce committed Feb 23, 2016
2 parents 4702cf8 + 3886200 commit 3d9a4cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/service/viewer-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,11 @@ export class Viewer {
* @param {number} height
*/
postDocumentReady(width, height) {
this.sendMessage_('documentLoaded', {width: width, height: height}, false);
this.sendMessage_('documentLoaded', {
width: width,
height: height,
title: this.win.document.title,
}, false);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions test/functional/test-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('Viewer', () => {
referrer: '',
body: {style: {}},
documentElement: {style: {}},
title: 'Awesome doc',
};
windowMock = sandbox.mock(windowApi);
viewer = new Viewer(windowApi);
Expand Down Expand Up @@ -175,6 +176,7 @@ describe('Viewer', () => {
expect(m.eventType).to.equal('documentLoaded');
expect(m.data.width).to.equal(11);
expect(m.data.height).to.equal(12);
expect(m.data.title).to.equal('Awesome doc');
});

it('should post documentResized event', () => {
Expand Down

0 comments on commit 3d9a4cc

Please sign in to comment.