-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/testing): add QToolbar & QToolbarTitle test files
- Loading branch information
1 parent
12748be
commit 6a3f916
Showing
2 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { mount, flushPromises } from '@vue/test-utils' | ||
import { describe, test, expect } from 'vitest' | ||
|
||
import QToolbar from './QToolbar.js' | ||
|
||
describe('[QToolbar API]', () => { | ||
describe('[Props]', () => { | ||
describe('[(prop)inset]', () => { | ||
test('is defined correctly', () => { | ||
expect(QToolbar.props.inset).toBeDefined() | ||
}) | ||
|
||
test('type Boolean has effect', async () => { | ||
const wrapper = mount(QToolbar) | ||
const target = wrapper.get('.q-toolbar') | ||
|
||
expect( | ||
target.classes() | ||
).not.toContain('q-toolbar--inset') | ||
|
||
await wrapper.setProps({ inset: true }) | ||
await flushPromises() | ||
|
||
expect( | ||
target.classes() | ||
).toContain('q-toolbar--inset') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('[Slots]', () => { | ||
describe('[(slot)default]', () => { | ||
test('renders the content', () => { | ||
const slotContent = 'some-slot-content' | ||
const wrapper = mount(QToolbar, { | ||
slots: { | ||
default: () => slotContent | ||
} | ||
}) | ||
|
||
expect(wrapper.html()).toContain(slotContent) | ||
}) | ||
}) | ||
}) | ||
}) |
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,45 @@ | ||
import { mount, flushPromises } from '@vue/test-utils' | ||
import { describe, test, expect } from 'vitest' | ||
|
||
import QToolbarTitle from './QToolbarTitle.js' | ||
|
||
describe('[QToolbarTitle API]', () => { | ||
describe('[Props]', () => { | ||
describe('[(prop)shrink]', () => { | ||
test('is defined correctly', () => { | ||
expect(QToolbarTitle.props.shrink).toBeDefined() | ||
}) | ||
|
||
test('type Boolean has effect', async () => { | ||
const wrapper = mount(QToolbarTitle) | ||
const target = wrapper.get('.q-toolbar__title') | ||
|
||
expect( | ||
target.classes() | ||
).not.toContain('col-shrink') | ||
|
||
await wrapper.setProps({ shrink: true }) | ||
await flushPromises() | ||
|
||
expect( | ||
target.classes() | ||
).toContain('col-shrink') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('[Slots]', () => { | ||
describe('[(slot)default]', () => { | ||
test('renders the content', () => { | ||
const slotContent = 'some-slot-content' | ||
const wrapper = mount(QToolbarTitle, { | ||
slots: { | ||
default: () => slotContent | ||
} | ||
}) | ||
|
||
expect(wrapper.html()).toContain(slotContent) | ||
}) | ||
}) | ||
}) | ||
}) |