-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make OcResourceIcon accept space resource, refactor size validation i…
…n design system
- Loading branch information
1 parent
f200071
commit 11a4863
Showing
8 changed files
with
120 additions
and
21 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/design-system/changelog/unreleased/enhancement-resource-icon-space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Enhancement: Make OcResourceIcon accept space resource | ||
|
||
We have modified the OcResourceIcon component to show the space icon if a space resource is passed. | ||
|
||
https://github.com/owncloud/web/pull/8105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/design-system/src/components/OcResourceIcon/OcResourceIcon.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
|
||
import { AVAILABLE_SIZES } from '../../helpers/constants' | ||
import { OcResourceIcon } from '..' | ||
|
||
const resources = ['file', 'folder', 'space'] | ||
|
||
function getWrapper(props) { | ||
return shallowMount(OcResourceIcon, { | ||
propsData: { | ||
resource: { type: props.resourceType }, | ||
size: props.size | ||
} | ||
}) | ||
} | ||
|
||
describe('OcResourceIcon', () => { | ||
resources.forEach((resourceType) => { | ||
AVAILABLE_SIZES.forEach((size) => { | ||
it(`renders OcIcon for resource type ${resourceType} in size ${size}`, () => { | ||
const wrapper = getWrapper({ resourceType, size }) | ||
expect(wrapper).toMatchSnapshot() | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ges/design-system/src/components/OcResourceIcon/__snapshots__/OcResourceIcon.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size large 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="large" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size medium 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size small 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="small" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size xlarge 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="xlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size xsmall 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="xsmall" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size xxlarge 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="xxlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type file in size xxxlarge 1`] = `<oc-icon-stub name="resource-type-file" filltype="fill" accessiblelabel="" type="span" size="xxxlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-file"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size large 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="large" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size medium 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size small 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="small" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size xlarge 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="xlarge" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size xsmall 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="xsmall" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size xxlarge 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="xxlarge" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type folder in size xxxlarge 1`] = `<oc-icon-stub name="resource-type-folder" filltype="fill" accessiblelabel="" type="span" size="xxxlarge" variation="passive" color="var(--oc-color-icon-folder)" class="oc-resource-icon oc-resource-icon-folder"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size large 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="large" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size medium 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size small 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="small" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size xlarge 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="xlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size xsmall 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="xsmall" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size xxlarge 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="xxlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; | ||
|
||
exports[`OcResourceIcon renders OcIcon for resource type space in size xxxlarge 1`] = `<oc-icon-stub name="layout-grid" filltype="fill" accessiblelabel="" type="span" size="xxxlarge" variation="passive" color="var(--oc-color-text-default)" class="oc-resource-icon oc-resource-icon-space"></oc-icon-stub>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters