Skip to content

Commit

Permalink
Update the vue header specs
Browse files Browse the repository at this point in the history
  • Loading branch information
roblevintennis committed Sep 27, 2020
1 parent 93d0be3 commit 8f8a4b7
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 246 deletions.
22 changes: 9 additions & 13 deletions agnosticui-vue/src/stories/Header.test.js
@@ -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();
})
18 changes: 7 additions & 11 deletions agnosticui-vue/src/stories/HeaderNav.test.js
@@ -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 agnosticui-vue/src/stories/__snapshots__/Header.test.js.snap
@@ -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 agnosticui-vue/src/stories/__snapshots__/HeaderNav.test.js.snap
@@ -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>
`;

0 comments on commit 8f8a4b7

Please sign in to comment.