CB-8017 Add manual test for `<input type=file>`
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>
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 <input type="file"></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;
+ }
+};