Added some tests for nav-button
This commit is contained in:
parent
0ec9fdccaf
commit
5cbd6c4e46
2 changed files with 36 additions and 1 deletions
35
src/common-components/nav-button/nav-button.spec.js
Normal file
35
src/common-components/nav-button/nav-button.spec.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import navButton from "./nav-button"
|
||||
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
|
||||
describe('NavButton', () => {
|
||||
|
||||
it('should display input when type is button', () => {
|
||||
const wrapper = shallowMount(navButton, {
|
||||
propsData: {
|
||||
text: "Hello",
|
||||
scenario: "test",
|
||||
type: "button"
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('input').exists()).toBe(true);
|
||||
expect(wrapper.find('p').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('should display p element when type is text', () => {
|
||||
const wrapper = shallowMount(navButton, {
|
||||
propsData: {
|
||||
text: "Hello",
|
||||
scenario: "test",
|
||||
type: "text"
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.find('input').exists()).toBe(false);
|
||||
expect(wrapper.find('p').exists()).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<script>
|
||||
|
||||
export default({
|
||||
name: "nav-button",
|
||||
name: "navButton",
|
||||
props: {
|
||||
text: String,
|
||||
scenario: String,
|
||||
|
|
|
|||
Loading…
Reference in a new issue