UI for Zipcoin Blue

test.iframes.js 1.1KB

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