-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update input label * rename Label files for consistency * remove withNestedInput story, unused functionality * improve LobLabel stories * change font type to small-700 per design * add tooltipPosition leading/trailing option * fix Label relative paths after renaming the file * update tests * add tooltip info to mdx doc * add trailing position w flex reverse that came to me in my sleep * adjust tooltip content width with w-max and max-w * classes lint * package version & changelog Co-authored-by: Myrtle <[email protected]>
- Loading branch information
1 parent
53af9e2
commit a5e568f
Showing
15 changed files
with
173 additions
and
101 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import '@testing-library/jest-dom'; | ||
import { render } from '@testing-library/vue'; | ||
import LobLabel from '../Label.vue'; | ||
|
||
const initialProps = { | ||
id: 'test', | ||
label: 'test', | ||
labelFor: 'test' | ||
}; | ||
|
||
describe('LobLabel', () => { | ||
|
||
it('renders correctly', () => { | ||
const props = initialProps; | ||
const { getByText } = render(LobLabel, { props }); | ||
|
||
const label = getByText(props.label); | ||
expect(label).toBeInTheDocument(); | ||
}); | ||
|
||
it('shows the asterisk when the required prop is true', () => { | ||
const props = { | ||
...initialProps, | ||
required: true | ||
}; | ||
|
||
const { getByText } = render(LobLabel, { props }); | ||
const label = getByText(props.label); | ||
const asterisk = getByText('*'); | ||
expect(label).toContainElement(asterisk); | ||
}); | ||
|
||
describe('if a tooltip is added', () => { | ||
|
||
it('the tooltip shows on the left by default', () => { | ||
const props = { ...initialProps, tooltipContent: 'magic tooltip' }; | ||
const { getByText, getByTestId } = render(LobLabel, { props }); | ||
|
||
const tooltip = getByTestId('tooltip-leading'); | ||
expect(tooltip).toBeInTheDocument(); | ||
const label = getByText(props.label); | ||
expect(label.parentElement).not.toHaveClass('justify-between'); | ||
}); | ||
|
||
it('the tooltip shows on the right if tooltipPosition:trailing is added', () => { | ||
const props = { ...initialProps, tooltipContent: 'magic tooltip', tooltipPosition: 'trailing' }; | ||
const { getByText, getByTestId } = render(LobLabel, { props }); | ||
|
||
const tooltip = getByTestId('tooltip-trailing'); | ||
expect(tooltip).toBeInTheDocument(); | ||
const label = getByText(props.label); | ||
expect(label.parentElement).toHaveClass('justify-between flex-row-reverse'); | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.