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

removing element after selection #733

Merged
merged 7 commits into from
Mar 1, 2021
Merged

Conversation

vitormalencar
Copy link
Collaborator

@vitormalencar vitormalencar commented Feb 24, 2021

Closes Issue #732

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the dev branch for v2.x (or to a previous version branch), not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@vitormalencar
Copy link
Collaborator Author

For now, I just skip 2 tests, in my opinion, we can change the class to be a little more specific with the methods so we can isolate the dom node creation from the fake select method since we have plans to update this, my next PR will make this class more composable =) I would like to know you guys opinions

@vitormalencar vitormalencar self-assigned this Feb 25, 2021
@vitormalencar vitormalencar marked this pull request as ready for review February 25, 2021 13:56
@@ -75,6 +73,8 @@ class ClipboardAction {

this.selectedText = select(this.fakeElem);
this.copyText();

this.removeFake();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great! Simple solution. 💯

Copy link
Collaborator

@helderberto helderberto left a comment

Choose a reason for hiding this comment

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

Only a suggestion, mention the issue related to this PR at the description with Closes #<ISSUE_ID>

@obetomuniz
Copy link
Collaborator

Just for reference @vitormalencar, why are you skipping the two mentioned tests instead of getting them in compliance with the bugfix? Could you pls elaborate on why each should be ignored for now on this PR?

@vitormalencar
Copy link
Collaborator Author

@obetomuniz the problem is that the test expects the node to stay in the dom, now that we are removing it we cant do assertions on the 'fakeElement, my idea is to separate this functionality a bit by having a new method just for the 'fakeElement' creation so that we can test properly,

the idea here was to bring the discussion =)

@obetomuniz
Copy link
Collaborator

obetomuniz commented Feb 25, 2021

Got it. What about instead of only fix the bug, we start these improvements right here to avoid losing the test coverage? I mean, since it looks like a specific case, we can properly improve it as you mentioned instead of only this hotfix. What do you guys think? Let me know if you have concerns to do it here in terms of effort, time, etc.

@vitormalencar
Copy link
Collaborator Author

for me is totally ok =). the main point was to bring the discussion and I totally agree, I will create another method to keep our test coverage

@obetomuniz
Copy link
Collaborator

Awesome! Go for it. I'll keep tracking. Thanks, dude!

…re-732-removing-dom-el

* 'master' of github.com:zenorocha/clipboard.js:
  refactor(workflows): remove unused lint file
  feat(workflows): add lint code job
  chore(eslint): add comments and new rules
  chore(deps): remove sort-package-json
  refactor: remove eslint ignore rules comments
  ci(lint): create a ci workflow
  chore(clipboard): remove linter bugs
  chore(deps): add dependencies and new scripts
  chore(test): remove linter bugs
  chore(linter): add linter configuration
  feat(eslint): add linter configuration
  chore(deps): add linter
  updating naming
  adding deploy action
Copy link
Collaborator

@obetomuniz obetomuniz left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work @vitormalencar.

@vitormalencar
Copy link
Collaborator Author

Nice !, team thanks for the review, let's go!

@vitormalencar vitormalencar merged commit 15737fe into master Mar 1, 2021
This was referenced Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants