Procházet zdrojové kódy

Add type tests for the Dashboard.

Renée Kooi před 6 roky
rodič
revize
9891e974bf

+ 28 - 0
packages/@uppy/dashboard/types/dashboard-tests.ts

@@ -0,0 +1,28 @@
+import Uppy from '@uppy/core';
+import Dashboard from '../';
+
+{
+  const uppy = Uppy()
+  uppy.use(Dashboard, {
+    target: 'body'
+  })
+
+  const plugin = <Dashboard>uppy.getPlugin('Dashboard')
+  plugin.openModal()
+  plugin.isModalOpen() // $ExpectType boolean
+  plugin.closeModal()
+}
+
+{
+  const uppy = Uppy()
+  uppy.use(Dashboard, {
+    width: '100%',
+    height: 700
+  })
+}
+
+{
+  const uppy = Uppy()
+  // $ExpectError
+  uppy.use(Dashboard, { height: {} })
+}

+ 2 - 2
packages/@uppy/dashboard/types/index.d.ts

@@ -8,8 +8,8 @@ export interface DashboardOptions extends PluginOptions {
   inline: boolean;
   defaultTabIcon: string;
   hideUploadButton: boolean;
-  width: string;
-  height: string;
+  width: string | number;
+  height: string | number;
   note: string;
   showLinkToFileUploadResult: boolean;
   proudlyDisplayPoweredByUppy: boolean;