| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="../../editing.js"></script> |
| </head> |
| <body> |
| <div id="dropzone" style="width: 200px; height: 200px; background-color: grey;"></div> |
| <script> |
| description("Basic test coverage for fileSystemEntry.getParent()"); |
| jsTestIsAsync = true; |
| |
| var dropzone = document.getElementById('dropzone'); |
| dropzone.ondrop = function(e) { |
| e.preventDefault(); |
| dataTransfer = e.dataTransfer; |
| |
| shouldBe("dataTransfer.items.length", "2"); |
| |
| firstDataTransferItem = dataTransfer.items[0]; |
| firstEntry = firstDataTransferItem.webkitGetAsEntry(); |
| secondDataTransferItem = dataTransfer.items[1]; |
| secondEntry = secondDataTransferItem.webkitGetAsEntry(); |
| |
| firstEntry.getParent(function(parent) { |
| firstEntryParent = parent; |
| shouldBeEqualToString("firstEntryParent.name", ""); |
| shouldBeEqualToString("firstEntryParent.fullPath", "/"); |
| shouldBeTrue("firstEntryParent.isDirectory"); |
| shouldBeFalse("firstEntryParent.isFile"); |
| |
| secondEntry.getParent(function(parent) { |
| secondEntryParent = parent; |
| shouldBeEqualToString("secondEntryParent.name", ""); |
| shouldBeEqualToString("secondEntryParent.fullPath", "/"); |
| shouldBeTrue("secondEntryParent.isDirectory"); |
| shouldBeFalse("secondEntryParent.isFile"); |
| |
| finishJSTest(); |
| }, function(e) { |
| testFailed("getParent() call failed: " + e); |
| finishJSTest(); |
| }); |
| }, function(e) { |
| testFailed("getParent() call failed: " + e); |
| finishJSTest(); |
| }); |
| }; |
| |
| dropzone.ondragover = function(ev) { |
| ev.preventDefault(); |
| } |
| |
| onload = function() { |
| dragFilesOntoElement(dropzone, ['../../../fast/forms/resources/test.txt', '../../../fast/forms/file/entries-api/resources/testFiles']); |
| } |
| </script> |
| </body> |
| </html> |