Repository navigation
Issue #566 - Using configuration parameter to allowDragAndDrop of files and folders - #748
KenBridgeman wants to merge 5 commits into
Conversation
|
That's OK, I learned a ton. Would you mind very much doing a very quick review and providing a comment as this was my first foray. |
| children.each (index, child) -> | ||
| expect(child).toHaveClass 'expanded' | ||
| expect(child.hasAttribute('draggable')).toBe(true) | ||
| expect(child.getAttribute('draggable')).toBe('true') |
There was a problem hiding this comment.
Why do we have two assertions of this?
There was a problem hiding this comment.
I could be wrong about this, but I interpret hasAttribute as being true regardless of whether draggable's value is true or false; it has the attribute and it's value is 'x'.
I noticed that at the root in DirectoryView that @Draggable is not created and therefore, for root I was thinking that it will not have the attribute at all.
I didn't want the test to error out if the attribute doesn't exist.
Of course, I'm brand new and don't know what I'm doing. ;)
There was a problem hiding this comment.
I think the getAttribute assertion would be sufficient. In our test framework, Jasmine, failures don't halt the test, so it will still proceed to execute the next assertion anyway.
Of course! Looking now... |
| fileView3 = treeView.find('.file:contains(test-file3.txt)') | ||
| treeView.updateRoots() | ||
|
|
||
| it 'makes expanded directory and files draggable', -> |
There was a problem hiding this comment.
Shouldn't setting allowDragAndDrop to false disable drag-and-drop?
There was a problem hiding this comment.
Nevermind - misread getAttribute vs hasAttribute.
There was a problem hiding this comment.
But your comment is still valid: the test description should be something like:
it "prevents directories and files from being dragged", ->|
Left various minor comments. Other than that, this PR is good! Unfortunately, as @50Wliu mentioned, we have decided not to add this option at this time. In general, we like to avoid a proliferation of settings, where there are alternatives. Thanks for delving into the Atom code, @KenBridgeman; I hope to see more work by you! |
|
As the Atom maintainers have agreed that we will not be adding a configuration setting for drag-and-drop, I'm going to close this PR. Thanks again for the contributions @KenBridgeman 😀. |
|
@strindhaug your comment was deleted as a violation of the Atom Code of Conduct as it was insulting or derogatory. You may consider this an official warning. |
This is my very first Javascript as well as OpenSource Pull request. I think I've done OK, but if not please be kind.
package.json: Added allowDragAndDrop attribute with a default value of true which ensures backward compatibility.
directory-view.coffee and file-view.coffee:Simple one-liner to get config item and set draggable attribute in DOM structure.
tree-view.coffee: One-liner to ensure that changes to the config attribute are propagated to the tree-view immediately. Without this line, the user would have to exit the app and restart.
tree-view-spec.coffee: Had the hardest time figuring this out. I seemed to have both closure issues as well as inter-process issues with changing of the config item; but really not sure. In the end, I've got both allowDragAndDrop = true as well as false tests.