Skip to content

Commit

Permalink
import createMockFile from Examples in upload component
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Nov 8, 2024
1 parent c4fc398 commit ab59727
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ import {
Section,
Upload,
} from '@dnb/eufemia/src'
import { createMockFile } from '@dnb/eufemia/src/components/upload/__tests__/testHelpers'

export function createMockFile(name: string, size: number, type: string) {
const file = new File([], name, { type })
Object.defineProperty(file, 'size', {
get() {
return size
},
})
return file
}

const useMockFiles = (setFiles, extend) => {
React.useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { Form, Value, Field } from '@dnb/eufemia/src/extensions/forms'
import { Flex, Span } from '@dnb/eufemia/src'
import { createMockFile } from '@dnb/eufemia/src/components/upload/__tests__/testHelpers'
import { createMockFile } from '../../../../../../docs/uilib/components/upload/Examples'

export const Placeholder = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Flex } from '@dnb/eufemia/src'
import ComponentBox from '../../../../../../../shared/tags/ComponentBox'
import { Field, Form } from '@dnb/eufemia/src/extensions/forms'
import { createMockFile } from '@dnb/eufemia/src/components/upload/__tests__/testHelpers'
import { createMockFile } from '../../../../../../../docs/uilib/components/upload/Examples'

export const BasicUsage = () => {
return (
Expand Down

0 comments on commit ab59727

Please sign in to comment.