summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSurenNeware <sneware9@in.ibm.com>2020-12-31 18:16:40 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2021-01-07 01:02:51 +0300
commit6b426787b5f54c488dbc6fc695b491b8e312a49c (patch)
tree0654ac2b5d1dd9d9569b7ee03f858a29abdb81ad /tests
parentd348c44ddf715b6b3cc9bd5616f9bccf0295ba4e (diff)
downloadwebui-vue-6b426787b5f54c488dbc6fc695b491b8e312a49c.tar.xz
Add unit test cases for info tooltip component
Signed-off-by: Suren Neware <sneware9@in.ibm.com> Change-Id: Ic89aed1f8244073eab82cdc6f79dba9520585374
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/Global/InfoTooltip.spec.js28
-rw-r--r--tests/unit/Global/__snapshots__/InfoTooltip.spec.js.snap13
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/Global/InfoTooltip.spec.js b/tests/unit/Global/InfoTooltip.spec.js
new file mode 100644
index 00000000..90cb301e
--- /dev/null
+++ b/tests/unit/Global/InfoTooltip.spec.js
@@ -0,0 +1,28 @@
+import { mount, createLocalVue } from '@vue/test-utils';
+import InfoTooltip from '@/components/Global/InfoTooltip';
+
+const localVue = createLocalVue();
+
+describe('InfoTooltip.vue', () => {
+ const wrapper = mount(InfoTooltip, {
+ localVue,
+ propsData: {
+ title: 'A tooltip test title',
+ },
+ mocks: {
+ $t: (key) => key,
+ },
+ });
+ it('should exist', () => {
+ expect(wrapper.exists()).toBe(true);
+ });
+ it('should render title attribute for button', () => {
+ expect(wrapper.attributes('title')).toBe('title');
+ });
+ it('should render icon-tooltip element', () => {
+ expect(wrapper.find('icon-tooltip').exists()).toBe(true);
+ });
+ it('should render correctly', () => {
+ expect(wrapper.element).toMatchSnapshot();
+ });
+});
diff --git a/tests/unit/Global/__snapshots__/InfoTooltip.spec.js.snap b/tests/unit/Global/__snapshots__/InfoTooltip.spec.js.snap
new file mode 100644
index 00000000..a3fd9be1
--- /dev/null
+++ b/tests/unit/Global/__snapshots__/InfoTooltip.spec.js.snap
@@ -0,0 +1,13 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`InfoTooltip.vue should render correctly 1`] = `
+<template>
+ <b-button
+ v-b-tooltip
+ variant="link"
+ class="btn-tooltip"
+ >
+ <icon-tooltip />
+ </b-button>
+</template>
+`;