Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert balstack to a render function component (#1313)
* update: convert balstack to a render function component * fix: lint * cleanup: remove unneeded isDynamic prop from balstack * update: implement remaining props and add comments * update: add balstack spec file * update: complete balstack tests
- Loading branch information
1 parent
9a9a8f8
commit fb0118f
Showing
9 changed files
with
214 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: '<div>First</div><div>Second</div><div>Third</div>' | ||
} | ||
}); | ||
|
||
// 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: '<div>First</div><div>Second</div><div>Third</div>' | ||
}, | ||
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: '<div>First</div><div>Second</div><div>Third</div>' | ||
}, | ||
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: '<div>First</div><div>Second</div><div>Third</div>' | ||
}, | ||
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: '<div>First</div><div>Second</div><div>Third</div>' | ||
}, | ||
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'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fb0118f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
beta-kovan – ./
staging-kovan-app.vercel.app
beta-kovan-balancer.vercel.app
staging.kovan.app.balancer.fi
beta.kovan.balancer.fi
beta-kovan-git-develop-balancer.vercel.app
fb0118f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
beta-app – ./
beta.balancer.fi
staging.app.balancer.fi
beta-app-balancer.vercel.app
beta-app-git-develop-balancer.vercel.app
staging-app-tau.vercel.app
fb0118f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
beta-polygon – ./
beta-polygon-balancer.vercel.app
beta-polygon.vercel.app
beta-polygon-git-develop-balancer.vercel.app
beta.polygon.balancer.fi
fb0118f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
beta-arbitrum – ./
beta-arbitrum-balancer.vercel.app
beta.arbitrum.balancer.fi
beta-arbitrum.vercel.app
beta-arbitrum-git-develop-balancer.vercel.app