fix non-extendable objects regression of 1.1.0

Closes #5650 until we figure out a less hacky solution.
This commit is contained in:
Vladimir Agafonkin 2017-07-24 15:53:29 +03:00
parent eb9572800d
commit 957f05da23
6 changed files with 18 additions and 6 deletions

View File

@ -1,7 +1,7 @@
sudo: false
language: node_js
node_js:
- 4
- node
addons:
artifacts:
paths:

View File

@ -14,19 +14,19 @@
"karma-firefox-launcher": "~1.0.0",
"karma-mocha": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-rollup-plugin": "^0.2.4",
"karma-rollup-preprocessor": "^4.0.1",
"karma-safari-launcher": "~1.0.0",
"leafdoc": "^1.4.1",
"mocha": "^3.1.0",
"phantomjs-prebuilt": "^2.1.12",
"prosthetic-hand": "^1.3.1",
"rollup": "^0.41.4",
"rollup": "^0.45.2",
"rollup-plugin-git-version": "0.2.1",
"rollup-plugin-json": "^2.1.0",
"rollup-watch": "^2.5.0",
"rollup-watch": "^4.3.1",
"source-map": "^0.5.6",
"ssri": "^4.1.2",
"uglify-js": "~2.7.3"
"uglify-js": "~3.0.26"
},
"main": "dist/leaflet-src.js",
"style": "dist/leaflet.css",

View File

@ -25,7 +25,7 @@ module.exports = function (config) {
basePath: '../',
plugins: [
'karma-rollup-plugin',
'karma-rollup-preprocessor',
'karma-mocha',
'karma-coverage',
'karma-phantomjs-launcher',

View File

@ -8,4 +8,10 @@ describe('General', function () {
expect(L.noConflict()).to.eql(leaflet);
});
describe('namespace extension', function () {
L.Util.foo = 'bar';
expect(L.Util.foo).to.eql('bar');
});
});

View File

@ -33,3 +33,6 @@ export function noConflict() {
// Always export us to window global (see #2364)
window.L = exports;
import {freeze} from './core/Util';
Object.freeze = freeze;

View File

@ -4,6 +4,9 @@
* Various utility functions, used by Leaflet internally.
*/
export var freeze = Object.freeze;
Object.freeze = function (obj) { return obj; };
// @function extend(dest: Object, src?: Object): Object
// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.
export function extend(dest) {