-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tabset, Tab, Tabgroup snapshot test
- Loading branch information
Showing
3 changed files
with
323 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import Tab from '../Tab.vue'; | ||
import TabGroup from '../TabGroup.vue'; | ||
import Tabset from '../Tabset.vue'; | ||
|
||
const DEFAULT_STUBS = { | ||
'tab': Tab, | ||
'tab-group': TabGroup, | ||
}; | ||
|
||
const TABSET_HEADER = 'Tabset Header'; | ||
|
||
const TAB_COMPONENT = ` | ||
<tab header="Tab 1"> | ||
Text in the first tab | ||
</tab> | ||
<tab header="Tab 2"> | ||
Text in the second tab | ||
</tab> | ||
`; | ||
|
||
const TABGROUP_COMPONENT = ` | ||
<tab-group header="Third tab group :milky_way:"> | ||
<tab header="Stars :star:"> | ||
Some stuff about stars ... | ||
</tab> | ||
<tab header="Disabled Moon :new_moon:" disabled> | ||
</tab> | ||
</tab-group> | ||
<tab-group header="Disabled fourth tab group" disabled> | ||
<tab header="Hidden tab"> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper ultrices lobortis. | ||
</tab> | ||
</tab-group> | ||
`; | ||
|
||
const TAB_AND_TABGROUP_COMPONENT = ` | ||
${TAB_COMPONENT} | ||
${TABGROUP_COMPONENT} | ||
`; | ||
|
||
describe('Tabset (Tabs) with Tab and Tab-Group Components', () => { | ||
test('renders tabset with tabs', () => { | ||
const wrapper = mount(Tabset, { | ||
slots: { | ||
header: TABSET_HEADER, | ||
default: TAB_COMPONENT, | ||
}, | ||
stubs: DEFAULT_STUBS, | ||
}); | ||
|
||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders tabset with tab-group', () => { | ||
const wrapper = mount(Tabset, { | ||
slots: { | ||
header: TABSET_HEADER, | ||
default: TABGROUP_COMPONENT, | ||
}, | ||
stubs: DEFAULT_STUBS, | ||
}); | ||
|
||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
|
||
test('renders tabset with both tabs and tab-group', () => { | ||
const wrapper = mount(Tabset, { | ||
slots: { | ||
header: TABSET_HEADER, | ||
default: TAB_AND_TABGROUP_COMPONENT, | ||
}, | ||
stubs: DEFAULT_STUBS, | ||
}); | ||
|
||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
}); |
244 changes: 244 additions & 0 deletions
244
packages/vue-components/src/__tests__/__snapshots__/Tabset.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,244 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Tabset (Tabs) with Tab and Tab-Group Components renders tabset with both tabs and tab-group 1`] = ` | ||
<div | ||
class="printable-tabs" | ||
> | ||
<ul | ||
class="nav nav-tabs d-print-none nav-tabs" | ||
role="tablist" | ||
/> | ||
<div | ||
class="tab-content" | ||
> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Text in the first tab | ||
<hr /> | ||
</div> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Text in the second tab | ||
<hr /> | ||
</div> | ||
<div | ||
class="printable-tab-group" | ||
> | ||
<div | ||
class="printable-tab-group-header" | ||
/> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Some stuff about stars ... | ||
<hr /> | ||
</div> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
<hr /> | ||
</div> | ||
</div> | ||
<div | ||
class="printable-tab-group" | ||
> | ||
<div | ||
class="printable-tab-group-header" | ||
/> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper ultrices lobortis. | ||
<hr /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Tabset (Tabs) with Tab and Tab-Group Components renders tabset with tab-group 1`] = ` | ||
<div | ||
class="printable-tabs" | ||
> | ||
<ul | ||
class="nav nav-tabs d-print-none nav-tabs" | ||
role="tablist" | ||
/> | ||
<div | ||
class="tab-content" | ||
> | ||
<div | ||
class="printable-tab-group" | ||
> | ||
<div | ||
class="printable-tab-group-header" | ||
/> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Some stuff about stars ... | ||
<hr /> | ||
</div> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
<hr /> | ||
</div> | ||
</div> | ||
<div | ||
class="printable-tab-group" | ||
> | ||
<div | ||
class="printable-tab-group-header" | ||
/> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper ultrices lobortis. | ||
<hr /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Tabset (Tabs) with Tab and Tab-Group Components renders tabset with tabs 1`] = ` | ||
<div | ||
class="printable-tabs" | ||
> | ||
<ul | ||
class="nav nav-tabs d-print-none nav-tabs" | ||
role="tablist" | ||
/> | ||
<div | ||
class="tab-content" | ||
> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Text in the first tab | ||
<hr /> | ||
</div> | ||
<div | ||
class="tab-pane active printable-tab-pane tab-pane-hide" | ||
role="tabpanel" | ||
> | ||
<div | ||
class="nav-tabs printable-tab-header" | ||
> | ||
<div | ||
class="nav-link active" | ||
/> | ||
</div> | ||
Text in the second tab | ||
<hr /> | ||
</div> | ||
</div> | ||
</div> | ||
`; |