-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support dropping folders on Gltf UI component (#531)
- Loading branch information
1 parent
00dea08
commit 377c8b9
Showing
5 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/@dcl/inspector/src/components/ProjectAssetExplorer/utils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as utils from './utils' | ||
|
||
import { AssetNodeFolder, AssetNodeItem } from './types' | ||
|
||
describe('ProjectAssetExplorer/utils', () => { | ||
describe('getFullNodePath', () => { | ||
it('should return full node path given a child', () => { | ||
const parentA = { name: 'parentA', parent: null } | ||
const parentB = { name: 'parentB', parent: parentA } | ||
const child = { name: 'file.gltf', parent: parentB } as AssetNodeItem | ||
expect(utils.getFullNodePath(child)).toBe('/parentA/parentB/file.gltf') | ||
}) | ||
it('should return child name if node has no parent', () => { | ||
const child = { name: 'file.gltf', parent: null } as AssetNodeItem | ||
expect(utils.getFullNodePath(child)).toBe('/file.gltf') | ||
}) | ||
}) | ||
describe('isAssetNode', () => { | ||
it('should return true when node type "asset"', () => { | ||
const node: AssetNodeItem = { | ||
name: 'some-name', | ||
parent: null, | ||
type: 'asset', | ||
asset: { | ||
src: 'some-file.glb', | ||
type: 'gltf' | ||
} | ||
} | ||
expect(utils.isAssetNode(node)).toBe(true) | ||
}) | ||
it('should return false when node type is different from "asset"', () => { | ||
const node: AssetNodeFolder = { | ||
name: 'some-name', | ||
parent: null, | ||
type: 'folder', | ||
children: [] | ||
} | ||
expect(utils.isAssetNode(node)).toBe(false) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters