Skip to content

Commit

Permalink
Address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Dec 14, 2022
1 parent 9971b3f commit 36d901e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ export default defineComponent({
}
},
computed: {
iconName(): string {
iconName() {
if (this.isSpace) return defaultSpaceIcon
if (this.isFolder) return defaultFolderIcon
const icon = iconNameMap[this.extension]
return `resource-type-${icon ? icon : defaultFallbackIcon}`
},
iconColor(): string {
iconColor() {
if (this.isSpace) return defaultSpaceColor
if (this.isFolder) return defaultFolderColor
const color = iconColorMap[this.extension]
return color ? color : defaultFallbackIconColor
},
iconTypeClass(): string {
iconTypeClass() {
if (this.isSpace) return 'oc-resource-icon-space'
if (this.isFolder) return 'oc-resource-icon-folder'
return 'oc-resource-icon-file'
},
isFolder(): boolean {
isFolder() {
// fallback is necessary since
// sometimes resources without a type
// but with `isFolder` are being passed
return this.resource.type === 'folder' || this.resource.isFolder
},
isSpace(): boolean {
isSpace() {
return this.resource.type === 'space'
},
extension(): string {
extension() {
return this.resource.extension?.toLowerCase()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('ViewOptions', () => {
expect(wrapper.find('[data-testid="viewmode-switch-buttons"]').exists()).toBeFalsy()
})

it('shows a viewmode switcher if more than one viewModes are passes', () => {
it('shows a viewmode switcher if more than one viewModes are passed', () => {
const wrapper = shallowMount(ViewOptions, {
propsData: {
viewModes: ['one', 'two']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ViewOptions shows a viewmode switcher if more than one viewModes are passes 1`] = `
exports[`ViewOptions shows a viewmode switcher if more than one viewModes are passed 1`] = `
<div data-testid="viewmode-switch-buttons" class="oc-button-group oc-visible@s oc-mr-s">
<oc-button-stub appearance="outline">
<oc-icon-stub name="menu-line-condensed" fill-type="none" size="small"></oc-icon-stub>
Expand Down

0 comments on commit 36d901e

Please sign in to comment.