Test accent
parent
f95cd16cf4
commit
4399839883
1
index.js
1
index.js
|
@ -1,4 +1,5 @@
|
||||||
const sortby = (properties) => (a, b) => {
|
const sortby = (properties) => (a, b) => {
|
||||||
|
// 'base' treat accent as there base character
|
||||||
const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' })
|
const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' })
|
||||||
|
|
||||||
// if items is {prop1:value1, prop2:value2}
|
// if items is {prop1:value1, prop2:value2}
|
||||||
|
|
|
@ -50,6 +50,13 @@ test('sort by new descending', () => {
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('sort with accent, should not change order', () => {
|
||||||
|
const data = [{ name: 'è' }, { name: 'é' }, { name: 'e' }]
|
||||||
|
|
||||||
|
const result = data.sort(sortby(['name']))
|
||||||
|
|
||||||
|
equal(result, [{ name: 'è' }, { name: 'é' }, { name: 'e' }])
|
||||||
|
})
|
||||||
|
|
||||||
import { runifmain, summaryreporter, errorreporter } from 'metaltest'
|
import { runifmain, summaryreporter, errorreporter } from 'metaltest'
|
||||||
await runifmain(import.meta, () => test.run(summaryreporter(), errorreporter()))
|
await runifmain(import.meta, () => test.run(summaryreporter(), errorreporter()))
|
Loading…
Reference in New Issue