mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
add test
This commit is contained in:
@@ -506,7 +506,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
ref='root'
|
ref='root'
|
||||||
tabIndex='-1'
|
tabIndex='-1'
|
||||||
style={{
|
style={{
|
||||||
fontFamily: fontFamily.join(', '),
|
fontFamily,
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
width: width
|
width: width
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import isString from 'lodash/isString'
|
|||||||
export default function normalizeEditorFontFamily (fontFamily) {
|
export default function normalizeEditorFontFamily (fontFamily) {
|
||||||
const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY
|
const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY
|
||||||
return isString(fontFamily) && fontFamily.length > 0
|
return isString(fontFamily) && fontFamily.length > 0
|
||||||
? [fontFamily].concat(defaultEditorFontFamily)
|
? [fontFamily].concat(defaultEditorFontFamily).join(', ')
|
||||||
: defaultEditorFontFamily
|
: defaultEditorFontFamily.join(', ')
|
||||||
}
|
}
|
||||||
|
|||||||
16
tests/lib/normalize-editor-font-family-test.js
Normal file
16
tests/lib/normalize-editor-font-family-test.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Unit test for browser/lib/normalizeEditorFontFamily
|
||||||
|
*/
|
||||||
|
import test from 'ava'
|
||||||
|
import normalizeEditorFontFamily from '../../browser/lib/normalizeEditorFontFamily'
|
||||||
|
import consts from '../../browser/lib/consts'
|
||||||
|
const defaultEditorFontFamily = consts.DEFAULT_EDITOR_FONT_FAMILY
|
||||||
|
|
||||||
|
test('normalizeEditorFontFamily() should return default font family (string[])', t => {
|
||||||
|
t.is(normalizeEditorFontFamily(), defaultEditorFontFamily.join(', '))
|
||||||
|
})
|
||||||
|
|
||||||
|
test('normalizeEditorFontFamily(["hoge", "huga"]) should return default font family connected with arg.', t => {
|
||||||
|
const arg = 'font1, font2'
|
||||||
|
t.is(normalizeEditorFontFamily(arg), `${arg}, ${defaultEditorFontFamily.join(', ')}`)
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user