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
1 parent
93d0be3
commit 8f8a4b7
Showing
4 changed files
with
70 additions
and
246 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 |
---|---|---|
@@ -1,28 +1,24 @@ | ||
import { render } from '@testing-library/vue'; | ||
import Header from './Header.vue'; | ||
import HeaderNav from './HeaderNav.vue'; | ||
import HeaderNavItem from './HeaderNavItem.vue'; | ||
|
||
// template: '<agnostic-header v-bind="$props"><template v-slot:logoleft><a href="#">Logo on Left</a></template><template v-slot:headernav><agnostic-header-nav><ul><li><a href="#">Home</a></li><li><a href="#">About</a></li></ul></agnostic-header-nav></template><template v-slot:logoright><a href="#">Logo on Right</a></template></agnostic-header>' | ||
test('Header renders', async () => { | ||
const { getByText } = render(Header, { | ||
const { container, getByText } = render(Header, { | ||
components: { | ||
HeaderNav, | ||
HeaderNavItem, | ||
}, | ||
slots: { | ||
logoleft: '<a href="#">Logo Left</a>', | ||
logoright: '<a href="#">Logo Right</a>', | ||
headernav: '<ul><li><a href="#">Home</a></li><li><a href="#">About</a></li></ul>', | ||
headernav: '<HeaderNav><HeaderNavItem><a href="#">Home</a></HeaderNavItem><HeaderNavItem><a href="#">About</a></HeaderNavItem></HeaderNav>', | ||
}, | ||
}); | ||
getByText('Home'); | ||
getByText('About'); | ||
getByText('Logo Left'); | ||
getByText('Logo Right'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
test('snapshot', () => { | ||
const rendered = render(Header, { | ||
slots: { | ||
logoleft: '<a href="#">Logo Left</a>', | ||
logoright: '<a href="#">Logo Right</a>', | ||
headernav: '<ul><li><a href="#">Home</a></li><li><a href="#">About</a></li></ul>', | ||
}, | ||
}) | ||
expect(rendered).toMatchSnapshot(); | ||
}) |
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,21 +1,17 @@ | ||
import { render } from '@testing-library/vue'; | ||
import HeaderNav from './HeaderNav.vue'; | ||
import HeaderNavItem from './HeaderNavItem.vue'; | ||
|
||
test('HeaderNav renders', async () => { | ||
const { getByText } = render(HeaderNav, { | ||
const { container, getByText } = render(HeaderNav, { | ||
components: { | ||
HeaderNavItem, | ||
}, | ||
slots: { | ||
default: '<ul><li><a href="#">Home</a></li><li><a href="#">About</a></li></ul>', | ||
default: '<HeaderNavItem><a href="#">Home</a></HeaderNavItem><HeaderNavItem><a href="#">About</a></HeaderNavItem>', | ||
}, | ||
}); | ||
getByText('Home'); | ||
getByText('About'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
test('snapshot', () => { | ||
const rendered = render(HeaderNav, { | ||
slots: { | ||
default: '<ul><li><a href="#">Home</a></li><li><a href="#">About</a></li></ul>', | ||
}, | ||
}) | ||
expect(rendered).toMatchSnapshot(); | ||
}) |
146 changes: 29 additions & 117 deletions
146
agnosticui-vue/src/stories/__snapshots__/Header.test.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 |
---|---|---|
@@ -1,138 +1,50 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snapshot 1`] = ` | ||
Object { | ||
"baseElement": <body> | ||
<div> | ||
<div | ||
class="header" | ||
> | ||
<div | ||
class="header-content" | ||
> | ||
<a | ||
href="#" | ||
> | ||
Logo Left | ||
</a> | ||
<ul> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
Home | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
About | ||
</a> | ||
</li> | ||
</ul> | ||
<a | ||
href="#" | ||
> | ||
Logo Right | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</body>, | ||
"container": <div> | ||
exports[`Header renders 1`] = ` | ||
<div> | ||
<div | ||
class="header" | ||
> | ||
<div | ||
class="header" | ||
class="header-content" | ||
> | ||
<div | ||
class="header-content" | ||
<a | ||
href="#" | ||
> | ||
<a | ||
href="#" | ||
Logo Left | ||
</a> | ||
<nav> | ||
<ul | ||
class="header-nav" | ||
> | ||
Logo Left | ||
</a> | ||
<ul> | ||
<li> | ||
<li | ||
class="header-nav-item" | ||
> | ||
<a | ||
href="#" | ||
> | ||
Home | ||
</a> | ||
</li> | ||
<li> | ||
<li | ||
class="header-nav-item" | ||
> | ||
<a | ||
href="#" | ||
> | ||
About | ||
</a> | ||
</li> | ||
</ul> | ||
<a | ||
href="#" | ||
> | ||
Logo Right | ||
</a> | ||
</div> | ||
</nav> | ||
<a | ||
href="#" | ||
> | ||
Logo Right | ||
</a> | ||
</div> | ||
</div>, | ||
"debug": [Function], | ||
"emitted": [Function], | ||
"findAllByAltText": [Function], | ||
"findAllByDisplayValue": [Function], | ||
"findAllByLabelText": [Function], | ||
"findAllByPlaceholderText": [Function], | ||
"findAllByRole": [Function], | ||
"findAllByTestId": [Function], | ||
"findAllByText": [Function], | ||
"findAllByTitle": [Function], | ||
"findByAltText": [Function], | ||
"findByDisplayValue": [Function], | ||
"findByLabelText": [Function], | ||
"findByPlaceholderText": [Function], | ||
"findByRole": [Function], | ||
"findByTestId": [Function], | ||
"findByText": [Function], | ||
"findByTitle": [Function], | ||
"getAllByAltText": [Function], | ||
"getAllByDisplayValue": [Function], | ||
"getAllByLabelText": [Function], | ||
"getAllByPlaceholderText": [Function], | ||
"getAllByRole": [Function], | ||
"getAllByTestId": [Function], | ||
"getAllByText": [Function], | ||
"getAllByTitle": [Function], | ||
"getByAltText": [Function], | ||
"getByDisplayValue": [Function], | ||
"getByLabelText": [Function], | ||
"getByPlaceholderText": [Function], | ||
"getByRole": [Function], | ||
"getByTestId": [Function], | ||
"getByText": [Function], | ||
"getByTitle": [Function], | ||
"html": [Function], | ||
"isUnmounted": [Function], | ||
"queryAllByAltText": [Function], | ||
"queryAllByDisplayValue": [Function], | ||
"queryAllByLabelText": [Function], | ||
"queryAllByPlaceholderText": [Function], | ||
"queryAllByRole": [Function], | ||
"queryAllByTestId": [Function], | ||
"queryAllByText": [Function], | ||
"queryAllByTitle": [Function], | ||
"queryByAltText": [Function], | ||
"queryByDisplayValue": [Function], | ||
"queryByLabelText": [Function], | ||
"queryByPlaceholderText": [Function], | ||
"queryByRole": [Function], | ||
"queryByTestId": [Function], | ||
"queryByText": [Function], | ||
"queryByTitle": [Function], | ||
"unmount": [Function], | ||
"updateProps": [Function], | ||
} | ||
</div> | ||
</div> | ||
`; |
130 changes: 25 additions & 105 deletions
130
agnosticui-vue/src/stories/__snapshots__/HeaderNav.test.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 |
---|---|---|
@@ -1,110 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snapshot 1`] = ` | ||
Object { | ||
"baseElement": <body> | ||
<div> | ||
<nav> | ||
<ul | ||
class="header-nav" | ||
exports[`HeaderNav renders 1`] = ` | ||
<div> | ||
<nav> | ||
<ul | ||
class="header-nav" | ||
> | ||
<li | ||
class="header-nav-item" | ||
> | ||
<a | ||
href="#" | ||
> | ||
<ul> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
Home | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
About | ||
</a> | ||
</li> | ||
</ul> | ||
</ul> | ||
</nav> | ||
</div> | ||
</body>, | ||
"container": <div> | ||
<nav> | ||
<ul | ||
class="header-nav" | ||
Home | ||
</a> | ||
</li> | ||
<li | ||
class="header-nav-item" | ||
> | ||
<ul> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
Home | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
href="#" | ||
> | ||
About | ||
</a> | ||
</li> | ||
</ul> | ||
</ul> | ||
</nav> | ||
</div>, | ||
"debug": [Function], | ||
"emitted": [Function], | ||
"findAllByAltText": [Function], | ||
"findAllByDisplayValue": [Function], | ||
"findAllByLabelText": [Function], | ||
"findAllByPlaceholderText": [Function], | ||
"findAllByRole": [Function], | ||
"findAllByTestId": [Function], | ||
"findAllByText": [Function], | ||
"findAllByTitle": [Function], | ||
"findByAltText": [Function], | ||
"findByDisplayValue": [Function], | ||
"findByLabelText": [Function], | ||
"findByPlaceholderText": [Function], | ||
"findByRole": [Function], | ||
"findByTestId": [Function], | ||
"findByText": [Function], | ||
"findByTitle": [Function], | ||
"getAllByAltText": [Function], | ||
"getAllByDisplayValue": [Function], | ||
"getAllByLabelText": [Function], | ||
"getAllByPlaceholderText": [Function], | ||
"getAllByRole": [Function], | ||
"getAllByTestId": [Function], | ||
"getAllByText": [Function], | ||
"getAllByTitle": [Function], | ||
"getByAltText": [Function], | ||
"getByDisplayValue": [Function], | ||
"getByLabelText": [Function], | ||
"getByPlaceholderText": [Function], | ||
"getByRole": [Function], | ||
"getByTestId": [Function], | ||
"getByText": [Function], | ||
"getByTitle": [Function], | ||
"html": [Function], | ||
"isUnmounted": [Function], | ||
"queryAllByAltText": [Function], | ||
"queryAllByDisplayValue": [Function], | ||
"queryAllByLabelText": [Function], | ||
"queryAllByPlaceholderText": [Function], | ||
"queryAllByRole": [Function], | ||
"queryAllByTestId": [Function], | ||
"queryAllByText": [Function], | ||
"queryAllByTitle": [Function], | ||
"queryByAltText": [Function], | ||
"queryByDisplayValue": [Function], | ||
"queryByLabelText": [Function], | ||
"queryByPlaceholderText": [Function], | ||
"queryByRole": [Function], | ||
"queryByTestId": [Function], | ||
"queryByText": [Function], | ||
"queryByTitle": [Function], | ||
"unmount": [Function], | ||
"updateProps": [Function], | ||
} | ||
<a | ||
href="#" | ||
> | ||
About | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
`; |