1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)

This commit is contained in:
Nguyen Viet Hung
2020-02-05 13:28:27 +13:00
committed by GitHub
parent 051ce9e208
commit 592aca1539
186 changed files with 9233 additions and 5565 deletions

View File

@@ -9,16 +9,23 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
// [input, expected]
const testCases = [
['&lt;a href=', '<a href='],
['var test = &apos;test&apos;', 'var test = \'test\''],
['&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
['&lt;\\\\?php\n var = &apos;hoge&apos;;', '<\\\\?php\n var = \'hoge\';'],
['var test = &apos;test&apos;', "var test = 'test'"],
[
'&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote',
"<a href='https://boostnote.io'>Boostnote"
],
['&lt;\\\\?php\n var = &apos;hoge&apos;;', "<\\\\?php\n var = 'hoge';"],
['&amp;', '&'],
['a&#36;&apos;', 'a\\$\'']
['a&#36;&apos;', "a\\$'"]
]
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(htmlTextHelper.decodeEntities(input), expected, `Test for decodeEntities() input: ${input} expected: ${expected}`)
t.is(
htmlTextHelper.decodeEntities(input),
expected,
`Test for decodeEntities() input: ${input} expected: ${expected}`
)
})
})
@@ -26,29 +33,40 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
// [input, expected]
const testCases = [
['<a href=', '&lt;a href='],
['var test = \'test\'', 'var test = &apos;test&apos;'],
['<a href=\'https://boostnote.io\'>Boostnote', '&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote'],
['<?php\n var = \'hoge\';', '&lt;&#63;php\n var = &apos;hoge&apos;;'],
['a$\'', 'a&#36;&apos;']
["var test = 'test'", 'var test = &apos;test&apos;'],
[
"<a href='https://boostnote.io'>Boostnote",
'&lt;a href=&apos;https://boostnote.io&apos;&gt;Boostnote'
],
["<?php\n var = 'hoge';", '&lt;&#63;php\n var = &apos;hoge&apos;;'],
["a$'", 'a&#36;&apos;']
]
testCases.forEach(testCase => {
const [input, expected] = testCase
t.is(htmlTextHelper.encodeEntities(input), expected, `Test for encodeEntities() input: ${input} expected: ${expected}`)
t.is(
htmlTextHelper.encodeEntities(input),
expected,
`Test for encodeEntities() input: ${input} expected: ${expected}`
)
})
})
// Integration test
test(t => {
const testCases = [
'var test = \'test\'',
'<a href=\'https://boostnote.io\'>Boostnote',
'<Component styleName=\'test\' />'
"var test = 'test'",
"<a href='https://boostnote.io'>Boostnote",
"<Component styleName='test' />"
]
testCases.forEach(testCase => {
const encodedText = htmlTextHelper.encodeEntities(testCase)
const decodedText = htmlTextHelper.decodeEntities(encodedText)
t.is(decodedText, testCase, 'Integration test through encodedText() and decodedText()')
t.is(
decodedText,
testCase,
'Integration test through encodedText() and decodedText()'
)
})
})