mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Fix styles by lint
This commit is contained in:
@@ -39,5 +39,5 @@ export function encodeEntities (text) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
decodeEntities,
|
decodeEntities,
|
||||||
encodeEntities,
|
encodeEntities
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => {
|
|||||||
// [input, expected]
|
// [input, expected]
|
||||||
const testCases = [
|
const testCases = [
|
||||||
['<a href=', '<a href='],
|
['<a href=', '<a href='],
|
||||||
['var test = 'test'', "var test = 'test'"],
|
['var test = 'test'', 'var test = \'test\''],
|
||||||
['<a href='https://boostnote.io'>Boostnote', "<a href='https://boostnote.io'>Boostnote"],
|
['<a href='https://boostnote.io'>Boostnote', '<a href=\'https://boostnote.io\'>Boostnote'],
|
||||||
["<\\?php\n var = 'hoge';", "<\\?php\n var = 'hoge';"],
|
['<\\\\?php\n var = 'hoge';', '<\\\\?php\n var = \'hoge\';'],
|
||||||
["&", "&"],
|
['&', '&']
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
const [input, expected] = 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}`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -25,28 +25,28 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t =>
|
|||||||
// [input, expected]
|
// [input, expected]
|
||||||
const testCases = [
|
const testCases = [
|
||||||
['<a href=', '<a href='],
|
['<a href=', '<a href='],
|
||||||
["var test = 'test'", 'var test = 'test''],
|
['var test = \'test\'', 'var test = 'test''],
|
||||||
["<a href='https://boostnote.io'>Boostnote", '<a href='https://boostnote.io'>Boostnote'],
|
['<a href=\'https://boostnote.io\'>Boostnote', '<a href='https://boostnote.io'>Boostnote'],
|
||||||
["<?php\n var = 'hoge';", "<?php\n var = 'hoge';"],
|
['<?php\n var = \'hoge\';', '<?php\n var = 'hoge';']
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
const [input, expected] = 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
|
// Integration test
|
||||||
test(t => {
|
test(t => {
|
||||||
const testCases = [
|
const testCases = [
|
||||||
"var test = 'test'",
|
'var test = \'test\'',
|
||||||
"<a href='https://boostnote.io'>Boostnote",
|
'<a href=\'https://boostnote.io\'>Boostnote',
|
||||||
"<Component styleName='test' />",
|
'<Component styleName=\'test\' />'
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
const encodedText = htmlTextHelper.encodeEntities(testCase)
|
const encodedText = htmlTextHelper.encodeEntities(testCase)
|
||||||
const decodedText = htmlTextHelper.decodeEntities(encodedText)
|
const decodedText = htmlTextHelper.decodeEntities(encodedText)
|
||||||
t.is(decodedText, testCase, `Integration test for encodedText() and decodedText()`);
|
t.is(decodedText, testCase, 'Integration test through encodedText() and decodedText()')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user