diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index d2540fba..a255df5b 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -221,7 +221,6 @@ L.Util.sortFeatures = (features, sortKey) => { .toLowerCase() .localeCompare(valB.toString().toLowerCase(), L.locale || 'en', { sensitivity: 'base', - ignorePunctuation: true, numeric: true, }) } diff --git a/umap/static/umap/test/Util.js b/umap/static/umap/test/Util.js index 77418be0..d9555430 100644 --- a/umap/static/umap/test/Util.js +++ b/umap/static/umap/test/Util.js @@ -496,5 +496,14 @@ describe('L.Util', function () { assert.equal(features[1], feat2) assert.equal(features[2], feat3) }) + it('should sort feature with space first', function () { + feat1.properties.mykey = "1 foo" + feat2.properties.mykey = "2 foo" + feat3.properties.mykey = "1a foo" + let features = L.Util.sortFeatures([feat1, feat2, feat3], "mykey") + assert.equal(features[0], feat1) + assert.equal(features[1], feat3) + assert.equal(features[2], feat2) + }) }) })