make Leaflet.js requirable for version, remove noConflict test
Currently tests don’t account for wrapper function around Leaflet source, so the noConflict one failed — removing for now.
This commit is contained in:
parent
9a6288ef37
commit
2b96ea5aba
@ -1,3 +0,0 @@
|
||||
// set up before Leaflet files to test L#noConflict later
|
||||
L = 'test';
|
||||
|
@ -13,7 +13,6 @@
|
||||
<script type="text/javascript" src="sinon.js"></script>
|
||||
|
||||
<!-- source files -->
|
||||
<script type="text/javascript" src="before.js"></script>
|
||||
<script type="text/javascript" src="../build/deps.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../debug/leaflet-include.js"></script>
|
||||
@ -28,7 +27,6 @@
|
||||
<!-- spec files -->
|
||||
|
||||
<script type="text/javascript" src="suites/SpecHelper.js"></script>
|
||||
<script type="text/javascript" src="suites/LeafletSpec.js"></script>
|
||||
|
||||
<!-- /control -->
|
||||
<script type="text/javascript" src="suites/control/Control.LayersSpec.js"></script>
|
||||
|
@ -4,7 +4,6 @@ module.exports = function (config) {
|
||||
var libSources = require(__dirname+'/../build/build.js').getFiles();
|
||||
|
||||
var files = [
|
||||
"spec/before.js",
|
||||
"spec/sinon.js",
|
||||
"spec/expect.js"
|
||||
].concat(libSources, [
|
||||
|
@ -1,13 +0,0 @@
|
||||
describe('L#noConflict', function () {
|
||||
it('restores the previous L value and returns Leaflet namespace', function () {
|
||||
|
||||
expect(L.version).to.be.ok();
|
||||
|
||||
var L2 = L.noConflict();
|
||||
|
||||
expect(L).to.eql('test');
|
||||
expect(L2.version).to.be.ok();
|
||||
|
||||
window.L = L2;
|
||||
});
|
||||
});
|
@ -1,8 +1,7 @@
|
||||
|
||||
var oldL = window.L,
|
||||
L = {};
|
||||
|
||||
L.version = '0.8-dev';
|
||||
var L = {
|
||||
version: '0.8-dev'
|
||||
};
|
||||
|
||||
// define Leaflet for Node module pattern loaders, including Browserify
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
@ -11,13 +10,15 @@ if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
// define Leaflet as an AMD module
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(L);
|
||||
}
|
||||
|
||||
// define Leaflet as a global L variable, saving the original L to restore later if needed
|
||||
} else {
|
||||
var oldL = window.L;
|
||||
|
||||
L.noConflict = function () {
|
||||
window.L = oldL;
|
||||
return this;
|
||||
};
|
||||
L.noConflict = function () {
|
||||
window.L = oldL;
|
||||
return this;
|
||||
};
|
||||
|
||||
window.L = L;
|
||||
window.L = L;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user