From 69ce0f5f9d84721530e465d76a1cfe9d835d0b82 Mon Sep 17 00:00:00 2001 From: Phan An Date: Thu, 12 May 2022 10:46:41 +0200 Subject: [PATCH] feat(test): add ScreenEmptyState component tests --- .../components/ui/ScreenControlsToggler.spec.ts | 2 +- .../js/components/ui/ScreenEmptyState.spec.ts | 16 ++++++++++++++++ .../__snapshots__/ScreenEmptyState.spec.ts.snap | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 resources/assets/js/components/ui/ScreenEmptyState.spec.ts create mode 100644 resources/assets/js/components/ui/__snapshots__/ScreenEmptyState.spec.ts.snap diff --git a/resources/assets/js/components/ui/ScreenControlsToggler.spec.ts b/resources/assets/js/components/ui/ScreenControlsToggler.spec.ts index 60c4be78..25c85325 100644 --- a/resources/assets/js/components/ui/ScreenControlsToggler.spec.ts +++ b/resources/assets/js/components/ui/ScreenControlsToggler.spec.ts @@ -1,8 +1,8 @@ import isMobile from 'ismobilejs' import { expect, it } from 'vitest' +import { fireEvent } from '@testing-library/vue' import ComponentTestCase from '@/__tests__/ComponentTestCase' import ScreenControlsToggler from './ScreenControlsToggler.vue' -import { fireEvent } from '@testing-library/vue' new class extends ComponentTestCase { protected test () { diff --git a/resources/assets/js/components/ui/ScreenEmptyState.spec.ts b/resources/assets/js/components/ui/ScreenEmptyState.spec.ts new file mode 100644 index 00000000..9ff70bf9 --- /dev/null +++ b/resources/assets/js/components/ui/ScreenEmptyState.spec.ts @@ -0,0 +1,16 @@ +import { expect, it } from 'vitest' +import ComponentTestCase from '@/__tests__/ComponentTestCase' +import ScreenEmptyState from './ScreenEmptyState.vue' + +new class extends ComponentTestCase { + protected test () { + it('renders', () => { + expect(this.render(ScreenEmptyState, { + slots: { + icon: '', + default: 'Nothing here' + } + }).html()).toMatchSnapshot() + }) + } +} diff --git a/resources/assets/js/components/ui/__snapshots__/ScreenEmptyState.spec.ts.snap b/resources/assets/js/components/ui/__snapshots__/ScreenEmptyState.spec.ts.snap new file mode 100644 index 00000000..49b7b533 --- /dev/null +++ b/resources/assets/js/components/ui/__snapshots__/ScreenEmptyState.spec.ts.snap @@ -0,0 +1,9 @@ +// Vitest Snapshot v1 + +exports[`renders 1`] = ` +"
+
+
Nothing here
+
+
" +`;