mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Merge branch 'master' of https://github.com/BoostIO/Boostnote into spell_check
# Conflicts: # browser/components/CodeEditor.js # locales/fr.json # package.json
This commit is contained in:
@@ -200,7 +200,7 @@ it('should test that getAttachmentsInContent finds all attachments', function ()
|
||||
' </body>\n' +
|
||||
'</html>'
|
||||
const actual = systemUnderTest.getAttachmentsInContent(testInput)
|
||||
const expected = [':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg']
|
||||
const expected = [':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp.png', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx.pdf', ':storage' + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg']
|
||||
expect(actual).toEqual(expect.arrayContaining(expected))
|
||||
})
|
||||
|
||||
@@ -225,8 +225,8 @@ it('should test that getAbsolutePathsOfAttachmentsInContent returns all absolute
|
||||
' </body>\n' +
|
||||
'</html>'
|
||||
const actual = systemUnderTest.getAbsolutePathsOfAttachmentsInContent(testInput, dummyStoragePath)
|
||||
const expected = [dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp',
|
||||
dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx',
|
||||
const expected = [dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.6r4zdgc22xp.png',
|
||||
dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + '0.q2i4iw0fyx.pdf',
|
||||
dummyStoragePath + path.sep + systemUnderTest.DESTINATION_FOLDER + path.sep + '9c9c4ba3-bc1e-441f-9866-c1e9a806e31c' + path.sep + 'd6c5ee92.jpg']
|
||||
expect(actual).toEqual(expect.arrayContaining(expected))
|
||||
})
|
||||
|
||||
38
tests/dataApi/toggleStorage-test.js
Normal file
38
tests/dataApi/toggleStorage-test.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const test = require('ava')
|
||||
const toggleStorage = require('browser/main/lib/dataApi/toggleStorage')
|
||||
|
||||
global.document = require('jsdom').jsdom('<body></body>')
|
||||
global.window = document.defaultView
|
||||
global.navigator = window.navigator
|
||||
|
||||
const Storage = require('dom-storage')
|
||||
const localStorage = window.localStorage = global.localStorage = new Storage(null, { strict: true })
|
||||
const path = require('path')
|
||||
const _ = require('lodash')
|
||||
const TestDummy = require('../fixtures/TestDummy')
|
||||
const sander = require('sander')
|
||||
const os = require('os')
|
||||
|
||||
const storagePath = path.join(os.tmpdir(), 'test/toggle-storage')
|
||||
|
||||
test.beforeEach((t) => {
|
||||
t.context.storage = TestDummy.dummyStorage(storagePath)
|
||||
localStorage.setItem('storages', JSON.stringify([t.context.storage.cache]))
|
||||
})
|
||||
|
||||
test.serial('Toggle a storage location', (t) => {
|
||||
const storageKey = t.context.storage.cache.key
|
||||
return Promise.resolve()
|
||||
.then(function doTest () {
|
||||
return toggleStorage(storageKey, true)
|
||||
})
|
||||
.then(function assert (data) {
|
||||
const cachedStorageList = JSON.parse(localStorage.getItem('storages'))
|
||||
t.true(_.find(cachedStorageList, {key: storageKey}).isOpen === true)
|
||||
})
|
||||
})
|
||||
|
||||
test.after(function after () {
|
||||
localStorage.clear()
|
||||
sander.rimrafSync(storagePath)
|
||||
})
|
||||
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