mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 22:58:28 +02:00
Capitalize filter
This commit is contained in:
parent
dac47da584
commit
2cd90ff4bd
2 changed files with 14 additions and 1 deletions
|
@ -28,4 +28,10 @@ export function ago (date) {
|
||||||
|
|
||||||
Vue.filter('ago', ago)
|
Vue.filter('ago', ago)
|
||||||
|
|
||||||
|
export function capitalize (str) {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
Vue.filter('capitalize', capitalize)
|
||||||
|
|
||||||
export default {}
|
export default {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {truncate, markdown, ago} from '@/filters'
|
import {truncate, markdown, ago, capitalize} from '@/filters'
|
||||||
|
|
||||||
describe('filters', () => {
|
describe('filters', () => {
|
||||||
describe('truncate', () => {
|
describe('truncate', () => {
|
||||||
|
@ -32,4 +32,11 @@ describe('filters', () => {
|
||||||
expect(output).to.equal('a few seconds ago')
|
expect(output).to.equal('a few seconds ago')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
describe('capitalize', () => {
|
||||||
|
it('works', () => {
|
||||||
|
const input = 'hello world'
|
||||||
|
let output = capitalize(input)
|
||||||
|
expect(output).to.equal('Hello world')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue