Do not ignore punctuation when sorting features

fix #1189
This commit is contained in:
Yohan Boniface 2023-07-03 20:19:39 +02:00
parent e03bbeadfc
commit 3ebc83c133
2 changed files with 9 additions and 1 deletions

View file

@ -221,7 +221,6 @@ L.Util.sortFeatures = (features, sortKey) => {
.toLowerCase()
.localeCompare(valB.toString().toLowerCase(), L.locale || 'en', {
sensitivity: 'base',
ignorePunctuation: true,
numeric: true,
})
}

View file

@ -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)
})
})
})