prettier applied to all files in src/
This commit is contained in:
1 parent
433bb219b0
commit
fb7c229b43
69 files changed
+1128
-1116
No files matched your search
@@ -3,15 +3,15 @@
|
||||
* @param {String} [baseDirectory='/']
|
||||
*/
|
||||
export default function(baseDirectory = '/') {
|
||||
const iconsFileName = 'icons.svg'
|
||||
const iconsFileName = 'icons.svg';
|
||||
const sanitizedBaseDirectory =
|
||||
baseDirectory[baseDirectory.length - 1] === '/'
|
||||
? baseDirectory
|
||||
: `${baseDirectory}/`
|
||||
: `${baseDirectory}/`;
|
||||
const relativePathToIcons = `${sanitizedBaseDirectory}${iconsFileName}`.replace(
|
||||
'//',
|
||||
'/'
|
||||
)
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -112,5 +112,5 @@ export default function(baseDirectory = '/') {
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-reset`,
|
||||
active: false,
|
||||
},
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1,26 +1,26 @@
|
||||
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js'
|
||||
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js';
|
||||
|
||||
describe('getDefaultToolbarButtons.js', () => {
|
||||
it('returns a non-empty array', () => {
|
||||
const basePath = '/'
|
||||
const basePath = '/';
|
||||
|
||||
const buttons = getDefaultToolbarButtons(basePath)
|
||||
const buttons = getDefaultToolbarButtons(basePath);
|
||||
|
||||
expect(buttons.length).toBeGreaterThan(0)
|
||||
})
|
||||
expect(buttons.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('uses the provided basePath in buttons with an svgUrl property', () => {
|
||||
const basePath = '/demo/'
|
||||
const basePath = '/demo/';
|
||||
|
||||
const buttons = getDefaultToolbarButtons(basePath)
|
||||
const buttons = getDefaultToolbarButtons(basePath);
|
||||
const hasOneOrMoreButtonsWithSvgUrlProperty = buttons.some(btn =>
|
||||
btn.hasOwnProperty('svgUrl')
|
||||
)
|
||||
);
|
||||
const usesBasePathInButtonSvgUrls = buttons.every(
|
||||
btn => !btn.hasOwnProperty('svgUrl') || btn.svgUrl.includes(basePath)
|
||||
)
|
||||
);
|
||||
|
||||
expect(hasOneOrMoreButtonsWithSvgUrlProperty).toBeTruthy()
|
||||
expect(usesBasePathInButtonSvgUrls).toBeTruthy()
|
||||
})
|
||||
})
|
||||
expect(hasOneOrMoreButtonsWithSvgUrlProperty).toBeTruthy();
|
||||
expect(usesBasePathInButtonSvgUrls).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
// https://github.com/maxmantz/redux-oidc/blob/master/docs/API.md
|
||||
import { loadUser, createUserManager } from 'redux-oidc'
|
||||
import { loadUser, createUserManager } from 'redux-oidc';
|
||||
|
||||
/**
|
||||
* Creates a userManager from oidcSettings;
|
||||
@@ -17,7 +17,7 @@ import { loadUser, createUserManager } from 'redux-oidc'
|
||||
*/
|
||||
export default function(store, oidcSettings) {
|
||||
if (!store || !oidcSettings) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
const settings = {
|
||||
@@ -27,11 +27,11 @@ export default function(store, oidcSettings) {
|
||||
revokeAccessTokenOnSignout: true,
|
||||
filterProtocolClaims: true,
|
||||
loadUserInfo: true,
|
||||
}
|
||||
};
|
||||
|
||||
const userManager = createUserManager(settings)
|
||||
const userManager = createUserManager(settings);
|
||||
|
||||
loadUser(store, userManager)
|
||||
loadUser(store, userManager);
|
||||
|
||||
return userManager
|
||||
return userManager;
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
import getUserManagerForOpenIdConnectClient from './getUserManagerForOpenIdConnectClient.js'
|
||||
import getUserManagerForOpenIdConnectClient from './getUserManagerForOpenIdConnectClient.js';
|
||||
|
||||
describe('getUserManagerForOpenIdConnectClient', () => {
|
||||
it('returns undefined if store is not provided', () => {
|
||||
const expectedReturnVal = undefined
|
||||
const returnVal = getUserManagerForOpenIdConnectClient(undefined, {})
|
||||
const expectedReturnVal = undefined;
|
||||
const returnVal = getUserManagerForOpenIdConnectClient(undefined, {});
|
||||
|
||||
expect(returnVal).toEqual(expectedReturnVal)
|
||||
})
|
||||
expect(returnVal).toEqual(expectedReturnVal);
|
||||
});
|
||||
|
||||
it('returns undefined if oidcSettings are not provided', () => {
|
||||
const expectedReturnVal = undefined
|
||||
const returnVal = getUserManagerForOpenIdConnectClient({}, undefined)
|
||||
const expectedReturnVal = undefined;
|
||||
const returnVal = getUserManagerForOpenIdConnectClient({}, undefined);
|
||||
|
||||
expect(returnVal).toEqual(expectedReturnVal)
|
||||
})
|
||||
expect(returnVal).toEqual(expectedReturnVal);
|
||||
});
|
||||
|
||||
it('does not return undefined when store and oidcSettings are defined', () => {
|
||||
const returnVal = getUserManagerForOpenIdConnectClient({}, {})
|
||||
const returnVal = getUserManagerForOpenIdConnectClient({}, {});
|
||||
|
||||
expect(returnVal).not.toBe(undefined)
|
||||
})
|
||||
})
|
||||
expect(returnVal).not.toBe(undefined);
|
||||
});
|
||||
});
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js'
|
||||
import getUserManagerForOpenIdConnectClient from './getUserManagerForOpenIdConnectClient.js'
|
||||
import initWebWorkers from './initWebWorkers.js'
|
||||
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js';
|
||||
import getUserManagerForOpenIdConnectClient from './getUserManagerForOpenIdConnectClient.js';
|
||||
import initWebWorkers from './initWebWorkers.js';
|
||||
|
||||
export {
|
||||
getDefaultToolbarButtons,
|
||||
getUserManagerForOpenIdConnectClient,
|
||||
initWebWorkers,
|
||||
}
|
||||
};
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as utils from './index.js'
|
||||
import * as utils from './index.js';
|
||||
|
||||
describe('utils', () => {
|
||||
it('has the expected exports', () => {
|
||||
const utilExports = Object.keys(utils).sort()
|
||||
const utilExports = Object.keys(utils).sort();
|
||||
|
||||
expect(utilExports).toEqual(
|
||||
[
|
||||
@@ -10,6 +10,6 @@ describe('utils', () => {
|
||||
'getUserManagerForOpenIdConnectClient',
|
||||
'initWebWorkers',
|
||||
].sort()
|
||||
)
|
||||
})
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -8,7 +8,7 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
|
||||
export default function(baseDirectory, webWorkScriptsPath) {
|
||||
const scriptsPath = `${window.location.protocol}//${
|
||||
window.location.host
|
||||
}${baseDirectory}/${webWorkScriptsPath}`
|
||||
}${baseDirectory}/${webWorkScriptsPath}`;
|
||||
const config = {
|
||||
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
|
||||
startWebWorkersOnDemand: true,
|
||||
@@ -22,7 +22,7 @@ export default function(baseDirectory, webWorkScriptsPath) {
|
||||
strict: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
cornerstoneWADOImageLoader.webWorkerManager.initialize(config)
|
||||
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
import initWebWorkers from './initWebWorkers.js'
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
|
||||
import initWebWorkers from './initWebWorkers.js';
|
||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
|
||||
describe('initWebWorkers', () => {
|
||||
it("initializes cornerstoneWADOImageLoader's web workers", () => {
|
||||
const basePath = '/'
|
||||
const relativeWebWorkerScriptsPath = ''
|
||||
const basePath = '/';
|
||||
const relativeWebWorkerScriptsPath = '';
|
||||
|
||||
initWebWorkers(basePath, relativeWebWorkerScriptsPath)
|
||||
initWebWorkers(basePath, relativeWebWorkerScriptsPath);
|
||||
|
||||
expect(
|
||||
cornerstoneWADOImageLoader.webWorkerManager.initialize
|
||||
).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user