mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-18 11:58:44 +00:00
lint js
This commit is contained in:
@@ -109,7 +109,7 @@ const BrewCleanup = ({})=>{
|
|||||||
<td style={{ width: '200px' }}>{Moment(brew.updatedAt).fromNow()}</td>
|
<td style={{ width: '200px' }}>{Moment(brew.updatedAt).fromNow()}</td>
|
||||||
<td>{brew.lastViewed ? Moment(brew.lastViewed).fromNow() : 'No last viewed date'}</td>
|
<td>{brew.lastViewed ? Moment(brew.lastViewed).fromNow() : 'No last viewed date'}</td>
|
||||||
<td>{brew.googleId ? 'Google' : 'Homebrewery'}</td>
|
<td>{brew.googleId ? 'Google' : 'Homebrewery'}</td>
|
||||||
</tr>
|
</tr>;
|
||||||
})}
|
})}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -120,7 +120,7 @@ const BrewCleanup = ({})=>{
|
|||||||
|
|
||||||
return <div className='result'>
|
return <div className='result'>
|
||||||
{deleteButton && <button onClick={()=>cleanup(type)} className='remove'>
|
{deleteButton && <button onClick={()=>cleanup(type)} className='remove'>
|
||||||
{pendingLost && type === "lost" || pendingJunk && type === "junk"
|
{pendingLost && type === 'lost' || pendingJunk && type === 'junk'
|
||||||
? <i className='fas fa-spin fa-spinner' />
|
? <i className='fas fa-spin fa-spinner' />
|
||||||
: <span><i className='fas fa-times' /> Remove</span>
|
: <span><i className='fas fa-times' /> Remove</span>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const settingsCompartment = new Compartment();
|
|||||||
|
|
||||||
import { generalKeymap, markdownKeymap, cssKeymap, formatCSS } from './extensions/customKeyMaps.js';
|
import { generalKeymap, markdownKeymap, cssKeymap, formatCSS } from './extensions/customKeyMaps.js';
|
||||||
import foldOnPages from './extensions/customFolding.js';
|
import foldOnPages from './extensions/customFolding.js';
|
||||||
import { customHighlightStyle , customHighlightPlugin } from './extensions/customHighlight.js';
|
import { customHighlightStyle, customHighlightPlugin } from './extensions/customHighlight.js';
|
||||||
import { legacyCustomHighlightStyle } from './extensions/legacyCustomHighlight.js';
|
import { legacyCustomHighlightStyle } from './extensions/legacyCustomHighlight.js';
|
||||||
|
|
||||||
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;
|
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;
|
||||||
|
|||||||
@@ -14,25 +14,24 @@ export async function formatCSS(view) {
|
|||||||
const code = empty ? fullDoc : selection;
|
const code = empty ? fullDoc : selection;
|
||||||
|
|
||||||
let formatted = await prettier.format(code, {
|
let formatted = await prettier.format(code, {
|
||||||
parser: 'css',
|
parser : 'css',
|
||||||
plugins: [postcssPlugin],
|
plugins : [postcssPlugin],
|
||||||
|
|
||||||
// formatting options
|
// formatting options
|
||||||
tabWidth: 2,
|
tabWidth : 2,
|
||||||
useTabs: false,
|
useTabs : false,
|
||||||
printWidth: 100,
|
printWidth : 100,
|
||||||
singleQuote: false,
|
singleQuote : false,
|
||||||
trailingComma: 'all',
|
trailingComma : 'all',
|
||||||
bracketSpacing: true,
|
bracketSpacing : true,
|
||||||
endOfLine: 'lf'
|
endOfLine : 'lf'
|
||||||
});
|
});
|
||||||
|
|
||||||
//format manually single declaration rules to span one line.
|
//format manually single declaration rules to span one line.
|
||||||
//Prettier can't do it by default, this is crude but it works
|
//Prettier can't do it by default, this is crude but it works
|
||||||
formatted = formatted.replace(
|
formatted = formatted.replace(
|
||||||
/([^{]+)\{\s*\n\s*([^;\n]+:[^;\n]+;)\s*\n\s*\}(\s*)/g,
|
/([^{]+)\{\s*\n\s*([^;\n]+:[^;\n]+;)\s*\n\s*\}(\s*)/g,
|
||||||
(_, selector, decl, whitespace) =>
|
(_, selector, decl, whitespace)=>`${selector} { ${decl.trim()} }${whitespace}`
|
||||||
`${selector} { ${decl.trim()} }${whitespace}`
|
|
||||||
);
|
);
|
||||||
if(formatted === code) return true;
|
if(formatted === code) return true;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const Combobox = createReactClass({
|
|||||||
displayName : 'Combobox',
|
displayName : 'Combobox',
|
||||||
getDefaultProps : function() {
|
getDefaultProps : function() {
|
||||||
return {
|
return {
|
||||||
id : '',
|
id : '',
|
||||||
className : '',
|
className : '',
|
||||||
trigger : 'hover',
|
trigger : 'hover',
|
||||||
default : '',
|
default : '',
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ const BrewRenderer = (props)=>{
|
|||||||
const pagesRef = useRef(null);
|
const pagesRef = useRef(null);
|
||||||
|
|
||||||
const [visiblePages, setVisiblePages] = useState([]);
|
const [visiblePages, setVisiblePages] = useState([]);
|
||||||
const [centerPage , setCenterPage ] = useState(1);
|
const [centerPage, setCenterPage] = useState(1);
|
||||||
const [headerState , setHeaderState ] = useState(false);
|
const [headerState, setHeaderState] = useState(false);
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
isMounted : false,
|
isMounted : false,
|
||||||
@@ -158,10 +158,9 @@ const BrewRenderer = (props)=>{
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderDummyPage = (index)=>
|
const renderDummyPage = (index)=><div className='phb page' id={`p${index + 1}`} key={index}>
|
||||||
<div className='phb page' id={`p${index + 1}`} key={index}>
|
<i className='fas fa-spinner fa-spin' />
|
||||||
<i className='fas fa-spinner fa-spin' />
|
</div>;
|
||||||
</div>;
|
|
||||||
|
|
||||||
const renderStyle = ()=>{
|
const renderStyle = ()=>{
|
||||||
const themeStyles = props.themeBundle?.joinedStyles ?? '<style>@import url("/themes/V3/Blank/style.css");</style>';
|
const themeStyles = props.themeBundle?.joinedStyles ?? '<style>@import url("/themes/V3/Blank/style.css");</style>';
|
||||||
|
|||||||
@@ -100,12 +100,12 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
|
|||||||
<div id='preview-toolbar' className={`toolBar ${toolsVisible ? 'visible' : 'hidden'}`} role='toolbar'>
|
<div id='preview-toolbar' className={`toolBar ${toolsVisible ? 'visible' : 'hidden'}`} role='toolbar'>
|
||||||
<div className='toggleButton'>
|
<div className='toggleButton'>
|
||||||
<button data-tooltip-right={`${toolsVisible ? 'Hide' : 'Show'} Preview Toolbar`}
|
<button data-tooltip-right={`${toolsVisible ? 'Hide' : 'Show'} Preview Toolbar`}
|
||||||
aria-label={`${toolsVisible ? 'Hide' : 'Show'} Preview Toolbar`}
|
aria-label={`${toolsVisible ? 'Hide' : 'Show'} Preview Toolbar`}
|
||||||
onClick={()=>{ setToolsVisible(!toolsVisible); localStorage.setItem(TOOLBAR_VISIBILITY, !toolsVisible); }}>
|
onClick={()=>{ setToolsVisible(!toolsVisible); localStorage.setItem(TOOLBAR_VISIBILITY, !toolsVisible); }}>
|
||||||
<i aria-hidden='true' className='fas fa-glasses' />
|
<i aria-hidden='true' className='fas fa-glasses' />
|
||||||
</button>
|
</button>
|
||||||
<button data-tooltip-right={`${headerState ? 'Hide' : 'Show'} Header Navigation`}
|
<button data-tooltip-right={`${headerState ? 'Hide' : 'Show'} Header Navigation`}
|
||||||
aria-label={`${headerState ? 'Hide' : 'Show'} Header Navigation`}
|
aria-label={`${headerState ? 'Hide' : 'Show'} Header Navigation`}
|
||||||
onClick={()=>{setHeaderState(!headerState);}}>
|
onClick={()=>{setHeaderState(!headerState);}}>
|
||||||
<i aria-hidden='true' className='fas fa-rectangle-list' />
|
<i aria-hidden='true' className='fas fa-rectangle-list' />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ const SettingsEditor = ({ settings, updateSettings = ()=>{}, EditorThemeNameList
|
|||||||
onChange={(e)=>handleFieldChange('fontSize', e)}
|
onChange={(e)=>handleFieldChange('fontSize', e)}
|
||||||
/>
|
/>
|
||||||
<datalist id='font-sizes'>
|
<datalist id='font-sizes'>
|
||||||
<option value='1' />
|
<option value='1' />
|
||||||
</datalist>
|
</datalist>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function(){
|
|||||||
return ()=>{
|
return ()=>{
|
||||||
document.removeEventListener('print:startprep', handlePrintStartPrep);
|
document.removeEventListener('print:startprep', handlePrintStartPrep);
|
||||||
document.removeEventListener('print:finishedprep', handlePrintPrepFinished);
|
document.removeEventListener('print:finishedprep', handlePrintPrepFinished);
|
||||||
}
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handlePrintStartPrep = ()=>{ setPrinting(true); };
|
const handlePrintStartPrep = ()=>{ setPrinting(true); };
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
||||||
|
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx'
|
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||||
|
|
||||||
import SplitPane from '@components/splitPane/splitPane.jsx';
|
import SplitPane from '@components/splitPane/splitPane.jsx';
|
||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
|
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx'
|
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||||
|
|
||||||
import SplitPane from '@components/splitPane/splitPane.jsx';
|
import SplitPane from '@components/splitPane/splitPane.jsx';
|
||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable max-lines */
|
|
||||||
import './newPage.less';
|
import './newPage.less';
|
||||||
|
|
||||||
// Common imports
|
// Common imports
|
||||||
@@ -10,7 +10,7 @@ import _ from 'lodash';
|
|||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
import { printCurrentBrew, fetchThemeBundle, splitTextStyleAndMetadata } from '@shared/helpers.js';
|
import { printCurrentBrew, fetchThemeBundle, splitTextStyleAndMetadata } from '@shared/helpers.js';
|
||||||
|
|
||||||
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx'
|
import useCommonEditPageFunctions from '../../utils/commonEditPageFunctions.jsx';
|
||||||
|
|
||||||
import SplitPane from '@components/splitPane/splitPane.jsx';
|
import SplitPane from '@components/splitPane/splitPane.jsx';
|
||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
save,
|
save,
|
||||||
} = dependencies;
|
} = dependencies;
|
||||||
|
|
||||||
const [isSaving , setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const [lastSavedTime , setLastSavedTime] = useState(new Date());
|
const [lastSavedTime, setLastSavedTime] = useState(new Date());
|
||||||
const [autoSaveEnabled , setAutoSaveEnabled] = useState(!sandbox);
|
const [autoSaveEnabled, setAutoSaveEnabled] = useState(!sandbox);
|
||||||
const [warnUnsavedChanges, setWarnUnsavedChanges] = useState(true);
|
const [warnUnsavedChanges, setWarnUnsavedChanges] = useState(true);
|
||||||
const [unsavedChanges , setUnsavedChanges] = useState(false);
|
const [unsavedChanges, setUnsavedChanges] = useState(false);
|
||||||
|
|
||||||
const unsavedChangesRef = useRef(unsavedChanges); // onBeforeUnload lives outside React and needs ref to unsavedChanges
|
const unsavedChangesRef = useRef(unsavedChanges); // onBeforeUnload lives outside React and needs ref to unsavedChanges
|
||||||
const warnUnsavedTimeout = useRef(null); // timers live outside React and need ref to consistently track time
|
const warnUnsavedTimeout = useRef(null); // timers live outside React and need ref to consistently track time
|
||||||
@@ -105,7 +105,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
if(field == 'metadata') localStorage.setItem(METAKEY, JSON.stringify({
|
if(field == 'metadata') localStorage.setItem(METAKEY, JSON.stringify({
|
||||||
renderer : value.renderer,
|
renderer : value.renderer,
|
||||||
theme : value.theme,
|
theme : value.theme,
|
||||||
lang : value.lang
|
lang : value.lang
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -155,7 +155,7 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
|
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-circle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-circle'>
|
||||||
Reminder...
|
Reminder...
|
||||||
<div className='errorContainer'>{text}</div>
|
<div className='errorContainer'>{text}</div>
|
||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,5 +180,5 @@ export default function useCommonEditPageFunctions(dependencies) {
|
|||||||
renderSaveButton,
|
renderSaveButton,
|
||||||
autoSaveEnabled,
|
autoSaveEnabled,
|
||||||
unsavedChanges,
|
unsavedChanges,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
+8
-8
@@ -44,7 +44,7 @@ export default function createAdminApi(vite) {
|
|||||||
updatedAt : { $lt: Moment().subtract(30, 'days').toDate() },
|
updatedAt : { $lt: Moment().subtract(30, 'days').toDate() },
|
||||||
lastViewed : { $lt: Moment().subtract(30, 'days').toDate() }
|
lastViewed : { $lt: Moment().subtract(30, 'days').toDate() }
|
||||||
} },
|
} },
|
||||||
{ $project: { _id: 1, textBinSize: { $binarySize: '$textBin' }, updatedAt: 1, lastViewed: 1} },
|
{ $project: { _id: 1, textBinSize: { $binarySize: '$textBin' }, updatedAt: 1, lastViewed: 1 } },
|
||||||
{ $match: { textBinSize: { $lt: 140 } } },
|
{ $match: { textBinSize: { $lt: 140 } } },
|
||||||
{ $limit: 300 }
|
{ $limit: 300 }
|
||||||
];
|
];
|
||||||
@@ -52,14 +52,14 @@ export default function createAdminApi(vite) {
|
|||||||
// Search for up to 500 unauthored brews that have not been viewed or updated in two years
|
// Search for up to 500 unauthored brews that have not been viewed or updated in two years
|
||||||
const lostBrewsPipeline = [
|
const lostBrewsPipeline = [
|
||||||
{
|
{
|
||||||
$match: {
|
$match : {
|
||||||
authors: [],
|
authors : [],
|
||||||
updatedAt: { $lt: Moment().subtract(2, 'years').toDate() },
|
updatedAt : { $lt: Moment().subtract(2, 'years').toDate() },
|
||||||
lastViewed: { $lt: Moment().subtract(2, 'years').toDate() }
|
lastViewed : { $lt: Moment().subtract(2, 'years').toDate() }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$limit: 500
|
$limit : 500
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ export default function createAdminApi(vite) {
|
|||||||
|
|
||||||
router.get('/admin/cleanupJunk', mw.adminOnly, (req, res)=>{
|
router.get('/admin/cleanupJunk', mw.adminOnly, (req, res)=>{
|
||||||
HomebrewModel.aggregate(junkBrewsPipeline).option({ maxTimeMS: 60000 })
|
HomebrewModel.aggregate(junkBrewsPipeline).option({ maxTimeMS: 60000 })
|
||||||
.then((objs)=>res.json({ count: objs.length, brewCollection : objs }))
|
.then((objs)=>res.json({ count: objs.length, brewCollection: objs }))
|
||||||
.catch((error)=>{
|
.catch((error)=>{
|
||||||
console.error(error);
|
console.error(error);
|
||||||
res.status(500).json({ error: 'Internal Server Error' });
|
res.status(500).json({ error: 'Internal Server Error' });
|
||||||
@@ -93,7 +93,7 @@ export default function createAdminApi(vite) {
|
|||||||
|
|
||||||
router.get('/admin/cleanupLost', mw.adminOnly, (req, res)=>{
|
router.get('/admin/cleanupLost', mw.adminOnly, (req, res)=>{
|
||||||
HomebrewModel.aggregate(lostBrewsPipeline).option({ maxTimeMS: 60000 })
|
HomebrewModel.aggregate(lostBrewsPipeline).option({ maxTimeMS: 60000 })
|
||||||
.then((objs)=>res.json({ count: objs.length, brewCollection : objs }))
|
.then((objs)=>res.json({ count: objs.length, brewCollection: objs }))
|
||||||
.catch((error)=>{
|
.catch((error)=>{
|
||||||
console.error(error);
|
console.error(error);
|
||||||
res.status(500).json({ error: 'Internal Server Error' });
|
res.status(500).json({ error: 'Internal Server Error' });
|
||||||
|
|||||||
+4
-4
@@ -137,7 +137,7 @@ export default async function createApp(vite) {
|
|||||||
return res.sendFile(`robots.txt`, { root: process.cwd() });
|
return res.sendFile(`robots.txt`, { root: process.cwd() });
|
||||||
});
|
});
|
||||||
//serve brew for sharepage rerender
|
//serve brew for sharepage rerender
|
||||||
app.get('/api/fetch/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, res) => {
|
app.get('/api/fetch/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, res)=>{
|
||||||
const { brew } = req;
|
const { brew } = req;
|
||||||
brew.authors.includes(req.account?.username)
|
brew.authors.includes(req.account?.username)
|
||||||
? sanitizeBrew(brew, 'shareAuthor')
|
? sanitizeBrew(brew, 'shareAuthor')
|
||||||
@@ -285,9 +285,9 @@ export default async function createApp(vite) {
|
|||||||
'<head>',
|
'<head>',
|
||||||
`<head>\n`
|
`<head>\n`
|
||||||
+ `<script id="props">`
|
+ `<script id="props">`
|
||||||
+ `window.__INITIAL_PROPS__ = ` + safeProps
|
+ `window.__INITIAL_PROPS__ = ${safeProps
|
||||||
+ `</script>\n`
|
}</script>\n${
|
||||||
+ ogMetaTags
|
ogMetaTags}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
+108
-108
@@ -360,25 +360,25 @@ describe('Tests for api', ()=>{
|
|||||||
trashed : false,
|
trashed : false,
|
||||||
updatedAt : undefined,
|
updatedAt : undefined,
|
||||||
views : 0,
|
views : 0,
|
||||||
bleedSize: {
|
bleedSize : {
|
||||||
top: '.125in',
|
top : '.125in',
|
||||||
bottom: '.125in',
|
bottom : '.125in',
|
||||||
inner: '.125in',
|
inner : '.125in',
|
||||||
outer: '.125in',
|
outer : '.125in',
|
||||||
},
|
},
|
||||||
columns: '2',
|
columns : '2',
|
||||||
columnGutter: '.125in',
|
columnGutter : '.125in',
|
||||||
legalAuthors: '',
|
legalAuthors : '',
|
||||||
license: 'None',
|
license : 'None',
|
||||||
safetySpace: {
|
safetySpace : {
|
||||||
top: '.25in',
|
top : '.25in',
|
||||||
bottom: '.25in',
|
bottom : '.25in',
|
||||||
outer: '.25in',
|
outer : '.25in',
|
||||||
inner: '.5in',
|
inner : '.5in',
|
||||||
},
|
},
|
||||||
trimSize: {
|
trimSize : {
|
||||||
width: '8.5in',
|
width : '8.5in',
|
||||||
height: '11in',
|
height : '11in',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(next).toHaveBeenCalled();
|
expect(next).toHaveBeenCalled();
|
||||||
@@ -471,25 +471,25 @@ describe('Tests for api', ()=>{
|
|||||||
renderer : 'v3',
|
renderer : 'v3',
|
||||||
theme : 'phb',
|
theme : 'phb',
|
||||||
googleId : '12345',
|
googleId : '12345',
|
||||||
bleedSize: {
|
bleedSize : {
|
||||||
top: '.125in',
|
top : '.125in',
|
||||||
bottom: '.125in',
|
bottom : '.125in',
|
||||||
inner: '.125in',
|
inner : '.125in',
|
||||||
outer: '.125in',
|
outer : '.125in',
|
||||||
},
|
},
|
||||||
columns: '2',
|
columns : '2',
|
||||||
columnGutter: '.125in',
|
columnGutter : '.125in',
|
||||||
legalAuthors: '',
|
legalAuthors : '',
|
||||||
license: 'None',
|
license : 'None',
|
||||||
safetySpace: {
|
safetySpace : {
|
||||||
top: '.25in',
|
top : '.25in',
|
||||||
bottom: '.25in',
|
bottom : '.25in',
|
||||||
outer: '.25in',
|
outer : '.25in',
|
||||||
inner: '.5in',
|
inner : '.5in',
|
||||||
},
|
},
|
||||||
trimSize: {
|
trimSize : {
|
||||||
width: '8.5in',
|
width : '8.5in',
|
||||||
height: '11in',
|
height : '11in',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -534,25 +534,25 @@ brew`);
|
|||||||
renderer : 'v3',
|
renderer : 'v3',
|
||||||
theme : 'phb',
|
theme : 'phb',
|
||||||
googleId : '12345',
|
googleId : '12345',
|
||||||
bleedSize: {
|
bleedSize : {
|
||||||
top: '.125in',
|
top : '.125in',
|
||||||
bottom: '.125in',
|
bottom : '.125in',
|
||||||
inner: '.125in',
|
inner : '.125in',
|
||||||
outer: '.125in',
|
outer : '.125in',
|
||||||
},
|
},
|
||||||
columns: '2',
|
columns : '2',
|
||||||
columnGutter: '.125in',
|
columnGutter : '.125in',
|
||||||
legalAuthors: '',
|
legalAuthors : '',
|
||||||
license: 'None',
|
license : 'None',
|
||||||
safetySpace: {
|
safetySpace : {
|
||||||
top: '.25in',
|
top : '.25in',
|
||||||
bottom: '.25in',
|
bottom : '.25in',
|
||||||
outer: '.25in',
|
outer : '.25in',
|
||||||
inner: '.5in',
|
inner : '.5in',
|
||||||
},
|
},
|
||||||
trimSize: {
|
trimSize : {
|
||||||
width: '8.5in',
|
width : '8.5in',
|
||||||
height: '11in',
|
height : '11in',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -687,16 +687,16 @@ brew`);
|
|||||||
|
|
||||||
expect(res.status).toHaveBeenCalledWith(200);
|
expect(res.status).toHaveBeenCalledWith(200);
|
||||||
expect(res.send).toHaveBeenCalledWith({
|
expect(res.send).toHaveBeenCalledWith({
|
||||||
_id : '1',
|
_id : '1',
|
||||||
authors : ['test user'],
|
authors : ['test user'],
|
||||||
createdAt : undefined,
|
createdAt : undefined,
|
||||||
description : '',
|
description : '',
|
||||||
editId : expect.any(String),
|
editId : expect.any(String),
|
||||||
gDrive : false,
|
gDrive : false,
|
||||||
pageCount : 1,
|
pageCount : 1,
|
||||||
published : false,
|
published : false,
|
||||||
renderer : 'V3',
|
renderer : 'V3',
|
||||||
lang : 'en',
|
lang : 'en',
|
||||||
shareId : expect.any(String),
|
shareId : expect.any(String),
|
||||||
style : undefined,
|
style : undefined,
|
||||||
tags : [],
|
tags : [],
|
||||||
@@ -708,25 +708,25 @@ brew`);
|
|||||||
trashed : false,
|
trashed : false,
|
||||||
updatedAt : undefined,
|
updatedAt : undefined,
|
||||||
views : 0,
|
views : 0,
|
||||||
bleedSize: {
|
bleedSize : {
|
||||||
top: '.125in',
|
top : '.125in',
|
||||||
bottom: '.125in',
|
bottom : '.125in',
|
||||||
inner: '.125in',
|
inner : '.125in',
|
||||||
outer: '.125in',
|
outer : '.125in',
|
||||||
},
|
},
|
||||||
columns: '2',
|
columns : '2',
|
||||||
columnGutter: '.125in',
|
columnGutter : '.125in',
|
||||||
legalAuthors: '',
|
legalAuthors : '',
|
||||||
license: 'None',
|
license : 'None',
|
||||||
safetySpace: {
|
safetySpace : {
|
||||||
top: '.25in',
|
top : '.25in',
|
||||||
bottom: '.25in',
|
bottom : '.25in',
|
||||||
outer: '.25in',
|
outer : '.25in',
|
||||||
inner: '.5in',
|
inner : '.5in',
|
||||||
},
|
},
|
||||||
trimSize: {
|
trimSize : {
|
||||||
width: '8.5in',
|
width : '8.5in',
|
||||||
height: '11in',
|
height : '11in',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -765,16 +765,16 @@ brew`);
|
|||||||
expect(google.newGoogleBrew).toHaveBeenCalled();
|
expect(google.newGoogleBrew).toHaveBeenCalled();
|
||||||
expect(res.status).toHaveBeenCalledWith(200);
|
expect(res.status).toHaveBeenCalledWith(200);
|
||||||
expect(res.send).toHaveBeenCalledWith({
|
expect(res.send).toHaveBeenCalledWith({
|
||||||
_id : '1',
|
_id : '1',
|
||||||
authors : ['test user'],
|
authors : ['test user'],
|
||||||
bleedSize: {
|
bleedSize : {
|
||||||
top: '.125in',
|
top : '.125in',
|
||||||
bottom: '.125in',
|
bottom : '.125in',
|
||||||
inner: '.125in',
|
inner : '.125in',
|
||||||
outer: '.125in',
|
outer : '.125in',
|
||||||
},
|
},
|
||||||
columns: '2',
|
columns : '2',
|
||||||
columnGutter: '.125in',
|
columnGutter : '.125in',
|
||||||
createdAt : undefined,
|
createdAt : undefined,
|
||||||
description : '',
|
description : '',
|
||||||
editId : expect.any(String),
|
editId : expect.any(String),
|
||||||
@@ -784,29 +784,29 @@ brew`);
|
|||||||
renderer : 'V3',
|
renderer : 'V3',
|
||||||
lang : 'en',
|
lang : 'en',
|
||||||
shareId : expect.any(String),
|
shareId : expect.any(String),
|
||||||
legalAuthors: '',
|
legalAuthors : '',
|
||||||
license: 'None',
|
license : 'None',
|
||||||
safetySpace: {
|
safetySpace : {
|
||||||
top: '.25in',
|
top : '.25in',
|
||||||
bottom: '.25in',
|
bottom : '.25in',
|
||||||
outer: '.25in',
|
outer : '.25in',
|
||||||
inner: '.5in',
|
inner : '.5in',
|
||||||
},
|
},
|
||||||
googleId : expect.any(String),
|
googleId : expect.any(String),
|
||||||
style : undefined,
|
style : undefined,
|
||||||
tags : [],
|
tags : [],
|
||||||
text : undefined,
|
text : undefined,
|
||||||
textBin : undefined,
|
textBin : undefined,
|
||||||
theme : '5ePHB',
|
theme : '5ePHB',
|
||||||
thumbnail : '',
|
thumbnail : '',
|
||||||
title : 'asdf',
|
title : 'asdf',
|
||||||
trashed : false,
|
trashed : false,
|
||||||
trimSize: {
|
trimSize : {
|
||||||
width: '8.5in',
|
width : '8.5in',
|
||||||
height: '11in',
|
height : '11in',
|
||||||
},
|
},
|
||||||
updatedAt : undefined,
|
updatedAt : undefined,
|
||||||
views : 0
|
views : 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+21
-21
@@ -47,19 +47,19 @@ describe(`brewSnippetsToJSON`, ()=>{
|
|||||||
gen : 'I am the first brew snippet!\n',
|
gen : 'I am the first brew snippet!\n',
|
||||||
name : 'First Brew Snippet'
|
name : 'First Brew Snippet'
|
||||||
}, {
|
}, {
|
||||||
gen : 'I am the second brew Snippet!',
|
gen : 'I am the second brew Snippet!',
|
||||||
name: 'Second Brew Snippet'
|
name : 'Second Brew Snippet'
|
||||||
}
|
}
|
||||||
]}]
|
] }]
|
||||||
};
|
};
|
||||||
const rendered = brewSnippetsToJSON(`Test Snippets JSON without theme snippets`, brewSnippetsBrewTest, null, true);
|
const rendered = brewSnippetsToJSON(`Test Snippets JSON without theme snippets`, brewSnippetsBrewTest, null, true);
|
||||||
expect(rendered).toStrictEqual(testMenuObject);
|
expect(rendered).toStrictEqual(testMenuObject);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('converts raw brew snippets with theme snippets to JSON', function() {
|
it('converts raw brew snippets with theme snippets to JSON', function() {
|
||||||
const testMenuObject = {
|
const testMenuObject = {
|
||||||
groupName : 'Brew Snippets',
|
groupName : 'Brew Snippets',
|
||||||
icon : 'fas fa-th-list',
|
icon : 'fas fa-th-list',
|
||||||
view : 'text',
|
view : 'text',
|
||||||
snippets : [{
|
snippets : [{
|
||||||
gen : '',
|
gen : '',
|
||||||
@@ -76,20 +76,20 @@ describe(`brewSnippetsToJSON`, ()=>{
|
|||||||
icon : '',
|
icon : '',
|
||||||
name : 'Second Theme Snippet',
|
name : 'Second Theme Snippet',
|
||||||
},
|
},
|
||||||
]},
|
] },
|
||||||
{
|
{
|
||||||
name : 'Test Snippets JSON with theme snippets',
|
name : 'Test Snippets JSON with theme snippets',
|
||||||
subsnippets : [
|
subsnippets : [
|
||||||
{
|
{
|
||||||
gen : 'I am the first brew snippet!\n',
|
gen : 'I am the first brew snippet!\n',
|
||||||
name : 'First Brew Snippet'
|
name : 'First Brew Snippet'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
gen : 'I am the second brew Snippet!',
|
gen : 'I am the second brew Snippet!',
|
||||||
name: 'Second Brew Snippet'
|
name : 'Second Brew Snippet'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]};
|
}] };
|
||||||
const rendered = brewSnippetsToJSON(`Test Snippets JSON with theme snippets`, brewSnippetsBrewTest, brewSnippetsThemeTest, true);
|
const rendered = brewSnippetsToJSON(`Test Snippets JSON with theme snippets`, brewSnippetsBrewTest, brewSnippetsThemeTest, true);
|
||||||
expect(rendered).toStrictEqual(testMenuObject);
|
expect(rendered).toStrictEqual(testMenuObject);
|
||||||
});
|
});
|
||||||
@@ -103,8 +103,8 @@ describe(`YAMLSnippetsToText`, ()=>{
|
|||||||
gen : 'I am the first brew snippet!\n',
|
gen : 'I am the first brew snippet!\n',
|
||||||
name : 'First Brew Snippet'
|
name : 'First Brew Snippet'
|
||||||
}, {
|
}, {
|
||||||
gen : 'I am the second brew Snippet!',
|
gen : 'I am the second brew Snippet!',
|
||||||
name: 'Second Brew Snippet'
|
name : 'Second Brew Snippet'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import {hbfm} from 'marked-hbfm';
|
import { hbfm } from 'marked-hbfm';
|
||||||
|
|
||||||
describe('Non-Breaking Spaces Interactions', ()=>{
|
describe('Non-Breaking Spaces Interactions', ()=>{
|
||||||
test('I am actually a single-line definition list!', function() {
|
test('I am actually a single-line definition list!', function() {
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'DTRPG Community Content',
|
name : 'DTRPG Community Content',
|
||||||
icon : null,
|
icon : null,
|
||||||
subsnippets : [
|
subsnippets : [
|
||||||
{
|
{
|
||||||
name : 'Chronicle System Guild Colophon',
|
name : 'Chronicle System Guild Colophon',
|
||||||
|
|||||||
Reference in New Issue
Block a user