cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject spec commit: CB-8017 Add manual test for `<input type=file>`
Date Mon, 19 Jan 2015 21:22:49 GMT
Repository: cordova-mobile-spec
Updated Branches:
  refs/heads/master 16019c59b -> d6b17a79b


CB-8017 Add manual test for `<input type=file>`


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/d6b17a79
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/d6b17a79
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/d6b17a79

Branch: refs/heads/master
Commit: d6b17a79bd0449e5f706d5d58372b307c38f65e2
Parents: 16019c5
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Jan 19 16:20:23 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Jan 19 16:20:23 2015 -0500

----------------------------------------------------------------------
 cordova-plugin-mobilespec-tests/plugin.xml      |  3 ++
 .../tests/input.tests.js                        | 45 ++++++++++++++++++++
 2 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d6b17a79/cordova-plugin-mobilespec-tests/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-plugin-mobilespec-tests/plugin.xml b/cordova-plugin-mobilespec-tests/plugin.xml
index fa62cd4..14723db 100644
--- a/cordova-plugin-mobilespec-tests/plugin.xml
+++ b/cordova-plugin-mobilespec-tests/plugin.xml
@@ -43,4 +43,7 @@
     
     <js-module src="tests/whitelist.tests.js" name="whitelist.tests">
     </js-module>
+
+    <js-module src="tests/input.tests.js" name="input.tests">
+    </js-module>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d6b17a79/cordova-plugin-mobilespec-tests/tests/input.tests.js
----------------------------------------------------------------------
diff --git a/cordova-plugin-mobilespec-tests/tests/input.tests.js b/cordova-plugin-mobilespec-tests/tests/input.tests.js
new file mode 100644
index 0000000..42f4181
--- /dev/null
+++ b/cordova-plugin-mobilespec-tests/tests/input.tests.js
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+exports.defineManualTests = function (contentEl, createActionButton) {
+    contentEl.innerHTML = '<h1>Tests for &lt;input type="file"&gt;</h1>'
+
+        'regular: <input type="file"><br>' +
+        'multiple: <input type="file"><br>' +
+        'photos only: <input type="file"><br>' +
+        'video only: <input type="file"><br>' +
+        'audio only: <input type="file"><br>' +
+        'multiple photos: <input type="file"><br>' +
+        '.txt only: <input type="file"><br>' +
+        '<img style="max-width:400px; max-height:200px; border:1px solid black">';
+    function logOnChange(e) {
+        var el = e.target;
+        console.log('Got result for input "' + el.value + '": ' + JSON.stringify(el.files));
+        var firstFile = el.files && el.files[0];
+        if (firstFile && firstFile.type.match('image.*')) {
+            contentEl.querySelector('img').src = URL.createObjectURL(firstFile);
+        } else {
+            contentEl.querySelector('img').src = 'about:blank';
+        }
+    }
+    var els = contentEl.querySelectorAll('input');
+    for (var i = 0; i < els.length; ++i) {
+        els[i].onchange = logOnChange;
+    }
+};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message