summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSukanya Pandey <sukapan1@in.ibm.com>2020-12-31 11:57:22 +0300
committerDerick Montague <derick.montague@ibm.com>2021-01-08 00:04:42 +0300
commit88ac70fe19bd0451b783e86d34f8ec757cafdb61 (patch)
treee2a195a73137822d8626ba6c9bb40e22aabaa872 /tests
parent812803aa8a31fbbb86418850efb611e6a7028a9c (diff)
downloadwebui-vue-88ac70fe19bd0451b783e86d34f8ec757cafdb61.tar.xz
Add unit test cases for status icon component
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com> Change-Id: I58bb3e5f5fa9c02276b2031322ac01affeb17ca3
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/Global/StatusIcon.spec.js38
-rw-r--r--tests/unit/Global/__snapshots__/StatusIcon.spec.js.snap27
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/unit/Global/StatusIcon.spec.js b/tests/unit/Global/StatusIcon.spec.js
new file mode 100644
index 00000000..0fc8b7c9
--- /dev/null
+++ b/tests/unit/Global/StatusIcon.spec.js
@@ -0,0 +1,38 @@
+import { mount, createLocalVue } from '@vue/test-utils';
+import StatusIcon from '@/components/Global/StatusIcon';
+
+const localVue = createLocalVue();
+
+describe('StatusIcon.vue', () => {
+ const wrapper = mount(StatusIcon, {
+ localVue,
+ propsData: {
+ status: 'info',
+ },
+ });
+ it('should exist', () => {
+ expect(wrapper.exists()).toBe(true);
+ });
+ it('should render icon-info element', () => {
+ expect(wrapper.find('.info').exists()).toBe(true);
+ });
+ it('should render icon-success element', async () => {
+ await wrapper.setProps({ status: 'success' });
+ expect(wrapper.find('.success').exists()).toBe(true);
+ });
+ it('should render icon-warning element', async () => {
+ await wrapper.setProps({ status: 'warning' });
+ expect(wrapper.find('.warning').exists()).toBe(true);
+ });
+ it('should render icon-danger element', async () => {
+ await wrapper.setProps({ status: 'danger' });
+ expect(wrapper.find('.danger').exists()).toBe(true);
+ });
+ it('should render icon-secondary element', async () => {
+ await wrapper.setProps({ status: 'secondary' });
+ expect(wrapper.find('.status-icon').exists()).toBe(true);
+ });
+ it('should render correctly', () => {
+ expect(wrapper.element).toMatchSnapshot();
+ });
+});
diff --git a/tests/unit/Global/__snapshots__/StatusIcon.spec.js.snap b/tests/unit/Global/__snapshots__/StatusIcon.spec.js.snap
new file mode 100644
index 00000000..347a5538
--- /dev/null
+++ b/tests/unit/Global/__snapshots__/StatusIcon.spec.js.snap
@@ -0,0 +1,27 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`StatusIcon.vue should render correctly 1`] = `
+<span
+ class="status-icon secondary"
+>
+ <svg
+ aria-hidden="true"
+ fill="currentColor"
+ focusable="false"
+ height="20"
+ preserveAspectRatio="xMidYMid meet"
+ viewBox="0 0 20 20"
+ width="20"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M10,1c-5,0-9,4-9,9s4,9,9,9s9-4,9-9S15,1,10,1z M13.5,14.5l-8-8l1-1l8,8L13.5,14.5z"
+ />
+ <path
+ d="M13.5,14.5l-8-8l1-1l8,8L13.5,14.5z"
+ data-icon-path="inner-path"
+ opacity="0"
+ />
+ </svg>
+</span>
+`;