-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add selection model to tiles view (#8392)
* Add selection model to tiles view * Add outline to selected tiles * Add unit tests, fix snapshots * Fix checkbox label translation * Exclude spec-files from SonarCloud coverage * Rename setSelection to toggleSelection * Fix initial tile size loading * Improve tile size slider background in dark mode * Use oc-font-size-default instead of rem
- Loading branch information
1 parent
d7f44ff
commit 9a64098
Showing
16 changed files
with
253 additions
and
140 deletions.
There are no files selected for viewing
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
31 changes: 13 additions & 18 deletions
31
packages/design-system/src/components/OcTile/OcTile.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 |
---|---|---|
@@ -1,38 +1,33 @@ | ||
import { shallowMount } from 'web-test-helpers' | ||
import { defaultPlugins, shallowMount } from 'web-test-helpers' | ||
import OcTile from './OcTile.vue' | ||
|
||
const defaultSpace = { | ||
const getSpaceMock = (disabled = false) => ({ | ||
name: 'Space 1', | ||
path: '', | ||
type: 'space', | ||
isFolder: true, | ||
disabled, | ||
getDriveAliasAndItem: () => '1' | ||
} | ||
const disabledSpace = { | ||
name: 'Space 1', | ||
path: '', | ||
type: 'space', | ||
isFolder: true, | ||
disabled: true, | ||
getDriveAliasAndItem: () => '1' | ||
} | ||
}) | ||
|
||
describe('OcTile component', () => { | ||
it('renders default space correctly', () => { | ||
const wrapper = getWrapper({ resource: defaultSpace }) | ||
const wrapper = getWrapper({ resource: getSpaceMock() }) | ||
expect(wrapper.html()).toMatchSnapshot() | ||
}) | ||
it('renders disabled space correctly', () => { | ||
const wrapper = getWrapper({ resource: disabledSpace }) | ||
const wrapper = getWrapper({ resource: getSpaceMock(true) }) | ||
expect(wrapper.html()).toMatchSnapshot() | ||
}) | ||
it('renders selected resource correctly', () => { | ||
const wrapper = getWrapper({ resource: getSpaceMock(), isResourceSelected: true }) | ||
expect(wrapper.find('.oc-tile-card-selected').exists()).toBeTruthy() | ||
}) | ||
|
||
function getWrapper(props = {}, slots = {}) { | ||
function getWrapper(props = {}) { | ||
return shallowMount(OcTile, { | ||
props: { | ||
...props | ||
}, | ||
global: { renderStubDefaultSlot: true } | ||
props, | ||
global: { plugins: [...defaultPlugins()], renderStubDefaultSlot: true } | ||
}) | ||
} | ||
}) |
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
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
Oops, something went wrong.