-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
14 changed files
with
654 additions
and
62 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
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
10 changes: 10 additions & 0 deletions
10
src/tests/components/NavBar/NavBarDropdownSeparator.test.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,10 @@ | ||
import { expect, test, describe } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
import NavBarDropdownSeparator from '../../../components/NavBar/NavBarDropdownSeparator.vue' | ||
|
||
describe('NavBarDropdownSeparator.vue', () => { | ||
test('Render correctly', () => { | ||
const wrapper = mount(NavBarDropdownSeparator) | ||
expect(wrapper.exists()).toBe(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { expect, test, describe } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
import { createRouter, createWebHistory } from 'vue-router' | ||
import NavBarItem from '../../../components/NavBar/NavBarItem.vue' | ||
|
||
// Mock router | ||
const router = createRouter({ | ||
history: createWebHistory(), | ||
routes: [ | ||
{ | ||
path: '/', | ||
name: 'home', | ||
component: NavBarItem | ||
} | ||
] | ||
}) | ||
|
||
describe('NavBarItem.vue', () => { | ||
test('No props or slots', () => { | ||
// Arrange | ||
const wrapper = mount(NavBarItem, { | ||
global: { | ||
plugins: [router] | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.exists()).toBe(true) | ||
expect(wrapper.text()).toMatch('') | ||
}) | ||
|
||
test('External link, using both props', () => { | ||
// Arrange | ||
const wrapper = mount(NavBarItem, { | ||
props: { | ||
to: 'http://userfrosting.com', | ||
label: 'UserFrosting' | ||
}, | ||
global: { | ||
plugins: [router] | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.text()).toMatch('UserFrosting') | ||
}) | ||
|
||
test('External link, using slot', () => { | ||
// Arrange | ||
const wrapper = mount(NavBarItem, { | ||
props: { | ||
to: 'http://userfrosting.com', | ||
label: 'This is the Label as prop' | ||
}, | ||
slots: { | ||
default: 'This is the slot content' | ||
}, | ||
global: { | ||
plugins: [router] | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.text()).toMatch('This is the slot content') | ||
}) | ||
|
||
test('Internal, using both props', () => { | ||
// Arrange | ||
const wrapper = mount(NavBarItem, { | ||
props: { | ||
to: '/', | ||
label: 'UserFrosting' | ||
}, | ||
global: { | ||
plugins: [router] | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.text()).toMatch('UserFrosting') | ||
}) | ||
|
||
test('Internal, using both slot', () => { | ||
// Arrange | ||
const wrapper = mount(NavBarItem, { | ||
props: { | ||
to: '/', | ||
label: 'This is the Label as prop' | ||
}, | ||
slots: { | ||
default: 'This is the slot content' | ||
}, | ||
global: { | ||
plugins: [router] | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.text()).toMatch('This is the slot content') | ||
}) | ||
}) |
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,12 @@ | ||
import { expect, test, describe } from 'vitest' | ||
import { mount, config } from '@vue/test-utils' | ||
import NavBarLogin from '../../../components/NavBar/NavBarLogin.vue' | ||
|
||
config.global.stubs['FormLogin'] = { template: '<span></span>' } | ||
|
||
describe('NavBarLogin.vue', () => { | ||
test('Render correctly', () => { | ||
const wrapper = mount(NavBarLogin) | ||
expect(wrapper.exists()).toBe(true) | ||
}) | ||
}) |
Oops, something went wrong.