Declare global
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
goog.provide('ol.test.interaction.DragAndDrop');
|
||||
|
||||
goog.require('ol.interaction.DragAndDrop');
|
||||
goog.require('ol');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventTarget');
|
||||
goog.require('ol.format.GeoJSON');
|
||||
goog.require('ol.interaction.DragAndDrop');
|
||||
|
||||
|
||||
describe('ol.interaction.DragAndDrop', function() {
|
||||
var viewport, map, interaction;
|
||||
var global = ol.global;
|
||||
|
||||
beforeEach(function() {
|
||||
viewport = new ol.events.EventTarget();
|
||||
@@ -69,7 +71,7 @@ describe('ol.interaction.DragAndDrop', function() {
|
||||
});
|
||||
|
||||
describe('#handleDrop_', function() {
|
||||
var origFileReader = ol.global.FileReader;
|
||||
var origFileReader = global.FileReader;
|
||||
|
||||
beforeEach(function() {
|
||||
FileReader = function() {
|
||||
@@ -83,7 +85,7 @@ describe('ol.interaction.DragAndDrop', function() {
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
ol.global.FileReader = origFileReader;
|
||||
global.FileReader = origFileReader;
|
||||
});
|
||||
|
||||
it('reads dropped files', function(done) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
goog.provide('ol.test.layer.Group');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.extent');
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
goog.provide('ol.test.net');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.net');
|
||||
|
||||
|
||||
describe('ol.net', function() {
|
||||
|
||||
var global = ol.global;
|
||||
|
||||
describe('jsonp()', function() {
|
||||
var head = ol.global.document.getElementsByTagName('head')[0];
|
||||
var head = global.document.getElementsByTagName('head')[0];
|
||||
var origAppendChild = head.appendChild;
|
||||
var origCreateElement = document.createElement;
|
||||
var origSetTimeout = ol.global.setTimeout;
|
||||
var origSetTimeout = global.setTimeout;
|
||||
var key, removeChild;
|
||||
|
||||
function createCallback(url, done) {
|
||||
@@ -29,7 +31,7 @@ describe('ol.net', function() {
|
||||
if (arg == 'script') {
|
||||
return element;
|
||||
} else {
|
||||
return origCreateElement.apply(ol.global.document, arguments);
|
||||
return origCreateElement.apply(global.document, arguments);
|
||||
}
|
||||
};
|
||||
head.appendChild = function(el) {
|
||||
@@ -38,13 +40,13 @@ describe('ol.net', function() {
|
||||
removeChild: removeChild
|
||||
};
|
||||
origSetTimeout(function() {
|
||||
ol.global[key](element.src);
|
||||
global[key](element.src);
|
||||
}, 0);
|
||||
} else {
|
||||
origAppendChild.apply(head, arguments);
|
||||
}
|
||||
};
|
||||
ol.global.setTimeout = function(fn, time) {
|
||||
global.setTimeout = function(fn, time) {
|
||||
origSetTimeout(fn, 100);
|
||||
};
|
||||
});
|
||||
@@ -52,7 +54,7 @@ describe('ol.net', function() {
|
||||
afterEach(function() {
|
||||
document.createElement = origCreateElement;
|
||||
head.appendChild = origAppendChild;
|
||||
ol.global.setTimeout = origSetTimeout;
|
||||
global.setTimeout = origSetTimeout;
|
||||
});
|
||||
|
||||
it('appends callback param to url, cleans up after call', function(done) {
|
||||
@@ -72,7 +74,7 @@ describe('ol.net', function() {
|
||||
expect.fail();
|
||||
}
|
||||
function errback() {
|
||||
expect(ol.global[key]).to.be(undefined);
|
||||
expect(global[key]).to.be(undefined);
|
||||
expect(removeChild.called).to.be(true);
|
||||
done();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
goog.provide('ol.test.render');
|
||||
|
||||
goog.require('ol.transform');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.render');
|
||||
goog.require('ol.render.canvas.Immediate');
|
||||
goog.require('ol.transform');
|
||||
|
||||
|
||||
describe('ol.render', function() {
|
||||
|
||||
describe('toContext', function() {
|
||||
|
||||
Reference in New Issue
Block a user