diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/iframe.html | 9 | ||||
| -rw-r--r-- | test/jqLiteSpec.js | 27 | 
2 files changed, 36 insertions, 0 deletions
| diff --git a/test/fixtures/iframe.html b/test/fixtures/iframe.html new file mode 100644 index 00000000..7b37d91d --- /dev/null +++ b/test/fixtures/iframe.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> +  <head> +    <title>Iframe Test</title> +  </head> +  <body> +    <span>Text</span> +  </body> +</html> diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 82db95b6..1f3be1b2 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -1299,6 +1299,33 @@ describe('jqLite', function() {        expect(contents[0].data).toEqual(' some comment ');        expect(contents[1].data).toEqual('before-');      }); + +    // IE8 does not like this test, although the functionality may still work there. +    if (!msie || msie > 8) { +      it('should select all types iframe contents', function() { +        var iframe_ = document.createElement('iframe'), tested, +            iframe = jqLite(iframe_); +        function test() { +          var contents = iframe.contents(); +          expect(contents[0]).toBeTruthy(); +          expect(contents.length).toBe(1); +          expect(contents.prop('nodeType')).toBe(9); +          expect(contents[0].body).toBeTruthy(); +          expect(jqLite(contents[0].body).contents().length).toBe(3); +          iframe.remove(); +          tested = true; +        } +        iframe_.onload = iframe_.onreadystatechange = function() { +          if (iframe_.contentDocument) test(); +        }; +        iframe_.src = "/base/test/fixtures/iframe.html"; +        jqLite(document).find('body').append(iframe); +         +        // This test is potentially flaky on CI cloud instances, so there is a generous +        // wait period... +        waitsFor(function() { return tested; }, 2000); +      }); +    }    }); | 
