diff --git a/editor/header/preview-button/index.js b/editor/header/preview-button/index.js
index e098ba94e018a3..897e740e115856 100644
--- a/editor/header/preview-button/index.js
+++ b/editor/header/preview-button/index.js
@@ -73,6 +73,29 @@ export class PreviewButton extends Component {
'about:blank',
this.getWindowTarget()
);
+
+ const markup = `
+
+
Please wait…
+
Generating preview.
+
+ `;
+
+ this.previewWindow.document.write( markup );
+ this.previewWindow.document.close();
}
render() {
diff --git a/editor/header/preview-button/test/index.js b/editor/header/preview-button/test/index.js
index 7e41b04b530004..8dff7b7596a88b 100644
--- a/editor/header/preview-button/test/index.js
+++ b/editor/header/preview-button/test/index.js
@@ -53,7 +53,14 @@ describe( 'PreviewButton', () => {
const autosave = jest.fn();
const preventDefault = jest.fn();
const windowOpen = window.open;
- window.open = jest.fn();
+ window.open = jest.fn( () => {
+ return {
+ document: {
+ write: jest.fn(),
+ close: jest.fn(),
+ },
+ };
+ } );
const wrapper = shallow(
@@ -66,6 +73,7 @@ describe( 'PreviewButton', () => {
expect( preventDefault ).toHaveBeenCalled();
expect( wrapper.state( 'isAwaitingSave' ) ).toBe( true );
expect( window.open ).toHaveBeenCalled();
+ expect( wrapper.instance().previewWindow.document.write ).toHaveBeenCalled();
} else {
expect( autosave ).not.toHaveBeenCalled();
expect( preventDefault ).not.toHaveBeenCalled();