Skip to content

Commit

Permalink
fix: lint and failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnixon committed Jul 23, 2023
1 parent c490f87 commit 2fca1c3
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 32 deletions.
1 change: 1 addition & 0 deletions src/components/CvAccordion/CvAccordion.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const template = `<cv-accordion @change="onChange" v-bind="args">
</cv-accordion-item>
</cv-accordion>`;
const Template = (args, { argTypes }) => {
// eslint-disable-next-line no-param-reassign
args = {
...args,
align: alignConsts[alignConsts.$labels[args.align]],
Expand Down
3 changes: 0 additions & 3 deletions src/components/CvButton/CvButtonSkeleton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ const Template = (args, { argTypes }) => {
};

export const Default = Template.bind({});
console.log('Story: ', {
Default,
});
Default.args = {
size: 'default',
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/CvCheckbox/__tests__/CvCheckbox.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, fireEvent } from '@testing-library/vue';
import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import CvCheckbox from '../CvCheckbox.vue';

Expand Down
2 changes: 1 addition & 1 deletion src/components/CvDatePicker/CvDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ import {
ref,
computed,
onMounted,
onUpdated,
onBeforeMount,
onUnmounted,
watch,
Expand Down Expand Up @@ -305,6 +304,7 @@ let dateToString = val => {
return calendar.formatDate(val, props.calOptions.dateFormat);
};
// eslint-disable-next-line no-unused-vars
const handleDatePick = (selectedDates, dateStr, instance) => {
if (isSingle.value) {
const temp = dateToString(selectedDates[0]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/CvForm/CvFormGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script setup>
import { carbonPrefix } from '../../global/settings';
const props = defineProps({
defineProps({
invalid: Boolean,
message: String,
noMargin: Boolean,
Expand Down
1 change: 0 additions & 1 deletion src/components/CvGrid/__tests__/CvGrid.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import CvGrid from '../CvGrid.vue';
import CvRow from '../CvRow.vue';
import CvColumn from '../CvColumn.vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/CvLoading/__tests__/CvLoading.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test('CvLoading - test all props and attrs', async () => {
});

test('CvLoading - overlay', async () => {
const { debug, getByRole, rerender } = render(CvLoading, {
const { getByRole, rerender } = render(CvLoading, {
props: { overlay: true, active: false },
});

Expand Down
3 changes: 1 addition & 2 deletions src/components/CvMultiSelect/__tests__/CvMultiSelect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import CvMultiSelect from '../CvMultiSelect.vue';
import CvSelect from '@/components/CvSelect/CvSelect.vue';
import { ref } from 'vue';
const pkdCharacters = [
'Rick Deckard',
'Garland',
Expand Down Expand Up @@ -256,7 +255,7 @@ describe('CvMultiSelect', () => {
expect(button).not.toBeUndefined();
const user = userEvent.setup();
await user.click(button);
const closeButton = await result.findByLabelText('close menu');
await result.findByLabelText('close menu');
let menuItems = await result.findAllByRole('menuitem');

// Verify selected items are at the top by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('CvOverflowMenu', () => {
});

const select = await result.findByLabelText(label);
const menu = result.container.querySelector('[data-overflow-menu]');
result.container.querySelector('[data-overflow-menu]');
const buttons = await result.findAllByRole('button');

const user = userEvent.setup();
Expand Down
31 changes: 11 additions & 20 deletions src/components/CvSelect/__tests__/CvSelect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,16 @@ describe('CvSelect', () => {
false
);
await result.rerender({ light: true });
expect(result.container.classList.contains('bx--select--light')).toBe(true);
const wrapper = result.container.querySelector('.bx--select');
expect(wrapper.classList.contains('bx--select--light')).toBe(true);

expect(result.container.classList.contains('bx--select--inline')).toBe(
false
);
expect(wrapper.classList.contains('bx--select--inline')).toBe(false);
await result.rerender({ inline: true });
expect(result.container.classList.contains('bx--select--inline')).toBe(
true
);
expect(wrapper.classList.contains('bx--select--inline')).toBe(true);

expect(result.container.classList.contains('bx--select--disabled')).toBe(
false
);
expect(wrapper.classList.contains('bx--select--disabled')).toBe(false);
await result.rerender({ disabled: true });
expect(result.container.classList.contains('bx--select--disabled')).toBe(
true
);
expect(wrapper.classList.contains('bx--select--disabled')).toBe(true);
});

it('CvSelect - test helper slot', async () => {
Expand All @@ -138,7 +131,7 @@ describe('CvSelect', () => {
},
});

const select = await result.findByLabelText(label);
await result.findByLabelText(label);
await result.findByText(helperSlot);
});
it('CvSelect - test warning slot', async () => {
Expand All @@ -162,9 +155,8 @@ describe('CvSelect', () => {

await result.findByLabelText(label);
await result.findByText(warningSlot);
expect(result.container.classList.contains('bx--select--warning')).toBe(
true
);
const wrapper = result.container.querySelector('.bx--select');
expect(wrapper.classList.contains('bx--select--warning')).toBe(true);
});
it('CvSelect - test invalid slot', async () => {
const label = 'ABC-label-123';
Expand All @@ -189,8 +181,7 @@ describe('CvSelect', () => {

await result.findByLabelText(label);
await result.findByText(invalidSlot);
expect(result.container.classList.contains('bx--select--invalid')).toBe(
true
);
const wrapper = result.container.querySelector('.bx--select');
expect(wrapper.classList.contains('bx--select--invalid')).toBe(true);
});
});
2 changes: 1 addition & 1 deletion src/components/CvTabs/__tests__/CvTabs.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { findByText, render } from '@testing-library/vue';
import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import CvTabs from '../CvTabs.vue';
import CvTab from '../CvTab.vue';
Expand Down
1 change: 1 addition & 0 deletions src/global/storybook-utils/story-source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const storyParametersObject = (
const code = storySourceCode(templateSource, args, replacing);

if (!parameters) {
// eslint-disable-next-line no-param-reassign
parameters = { docs: { source: { code } } };
} else {
if (!parameters.docs) {
Expand Down

0 comments on commit 2fca1c3

Please sign in to comment.