-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cv-text-input-skeleton): add CvTextInputSkeleton #1542
feat(cv-text-input-skeleton): add CvTextInputSkeleton #1542
Conversation
448dfa2
to
866d349
Compare
866d349
to
0d1e1b8
Compare
@mateusbandeiraa I know this is stilla draft but it looks really nice. For me there are only a couple of tweaks to the storybook before this one is ready.
Hintsdiff --git a/src/components/CvTextInput/CvTextInput.stories.js b/src/components/CvTextInput/CvTextInput.stories.js
index a262e4c7..ea687602 100644
--- a/src/components/CvTextInput/CvTextInput.stories.js
+++ b/src/components/CvTextInput/CvTextInput.stories.js
@@ -244,7 +244,7 @@ Password.parameters = storyParametersObject(
Password.args
);
-const templateSkeleton = `<cv-text-input-skeleton v-bind='args'>`;
+const templateSkeleton = `<cv-text-input-skeleton v-bind='args'/>`;
const TemplateSkeleton = args => {
return {
components: { CvTextInputSkeleton },
@@ -254,6 +254,12 @@ const TemplateSkeleton = args => {
};
export const Skeleton = TemplateSkeleton.bind({});
+Skeleton.parameters = {
+ controls: {
+ // exclude everything except `hideLabel`
+ exclude: ['helperText', 'invalidMessage', 'etc'],
+ },
+};
Skeleton.parameters = storyParametersObject(
Skeleton.parameters,
templateSkeleton, |
Instead of excluding everyting other than |
I'm having a hard time writing the accessibility test. This always pass, not sure if it is working: it('is accessible', async () => {
const skeleton = render(CvTextInputSkeleton);
expect(skeleton.container).toBeAccessible('cv-text-input-skeleton');
}) |
I din't know "include" was a thing. That would probably help me clean up some of my own tests. Thanks. Nice! |
This works great for me.
To verify it is working I added a bogus role to the span like: <span
v-if="!hideLabel"
role="this is bogus"
:class="[`${carbonPrefix}--label`, `${carbonPrefix}--skeleton`]"
> And then the test produces:
I removed the bogus role and the test runs cleanly. |
@davidnixon I don't plan doing any more changes to this PR if that looks good for you. |
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.
LGTM
Contributes to #167
What did you do?
Implemented
cv-text-input-skeleton
.Why did you do it?
Because Carbon Vue rocks 😄 . And it was requested on #167.
How have you tested it?
Ran the existing unit tests and added new ones.
Were docs updated if needed?
(I updated the storybook. Is there anything else that needs to be updated?)