-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: port CvCheckboxSkeleton to Vue3
- Loading branch information
Showing
5 changed files
with
61 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div | ||
class="cv-checkbox" | ||
:class="`${carbonPrefix}--form-item ${carbonPrefix}--checkbox-wrapper`" | ||
> | ||
<label :class="`${carbonPrefix}--checkbox-label ${carbonPrefix}--skeleton`"> | ||
<span | ||
:class="`${carbonPrefix}--checkbox-label-text ${carbonPrefix}--skeleton`" | ||
></span> | ||
</label> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { carbonPrefix } from '../../global/settings'; | ||
</script> |
27 changes: 27 additions & 0 deletions
27
src/components/CvCheckbox/__tests__/CvCheckboxSkeleton.spec.js
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,27 @@ | ||
import { shallowMount } from '@vue/test-utils'; | ||
import { carbonPrefix } from '../../../global/settings'; | ||
import CvCheckboxSkeleton from '../CvCheckboxSkeleton.vue'; | ||
|
||
describe('CvCheckboxSkeleton', () => { | ||
it('renders checkbox skeleton', async () => { | ||
const wrapper = shallowMount(CvCheckboxSkeleton); | ||
|
||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders checkbox skeleton with required visual elements', () => { | ||
const wrapper = shallowMount(CvCheckboxSkeleton); | ||
|
||
const skeletonWrapper = wrapper.find('.cv-checkbox'); | ||
const skeletonLabel = skeletonWrapper.find( | ||
`.${carbonPrefix}--checkbox-label` | ||
); | ||
const skeletonText = skeletonWrapper.find( | ||
`.${carbonPrefix}--checkbox-label-text` | ||
); | ||
const expectedSkeletonClass = `${carbonPrefix}--skeleton`; | ||
|
||
expect(skeletonLabel.classes()).toContain(expectedSkeletonClass); | ||
expect(skeletonText.classes()).toContain(expectedSkeletonClass); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
src/components/CvCheckbox/__tests__/__snapshots__/CvCheckboxSkeleton.spec.js.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,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CvCheckboxSkeleton renders checkbox skeleton 1`] = `<div class="cv-checkbox bx--form-item bx--checkbox-wrapper"><label class="bx--checkbox-label bx--skeleton"><span class="bx--checkbox-label-text bx--skeleton"></span></label></div>`; |
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,3 +1,4 @@ | ||
import CvCheckbox from './CvCheckbox.vue'; | ||
export { CvCheckbox }; | ||
import CvCheckboxSkeleton from './CvCheckboxSkeleton.vue'; | ||
export { CvCheckbox, CvCheckboxSkeleton }; | ||
export default CvCheckbox; |