Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inkfarer committed Jan 15, 2024
1 parent 6af413a commit b5d4ae9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

exports[`IplDialogTitle matches snapshot 1`] = `
"<div class="ipl-dialog-title"><span class="ipl-dialog-title__title-text">Cool Dialog</span>
<ipl-button-stub icon="times" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="true" disableonsuccess="false" inline="true" data-test="close-button" class="close-button"></ipl-button-stub>
<ipl-button-stub icon="[object Object]" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="true" disableonsuccess="false" inline="true" data-test="close-button" class="close-button"></ipl-button-stub>
</div>"
`;

exports[`IplDialogTitle matches snapshot when closing is disabled 1`] = `
"<div class="ipl-dialog-title"><span class="ipl-dialog-title__title-text">Cool Dialog</span>
<ipl-button-stub icon="times" color="transparent" disabled="true" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="true" disableonsuccess="false" inline="true" data-test="close-button" class="close-button"></ipl-button-stub>
<ipl-button-stub icon="[object Object]" color="transparent" disabled="true" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="true" disableonsuccess="false" inline="true" data-test="close-button" class="close-button"></ipl-button-stub>
</div>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`IplMessage matches snapshot 1`] = `
"<div class="ipl-message__wrapper ipl-message__type-info">
<font-awesome-icon-stub icon="info-circle" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub>
<font-awesome-icon-stub icon="[object Object]" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub>
<div class="message-content">
<!--v-if-->
</div>
Expand All @@ -11,9 +11,9 @@ exports[`IplMessage matches snapshot 1`] = `

exports[`IplMessage matches snapshot when closeable 1`] = `
"<div class="ipl-message__wrapper ipl-message__type-info">
<font-awesome-icon-stub icon="info-circle" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub>
<font-awesome-icon-stub icon="[object Object]" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub>
<div class="message-content">
<ipl-button-stub icon="times" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true" class="close-button"></ipl-button-stub>
<ipl-button-stub icon="[object Object]" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true" class="close-button"></ipl-button-stub>
</div>
</div>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exports[`iplPagination matches snapshot 1`] = `
<ipl-select-stub modelvalue="1" options="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" disabled="false"></ipl-select-stub><span> of 9 pages</span>
</div>
<div class="page-buttons">
<ipl-button-stub icon="chevron-left" color="transparent" disabled="true" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true"></ipl-button-stub>
<ipl-button-stub icon="chevron-right" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true"></ipl-button-stub>
<ipl-button-stub icon="[object Object]" color="transparent" disabled="true" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true"></ipl-button-stub>
<ipl-button-stub icon="[object Object]" color="transparent" disabled="false" async="false" progressmessage="Working..." successmessage="Done!" requiresconfirmation="false" shortconfirmationmessage="false" small="false" disableonsuccess="false" inline="true"></ipl-button-stub>
</div>
</div>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`IplUpload shows file data if a file is uploaded 1`] = `
"<label class="ipl-upload">
<font-awesome-icon-stub icon="file" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub><span>mock-file.jpg</span><input type="file">
<font-awesome-icon-stub icon="[object Object]" border="false" fixedwidth="false" flip="false" listitem="false" pulse="false" swapopacity="false" spin="false" symbol="false" inverse="false" bounce="false" shake="false" beat="false" fade="false" beatfade="false" flash="false" spinpulse="false" spinreverse="false" class="icon"></font-awesome-icon-stub><span>mock-file.jpg</span><input type="file">
</label>"
`;
Expand Down
10 changes: 7 additions & 3 deletions src/components/__tests__/iplMessage.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import IplMessage from '../iplMessage.vue';
import { config, mount } from '@vue/test-utils';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';

describe('IplMessage', () => {
config.global.stubs = {
Expand Down Expand Up @@ -30,21 +34,21 @@ describe('IplMessage', () => {
it('has expected wrapper class and icon if type is error', () => {
const wrapper = mount(IplMessage, { props: { type: 'error' } });

expect(wrapper.getComponent('.icon').attributes().icon).toEqual('exclamation-circle');
expect(wrapper.getComponent(FontAwesomeIcon).vm.icon).toEqual(faExclamationCircle);
expect(wrapper.get('.ipl-message__wrapper').classes()).toContain('ipl-message__type-error');
});

it('has expected wrapper class and icon if type is info', () => {
const wrapper = mount(IplMessage, { props: { type: 'info' } });

expect(wrapper.getComponent('.icon').attributes().icon).toEqual('info-circle');
expect(wrapper.getComponent(FontAwesomeIcon).vm.icon).toEqual(faInfoCircle);
expect(wrapper.get('.ipl-message__wrapper').classes()).toContain('ipl-message__type-info');
});

it('has expected wrapper class and icon if type is warning', () => {
const wrapper = mount(IplMessage, { props: { type: 'warning' } });

expect(wrapper.getComponent('.icon').attributes().icon).toEqual('exclamation-triangle');
expect(wrapper.getComponent(FontAwesomeIcon).vm.icon).toEqual(faExclamationTriangle);
expect(wrapper.get('.ipl-message__wrapper').classes()).toContain('ipl-message__type-warning');
});

Expand Down

0 comments on commit b5d4ae9

Please sign in to comment.