IE8 should use XDomainRequest to avoid loading bar flashing

This commit is contained in:
yujiosaka
2014-08-16 05:14:45 +09:00
parent 4d45869f7c
commit 89ec0efe74
5 changed files with 106 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ require('./transport');
// browser only tests
if (env.browser) {
require('./connection');
require('./xmlhttprequest');
if (global.ArrayBuffer) {
require('./arraybuffer');
} else {

24
test/xmlhttprequest.js Normal file
View File

@@ -0,0 +1,24 @@
var expect = require('expect.js');
var XMLHttpRequest = require('../lib/xmlhttprequest');
var isIE8 = /MSIE 8/.test(navigator.userAgent);
describe('XMLHttpRequest', function () {
if (isIE8) {
describe('IE8', function() {
it('should have same properties as XDomainRequest does when xscheme is false', function() {
var xhr = new XMLHttpRequest({xdomain: false, xscheme: false});
expect(xhr).to.be.an('object');
expect(xhr).to.have.property('onload');
expect(xhr).to.have.property('onerror');
});
it('should have same properties as XMLHttpRequest does when xscheme is true', function() {
var xhr = new XMLHttpRequest({xdomain: false, xscheme: true});
expect(xhr).to.be.an('object');
expect(xhr).to.have.property('onreadystatechange');
});
});
}
});