-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carlos Viteri
committed
Jan 31, 2025
1 parent
2aa7967
commit 569646b
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/components/surfaceNavigation/__tests__/CdrSurfaceNavigation.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,47 @@ | ||
import { mount } from '../../../../test/vue-jest-style-workaround.js'; | ||
import CdrSurfaceNavigation from '../CdrSurfaceNavigation.vue'; | ||
import CdrSurfaceNavigationLink from '../CdrSurfaceNavigationLink.vue'; | ||
|
||
describe('CdrSurface', () => { | ||
describe('snapshot test', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = mount(CdrSurfaceNavigation); | ||
}); | ||
it('renders correctly', () => { | ||
wrapper.setProps({ palette: 'default' }); | ||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('component unit tests', () => { | ||
let wrapper; | ||
let link; | ||
beforeEach(() => { | ||
wrapper = mount(CdrSurfaceNavigation); | ||
link = mount(CdrSurfaceNavigationLink); | ||
}); | ||
|
||
describe('default component with no configuration', () => { | ||
it('renders correctly', () => { | ||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
it('sets the default tag prop correctly', () => { | ||
expect(wrapper.element.tagName).toBe('DIV'); | ||
expect(link.element.tagName).toBe('A'); | ||
}); | ||
it('default class added', () => { | ||
expect(wrapper.classes()).toEqual([ | ||
'cdr-surface-navigation', | ||
'cdr-surface-navigation-radius-sharp--rest', | ||
'cdr-surface-navigation-shadow-flat--rest', | ||
]); | ||
}); | ||
}); | ||
|
||
it('has data-palette attribute set to "default" by default', () => { | ||
expect(wrapper.attributes('data-palette')).toBe('default'); | ||
}); | ||
|
||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
src/components/surfaceNavigation/__tests__/__snapshots__/CdrSurfaceNavigation.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,23 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`CdrSurface > component unit tests > default component with no configuration > renders correctly 1`] = ` | ||
<div | ||
class="cdr-surface-navigation cdr-surface-navigation-radius-sharp--rest cdr-surface-navigation-shadow-flat--rest" | ||
data-palette="default" | ||
> | ||
<!-- @slot Where all default content should be placed. --> | ||
</div> | ||
`; | ||
|
||
exports[`CdrSurface > snapshot test > renders correctly 1`] = ` | ||
<div | ||
class="cdr-surface-navigation cdr-surface-navigation-radius-sharp--rest cdr-surface-navigation-shadow-flat--rest" | ||
data-palette="default" | ||
> | ||
<!-- @slot Where all default content should be placed. --> | ||
</div> | ||
`; |