-
-
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.
Add title props to CardBoxBig, Add test
- Loading branch information
Showing
3 changed files
with
63 additions
and
22 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 |
---|---|---|
@@ -1,28 +1,30 @@ | ||
import { expect, test } from 'vitest' | ||
import { describe, expect, test } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
import CardBox from '../../../components/Content/CardBox.vue' | ||
|
||
test('Basic test', () => { | ||
// Arrange | ||
const wrapper = mount(CardBox, { | ||
props: { | ||
title: 'Hello world' | ||
}, | ||
slots: { | ||
default: 'This is the slot content' | ||
} | ||
}) | ||
describe('CardBoxBig.vue', () => { | ||
test('Basic test', () => { | ||
// Arrange | ||
const wrapper = mount(CardBox, { | ||
props: { | ||
title: 'Hello world' | ||
}, | ||
slots: { | ||
default: 'This is the slot content' | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.get('[data-test="title"]').text()).toMatch('Hello world') | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('This is the slot content') | ||
}) | ||
// Assert | ||
expect(wrapper.get('[data-test="title"]').text()).toMatch('Hello world') | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('This is the slot content') | ||
}) | ||
|
||
test('Test with no prop and slot', () => { | ||
// Arrange | ||
const wrapper = mount(CardBox) | ||
test('Test with no prop and slot', () => { | ||
// Arrange | ||
const wrapper = mount(CardBox) | ||
|
||
// Assert | ||
expect(wrapper.find('[data-test="title"]').exists()).toBe(false) | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('') | ||
// Assert | ||
expect(wrapper.find('[data-test="title"]').exists()).toBe(false) | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('') | ||
}) | ||
}) |
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,33 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { mount, config } from '@vue/test-utils' | ||
import CardBox from '../../../components/Content/CardBox.vue' | ||
import CardBoxBig from '../../../components/Content/CardBoxBig.vue' | ||
|
||
config.global.stubs['UFCardBox'] = CardBox | ||
|
||
describe('CardBoxBig.vue', () => { | ||
test('Basic test', () => { | ||
// Arrange | ||
const wrapper = mount(CardBoxBig, { | ||
props: { | ||
title: 'Hello world' | ||
}, | ||
slots: { | ||
default: 'This is the slot content' | ||
} | ||
}) | ||
|
||
// Assert | ||
expect(wrapper.get('[data-test="title"]').text()).toMatch('Hello world') | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('This is the slot content') | ||
}) | ||
|
||
test('Test with no prop and slot', () => { | ||
// Arrange | ||
const wrapper = mount(CardBoxBig) | ||
|
||
// Assert | ||
expect(wrapper.find('[data-test="title"]').exists()).toBe(false) | ||
expect(wrapper.get('[data-test="slot"]').text()).toMatch('') | ||
}) | ||
}) |