mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
@@ -7,12 +7,7 @@ module.exports = function(config) {
|
||||
sharedConfig(config, {testName: 'AngularJS: jqLite', logFile: 'karma-jqlite.log'});
|
||||
|
||||
config.set({
|
||||
files: angularFiles.mergeFilesFor('karma').concat({
|
||||
pattern: "test/fixtures/**/*.html",
|
||||
served: true,
|
||||
watched: true,
|
||||
included: false
|
||||
}),
|
||||
files: angularFiles.mergeFilesFor('karma'),
|
||||
exclude: angularFiles.mergeFilesFor('karmaExclude'),
|
||||
|
||||
junitReporter: {
|
||||
|
||||
@@ -7,12 +7,7 @@ module.exports = function(config) {
|
||||
sharedConfig(config, {testName: 'AngularJS: jQuery', logFile: 'karma-jquery.log'});
|
||||
|
||||
config.set({
|
||||
files: angularFiles.mergeFilesFor('karmaJquery').concat({
|
||||
pattern: "test/fixtures/**/*.html",
|
||||
served: true,
|
||||
watched: true,
|
||||
included: false
|
||||
}),
|
||||
files: angularFiles.mergeFilesFor('karmaJquery'),
|
||||
exclude: angularFiles.mergeFilesFor('karmaJqueryExclude'),
|
||||
|
||||
junitReporter: {
|
||||
|
||||
9
test/fixtures/iframe.html
vendored
9
test/fixtures/iframe.html
vendored
@@ -1,9 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Iframe Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<span>Text</span>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1444,32 +1444,37 @@ describe('jqLite', function() {
|
||||
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);
|
||||
it('should select all types iframe contents', function() {
|
||||
// IE8 does not like this test, although the functionality may still work there.
|
||||
if (msie < 9) return;
|
||||
var iframe_ = document.createElement('iframe');
|
||||
var tested = false;
|
||||
var iframe = jqLite(iframe_);
|
||||
function test() {
|
||||
var doc = iframe_.contentDocument || iframe_.contentWindow.document;
|
||||
doc.body.innerHTML = '\n<span>Text</span>\n';
|
||||
|
||||
// This test is potentially flaky on CI cloud instances, so there is a generous
|
||||
// wait period...
|
||||
waitsFor(function() { return tested; }, 'iframe to load', 5000);
|
||||
});
|
||||
}
|
||||
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();
|
||||
doc = null;
|
||||
tested = true;
|
||||
}
|
||||
iframe_.onload = iframe_.onreadystatechange = function() {
|
||||
if (iframe_.contentDocument) test();
|
||||
};
|
||||
/* jshint scripturl:true */
|
||||
iframe_.src = 'javascript:false';
|
||||
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; }, 'iframe to load', 5000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user