Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions test/bugs/issue463.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import postscribe from '../../src/postscribe';
const $ = require('jquery');

describe('bugs', () => {
it('issue 463: dynamically created iframe with a text', done => {
let text = 'body text';
let script = `<script>
var iframe = document.createElement('iframe');
iframe['id'] = 'iframeid';
iframe['frameBorder'] = 0;
document.getElementsByTagName('body')[0].appendChild(iframe);
iframe.contentWindow.document.open();
iframe.contentWindow.document.write('<!DOCTYPE html><head></head><body>${text}</body></html>');
iframe.contentWindow.document.close();
<\/script>`;

const options = {};
options.done = () => {
setTimeout( function() {
let iframe_text = $('#iframeid').contents().find('body').html();
expect(iframe_text).to.be.equal(text);
done();
}, 4);
};

jQuery( document ).ready( function() {
postscribe( document.body, script, options);
});

});
});