From 8f8a4b7060b542c398873dedb38072ef8bb76482 Mon Sep 17 00:00:00 2001 From: Rob Levin Date: Sun, 27 Sep 2020 07:18:28 -0700 Subject: [PATCH] Update the vue header specs --- agnosticui-vue/src/stories/Header.test.js | 22 ++- agnosticui-vue/src/stories/HeaderNav.test.js | 18 +-- .../stories/__snapshots__/Header.test.js.snap | 146 ++++-------------- .../__snapshots__/HeaderNav.test.js.snap | 130 +++------------- 4 files changed, 70 insertions(+), 246 deletions(-) diff --git a/agnosticui-vue/src/stories/Header.test.js b/agnosticui-vue/src/stories/Header.test.js index 452976708..8cd7baf56 100644 --- a/agnosticui-vue/src/stories/Header.test.js +++ b/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: '' test('Header renders', async () => { - const { getByText } = render(Header, { + const { container, getByText } = render(Header, { + components: { + HeaderNav, + HeaderNavItem, + }, slots: { logoleft: 'Logo Left', logoright: 'Logo Right', - headernav: '', + headernav: 'HomeAbout', }, }); getByText('Home'); getByText('About'); getByText('Logo Left'); getByText('Logo Right'); + expect(container).toMatchSnapshot(); }); - -test('snapshot', () => { - const rendered = render(Header, { - slots: { - logoleft: 'Logo Left', - logoright: 'Logo Right', - headernav: '', - }, - }) - expect(rendered).toMatchSnapshot(); -}) diff --git a/agnosticui-vue/src/stories/HeaderNav.test.js b/agnosticui-vue/src/stories/HeaderNav.test.js index 3e2a97a9f..2ecdacfb3 100644 --- a/agnosticui-vue/src/stories/HeaderNav.test.js +++ b/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: '', + default: 'HomeAbout', }, }); getByText('Home'); getByText('About'); + expect(container).toMatchSnapshot(); }); - -test('snapshot', () => { - const rendered = render(HeaderNav, { - slots: { - default: '', - }, - }) - expect(rendered).toMatchSnapshot(); -}) diff --git a/agnosticui-vue/src/stories/__snapshots__/Header.test.js.snap b/agnosticui-vue/src/stories/__snapshots__/Header.test.js.snap index bada1c67d..c554f761a 100644 --- a/agnosticui-vue/src/stories/__snapshots__/Header.test.js.snap +++ b/agnosticui-vue/src/stories/__snapshots__/Header.test.js.snap @@ -1,69 +1,35 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`snapshot 1`] = ` -Object { - "baseElement": -
- -
- , - "container":
+exports[`Header renders 1`] = ` +
+ , - "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], -} +
+
`; diff --git a/agnosticui-vue/src/stories/__snapshots__/HeaderNav.test.js.snap b/agnosticui-vue/src/stories/__snapshots__/HeaderNav.test.js.snap index db68a8784..759e8a249 100644 --- a/agnosticui-vue/src/stories/__snapshots__/HeaderNav.test.js.snap +++ b/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": -
-
- , - "container":
- -
, - "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], -} + + About + + + + + `;