Browse Source

Fix DragDrop input & tests

Artur Paikin 9 years ago
parent
commit
0d986da79d
2 changed files with 16 additions and 15 deletions
  1. 5 4
      src/plugins/DragDrop.js
  2. 11 11
      test/acceptance/index.js

+ 5 - 4
src/plugins/DragDrop.js

@@ -76,11 +76,12 @@ export default class DragDrop extends Plugin {
     })
   }
 
-  handleInputChange () {
+  handleInputChange (ev) {
     this.core.log('All right, something selected through input...')
+    const files = ev.target.files
 
-    const newFiles = Object.keys(this.input.files).map((key) => {
-      this.input.files[key]
+    const newFiles = Object.keys(files).map((file) => {
+      return files[file]
     })
 
     this.core.emitter.emit('file-add', {
@@ -108,7 +109,7 @@ export default class DragDrop extends Plugin {
     }
 
     const onChange = (ev) => {
-      this.handleInputChange()
+      this.handleInputChange(ev)
     }
 
     const onSubmit = (ev) => {

+ 11 - 11
test/acceptance/index.js

@@ -40,17 +40,17 @@ function buildDriver (platform) {
   var driver
   if (isRemoteTest) {
     driver = new webdriver
-        .Builder()
-        .withCapabilities({
-          'browserName': platform.browser,
-          'platform': platform.os,
-          'version': platform.version,
-          'username': username,
-          'accessKey': accessKey
-        })
-        .usingServer('http://' + username + ':' + accessKey +
-                    '@ondemand.saucelabs.com:80/wd/hub')
-        .build()
+      .Builder()
+      .withCapabilities({
+        'browserName': platform.browser,
+        'platform': platform.os,
+        'version': platform.version,
+        'username': username,
+        'accessKey': accessKey
+      })
+      .usingServer('http://' + username + ':' + accessKey +
+                   '@ondemand.saucelabs.com:80/wd/hub')
+      .build()
     driver.setFileDetector(new remote.FileDetector())
   } else {
     driver = new webdriver