Skip to content

Commit

Permalink
fix: Trigger component conditions validation (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoecheza authored Nov 7, 2023
1 parent 4458751 commit db59bf1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
14 changes: 7 additions & 7 deletions packages/@dcl/inspector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/@dcl/inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@dcl/inspector",
"version": "0.1.0",
"dependencies": {
"@dcl/asset-packs": "^1.2.5"
"@dcl/asset-packs": "^1.2.8"
},
"devDependencies": {
"@babylonjs/core": "^6.18.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,13 @@ export default withSdk<Props>(
const hasCounter = useHasComponent(entityId, Counter)

const areValidActions = useCallback(
(updatedActions: TriggerAction[]) =>
updatedActions.length > 0 && updatedActions.every((action) => action.id && action.name),
(updatedActions: TriggerAction[]) => updatedActions.every((action) => action.id && action.name),
[]
)

const areValidConditions = useCallback(
(updatedConditions: TriggerCondition[] | undefined) =>
updatedConditions && updatedConditions.length > 0
? updatedConditions.every((condition) => condition.id && condition.value)
: true,
(updatedConditions: TriggerCondition[] = []) =>
updatedConditions.every((condition) => condition.id && condition.value),
[]
)

Expand Down
12 changes: 6 additions & 6 deletions packages/@dcl/inspector/test/e2e/Assets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ describe('Assets', () => {
}, 100_000)

test('Drag asset from file system into renderer', async () => {
// There should not be an entity in the Hierarchy tree with the name casla.glb at the start
await expect(Hierarchy.getId('casla-glb.glb')).rejects.toThrow()
// There should not be an entity in the Hierarchy tree with the name example.glb at the start
await expect(Hierarchy.getId('example.glb')).rejects.toThrow()

await Assets.selectTab(AssetsTab.FileSystem)
await Assets.openFolder('scene')
await Assets.openFolder('scene/models2')
await Assets.openFolder('scene/models')

await Assets.addFileSystemAsset('scene/models2/casla-glb.glb')
await Assets.addFileSystemAsset('scene/models/example.glb')

// There should be an entity in the Hierarchy tree with the name Pebbles
await expect(Hierarchy.getId('casla-glb.glb')).resolves.toBeGreaterThanOrEqual(152)
// There should be an entity in the Hierarchy tree with the name example.glb
await expect(Hierarchy.getId('example.glb')).resolves.toBeGreaterThanOrEqual(152)
}, 100_000)

test('Drag asset from Builder into renderer', async () => {
Expand Down

0 comments on commit db59bf1

Please sign in to comment.