diff --git a/src/components/_global/BalStack/BalStack.spec.ts b/src/components/_global/BalStack/BalStack.spec.ts new file mode 100644 index 0000000000..78a17a6027 --- /dev/null +++ b/src/components/_global/BalStack/BalStack.spec.ts @@ -0,0 +1,83 @@ +import { render } from '@testing-library/vue'; +import BalStack from './BalStack.vue'; + +describe.only('BalStack', () => { + describe('When using BalStack', () => { + it('should render items', () => { + const { getByText } = render(BalStack, { + slots: { + default: '
First
Second
Third
' + } + }); + + // check that elements are actually rendered as children + expect(getByText('First')).toBeVisible(); + expect(getByText('Second')).toBeVisible(); + expect(getByText('Third')).toBeVisible(); + }); + + it('should render items horizontally when the horizontal prop is supplied', () => { + const { getByText } = render(BalStack, { + slots: { + default: '
First
Second
Third
' + }, + props: { + horizontal: true + } + }); + + // its fine to make this assumption here as we render the children without any wrappers + const stackEl = getByText('First').parentElement; + expect(stackEl).toHaveClass('flex-row'); + }); + + it('should render items verticlly if vertical prop is supplied', () => { + const { getByText } = render(BalStack, { + slots: { + default: '
First
Second
Third
' + }, + props: { + vertical: true + } + }); + + // its fine to make this assumption here as we render the children without any wrappers + const stackEl = getByText('First').parentElement; + expect(stackEl).toHaveClass('flex-col'); + }); + + it('should render items with space between them', () => { + const { getByText } = render(BalStack, { + slots: { + default: '
First
Second
Third
' + }, + props: { + vertical: true + } + }); + + // the default spacing unit (tailwind) is 4. So can be either mb-4 or mr-4 + expect(getByText('First')).toHaveClass('mb-4'); + expect(getByText('Second')).toHaveClass('mb-4'); + // last el shouldn't have a spacing class + expect(getByText('Third')).not.toHaveClass('mb-4'); + }); + it('should render items with a border between them if withBorder prop is supplied', () => { + const { getByText } = render(BalStack, { + slots: { + default: '
First
Second
Third
' + }, + props: { + vertical: true, + withBorder: true + } + }); + + // the default spacing unit (tailwind) is 4. So can be either mb-4 or mr-4 + expect(getByText('First')).toHaveClass('mb-4 border-b'); + expect(getByText('Second')).toHaveClass('mb-4 border-b'); + // last el shouldn't have a spacing class + expect(getByText('Third')).not.toHaveClass('mb-4 border-b'); + }); + }); +}); diff --git a/src/components/_global/BalStack/BalStack.vue b/src/components/_global/BalStack/BalStack.vue index 8c2be91c14..97b167cb62 100644 --- a/src/components/_global/BalStack/BalStack.vue +++ b/src/components/_global/BalStack/BalStack.vue @@ -1,20 +1,12 @@ - - - diff --git a/src/components/_global/BalVerticalSteps/BalVerticalSteps.vue b/src/components/_global/BalVerticalSteps/BalVerticalSteps.vue index 05e32c305a..8f055364dd 100644 --- a/src/components/_global/BalVerticalSteps/BalVerticalSteps.vue +++ b/src/components/_global/BalVerticalSteps/BalVerticalSteps.vue @@ -74,7 +74,7 @@ function handleNavigate(state: StepState, stepIndex: number) {
{{ title }}
- +
- +
- +
- +
{{ $t('createAPool.similarPoolsExist') }}
- + {
Native tokens
- + { :exit="exitAnimateProps" :isVisible="true" > - +
{{ _tokens[token]?.symbol || 'N/A' }}
{{ diff --git a/src/plugins/components.ts b/src/plugins/components.ts index ac1761b10c..8c52957e94 100644 --- a/src/plugins/components.ts +++ b/src/plugins/components.ts @@ -6,7 +6,7 @@ export function registerGlobalComponents(app: App): void { const req = require.context( '@/components/_global', true, - /^((?!stories).)*\.(js|ts|vue)$/i + /^((?!(stories|spec)).)*\.(js|ts|vue)$/i ); for (const filePath of req.keys()) { const componentName = parsePath(filePath).name;