-
Notifications
You must be signed in to change notification settings - Fork 20
C2LC-248: Initial Implementation of share button. #98
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
C2LC-248: Initial Implementation of share button. #98
Conversation
Quick notes on this: First, I didn't even try to position the share button. I'll merge with upstream once https://issues.fluidproject.org/browse/C2LC-246 is merged and put it next to the speed controls. Second, I used a Modal for now, I wanted to discuss perhaps using a Toast instead. Third, obviously I'll add tests, since we can read the clipboard using the same API and confirm that the value was set. |
@simonbates, as discussed I just committed my work in progress on new tests for the
I made an attempt at mocking that part of the API, but somehow what I did isn't exposed to the component itself, i.e. my tests can access my fake I also commented out the rendering tests, which fail because I don't seem to have wired up the i18n stuff correctly. I'll commit that as well shortly, but here's the error:
I can break these down and research them on my own, but I figured you might be able to at least point me in the right direction. |
- Use the async form of Jest's test() for the tests which click on the Share button, to manage the use of Promises in accessing the clipboard - Add a callback to ShareButton to receive notification when the modal is shown - Update the test names to use Given, When, Then style - Add a FakeClipboard class to test interaction with the clipboard
I've updated the tests for Changes:
|
Thanks, @simonbates, for the fix and the links. I copied the I still need to fix up the rendering test, I'll give that a go on my own a bit later today. |
src/ShareButton.test.js
Outdated
return wrapper; | ||
} | ||
|
||
// TODO: Figure how to do this properly with the required intl infrastructure |
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.
I think we don't need this comment any longer?
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.
Fixed.
src/ShareButton.css
Outdated
margin-top: 1rem; | ||
height: 2.25rem; |
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.
I think we don't need the margin-top
and height
properties here.
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.
Removed.
src/ProgramBlockEditor.js
Outdated
@@ -41,6 +41,7 @@ type ProgramBlockEditorProps = { | |||
|
|||
type ProgramBlockEditorState = { | |||
showConfirmDeleteAll: boolean, | |||
showShareComplete: boolean, |
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.
It looks like the changes in ProgramBlockEditor.js
are left over from previous work and can be reverted?
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.
I fixed this line and reviewed the changes, what's left now seems appropriate (the new state variable).
src/App.scss
Outdated
background-color: #F1F1F1; | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
|
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.
Extra blank line here
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.
Removed.
src/ShareButton.js
Outdated
|
||
type ShareButtonProps = { | ||
intl: IntlShape, | ||
disabled: boolean, |
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.
The disabled
property is never used.
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.
Removed.
src/ShareButton.js
Outdated
class ShareButton extends React.Component<ShareButtonProps, ShareButtonState> { | ||
static defaultProps = { | ||
disabled: false, | ||
showShareComplete: false |
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.
showShareComplete
is a state value, rather than props.
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.
Fixed.
See C2LC-248 for details.