Kill old icons logic
This commit is contained in:
1 parent
97899570ae
commit
ac44228b94
4 files changed
+18
-50
No files matched your search
@@ -1,115 +1,101 @@
|
||||
/**
|
||||
*
|
||||
* @param {String} [baseDirectory='/']
|
||||
*/
|
||||
export default function(baseDirectory = '/') {
|
||||
const iconsFileName = 'icons.svg'
|
||||
const sanitizedBaseDirectory =
|
||||
baseDirectory[baseDirectory.length - 1] === '/'
|
||||
? baseDirectory
|
||||
: `${baseDirectory}/`
|
||||
const relativePathToIcons = `${sanitizedBaseDirectory}${iconsFileName}`.replace(
|
||||
'//',
|
||||
'/'
|
||||
)
|
||||
|
||||
export default function() {
|
||||
return [
|
||||
{
|
||||
command: 'StackScroll',
|
||||
type: 'tool',
|
||||
text: 'Stack Scroll',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-stack-scroll`,
|
||||
icon: 'tool-stack-scroll',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Zoom',
|
||||
type: 'tool',
|
||||
text: 'Zoom',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-zoom`,
|
||||
icon: 'tool-zoom',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Wwwc',
|
||||
type: 'tool',
|
||||
text: 'Levels',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-levels`,
|
||||
icon: 'tool-levels',
|
||||
active: true,
|
||||
},
|
||||
{
|
||||
command: 'Pan',
|
||||
type: 'tool',
|
||||
text: 'Pan',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-pan`,
|
||||
icon: 'tool-pan',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Length',
|
||||
type: 'tool',
|
||||
text: 'Length',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-measure-temp`,
|
||||
icon: 'tool-measure-temp',
|
||||
active: false,
|
||||
},
|
||||
/*{
|
||||
command: 'Annotate',
|
||||
type: 'tool',
|
||||
text: 'Annotate',
|
||||
svgUrl: `${Icons}#icon-tools-measure-non-target`,
|
||||
icon: `${Icons}#icon-tools-measure-non-target`,
|
||||
active: false
|
||||
},*/
|
||||
{
|
||||
command: 'Angle',
|
||||
type: 'tool',
|
||||
text: 'Angle',
|
||||
iconClasses: 'fa fa-angle-left',
|
||||
icon: 'angle-left',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Bidirectional',
|
||||
type: 'tool',
|
||||
text: 'Bidirectional',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-measure-target`,
|
||||
icon: 'tool-measure-target',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Brush',
|
||||
type: 'tool',
|
||||
text: 'Brush',
|
||||
iconClasses: 'fa fa-circle',
|
||||
icon: 'circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'FreehandMouse',
|
||||
type: 'tool',
|
||||
text: 'Freehand',
|
||||
iconClasses: 'fa fa-star',
|
||||
icon: 'star',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'EllipticalRoi',
|
||||
type: 'tool',
|
||||
text: 'EllipticalRoi',
|
||||
iconClasses: 'far fa-circle',
|
||||
icon: 'circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'CircleRoi',
|
||||
type: 'tool',
|
||||
text: 'CircleRoi',
|
||||
iconClasses: 'far fa-dot-circle',
|
||||
icon: 'dot-circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'RectangleRoi',
|
||||
type: 'tool',
|
||||
text: 'RectangleRoi',
|
||||
iconClasses: 'far fa-square',
|
||||
icon: 'square',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'reset',
|
||||
type: 'command',
|
||||
text: 'Reset',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-reset`,
|
||||
icon: 'tool-reset',
|
||||
active: false,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -2,25 +2,8 @@ import getDefaultToolbarButtons from './getDefaultToolbarButtons.js'
|
||||
|
||||
describe('getDefaultToolbarButtons.js', () => {
|
||||
it('returns a non-empty array', () => {
|
||||
const basePath = '/'
|
||||
|
||||
const buttons = getDefaultToolbarButtons(basePath)
|
||||
const buttons = getDefaultToolbarButtons()
|
||||
|
||||
expect(buttons.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('uses the provided basePath in buttons with an svgUrl property', () => {
|
||||
const basePath = '/demo/'
|
||||
|
||||
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()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user