Skip to content
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(ClipboardCopy): Convert clipboard copy to typescript #2131

Merged
merged 14 commits into from Jun 27, 2019

Conversation

jessiehuff
Copy link
Contributor

Fixes #2130

@patternfly-build
Copy link
Contributor

PatternFly-React preview: https://2131-pr-patternfly-react-patternfly.surge.sh

@codecov-io
Copy link

codecov-io commented May 31, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@a5d571e). Click here to learn what that means.
The diff coverage is 74.46%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2131   +/-   ##
=========================================
  Coverage          ?   80.54%           
=========================================
  Files             ?      666           
  Lines             ?     8470           
  Branches          ?      729           
=========================================
  Hits              ?     6822           
  Misses            ?     1281           
  Partials          ?      367
Flag Coverage Δ
#patternfly3 85.23% <ø> (?)
#patternfly4 76.09% <74.46%> (?)
#patternflymisc 95.79% <ø> (?)
Impacted Files Coverage Δ
...c/components/ClipboardCopy/ClipboardCopyButton.tsx 66.66% <66.66%> (ø)
...components/ClipboardCopy/ClipboardCopyExpanded.tsx 75% <75%> (ø)
...c/components/ClipboardCopy/ClipboardCopyToggle.tsx 84.61% <84.61%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5d571e...1b34124. Read the comment docs.

redallen
redallen previously approved these changes Jun 3, 2019
Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🎖️

@@ -31,7 +31,7 @@ export interface TooltipProps extends Omit<HTMLProps<HTMLDivElement>, 'content'
/** z-index of the tooltip */
zIndex?: number;
/** Size of the tooltip */
maxWidth?: '12.5rem';
maxWidth?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@tlabaj tlabaj added chore 🏠 PF4 React issues for the PF4 core effort TypeScript labels Jun 5, 2019
redallen
redallen previously approved these changes Jun 7, 2019
/** Flag to show if the input is read only. */
isReadOnly?: boolean;
/** Adds Clipboard Copy variant styles. */
variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we decided to just have the union of the values here and not the "Typeof"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we need the typeof for the older consumers using the enum.

it('Verify content expands', () => {
cy.get('.pf-c-clipboard-copy__group-toggle').click();
cy.get('.pf-c-clipboard-copy').should('have.class', 'pf-m-expanded');
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add more verification steps here. We dod not verify that the copy actually works and I think we need to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know of a good way to test the copy paste feature? I tried this:

it('Verify copy to clipboard works', () => {
    const form = cy.get('.pf-c-form-control');
    form.clear().type('Hi'); 
    cy.get('.pf-c-clipboard-copy__group-copy').click(); 
    cy.get('.pf-c-form-control').clear().type('{cmd}v');
    form.should('have.value', 'Hi'); 
  });

But it always ends up typing "v" instead of doing a paste. I've been looking into it, but I'm not sure what the solution would be: cypress-io/cypress#3316

@patternfly-build
Copy link
Contributor

PatternFly-React preview: https://patternfly-react-pr-2131.surge.sh

redallen
redallen previously approved these changes Jun 18, 2019
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dlabaj dlabaj merged commit 44168dd into patternfly:master Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore 🏠 PF4 React issues for the PF4 core effort TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert ClipboardCopy to Typescript
7 participants