forked from localForage/localForage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.iframes.js
33 lines (29 loc) · 1.08 KB
/
test.iframes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* global before:true, after:true, describe:true, expect:true, it:true */
describe('Inside iFrames', function() {
'use strict';
before(function() {
var iFrame = window.document.createElement('iframe');
iFrame.name = 'iframe';
iFrame.id = 'iframe';
// TODO: Get this to be cross-origin.
iFrame.src =
'http://' + window.location.host + '/test/test.iframecontents.html';
window.document.body.appendChild(iFrame);
});
after(function() {
var iFrame = window.document.getElementById('iframe');
iFrame.parentNode.removeChild(iFrame);
});
it('can run localForage in an iFrame', function(done) {
var timer = setInterval(function() {
var element = window.document
.getElementById('iframe')
.contentWindow.document.getElementById('my-text');
if (element && element.innerHTML) {
clearInterval(timer);
expect(element.innerHTML).to.be('I have been set');
done();
}
}, 10);
});
});