From 4a6fac89d5d7cacec15ad823d523069edf7cdb87 Mon Sep 17 00:00:00 2001 From: Chiu Peter Date: Fri, 3 Oct 2025 13:04:44 -0700 Subject: [PATCH 1/4] update transformIgnorePatterns in jest.config.js; remove objectToAnimate in Scene; add comment in SearchUI/ondex.tsc --- jest.config.js | 2 +- src/components/crystal-toolkit/scene/Scene.ts | 3 --- src/components/data-display/SearchUI/index.tsx | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jest.config.js b/jest.config.js index 7322d24c..b524d01e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,7 +10,7 @@ module.exports = { * This is necessary for node modules that distribute their source code as uncompiled JS. */ transformIgnorePatterns: [ - 'node_modules/(?!(three|unist-.*|hast-.*|rehype-slug|remark-rehype|react-markdown|vfile.*|unified|bail|is-plain-obj|trough|remark-parse|mdast-.*|micromark.*|decode-named-character-reference|unist-.*|character-entities|property-information|space-separated-tokens|comma-separated-tokens)/)' + 'node_modules/(?!(three|trim-lines|github-slugger|unist-.*|hast-.*|rehype-slug|remark-rehype|react-markdown|vfile.*|unified|bail|is-plain-obj|trough|remark-parse|mdast-.*|micromark.*|decode-named-character-reference|unist-.*|character-entities|property-information|space-separated-tokens|comma-separated-tokens)/)' ], modulePaths: [''], moduleDirectories: ['node_modules', ''], diff --git a/src/components/crystal-toolkit/scene/Scene.ts b/src/components/crystal-toolkit/scene/Scene.ts index a4299615..77060125 100644 --- a/src/components/crystal-toolkit/scene/Scene.ts +++ b/src/components/crystal-toolkit/scene/Scene.ts @@ -459,9 +459,6 @@ export default class Scene { this.threeUUIDTojsonObject[object.uuid] = childObject; this.computeIdToThree[`${currentId}--${idx}`] = object; childObject.id = `${currentId}--${idx}`; - if (childObject.animate) { - objectToAnimate.add(`${currentId}--${idx}`); - } } else { const threeObject = new THREE.Object3D(); threeObject.name = childObject.name!; diff --git a/src/components/data-display/SearchUI/index.tsx b/src/components/data-display/SearchUI/index.tsx index e69de29b..90386b2f 100644 --- a/src/components/data-display/SearchUI/index.tsx +++ b/src/components/data-display/SearchUI/index.tsx @@ -0,0 +1 @@ +// src/components/data-display/SearchUI/index.tsx From 5859e65e08e6c3eb379c21e8d3ec1322f13efa59 Mon Sep 17 00:00:00 2001 From: Chiu Peter Date: Fri, 3 Oct 2025 13:15:17 -0700 Subject: [PATCH 2/4] add branch to workflow --- .github/workflows/jest_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/jest_tests.yml b/.github/workflows/jest_tests.yml index 9e76e4af..31ccec9d 100644 --- a/.github/workflows/jest_tests.yml +++ b/.github/workflows/jest_tests.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - github_action_tests jobs: test: From 0ae23cce2fe9a7206bf15b76b753b064c0209c7d Mon Sep 17 00:00:00 2001 From: Chiu Peter Date: Mon, 6 Oct 2025 11:03:00 -0700 Subject: [PATCH 3/4] update CrystalToolkitAnimationScene test --- .../CrystalToolkitAnimationScene.test.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx index ec892e99..a79b5225 100644 --- a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx +++ b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx @@ -1,12 +1,15 @@ import { mount } from 'enzyme'; import * as React from 'react'; import { CrystalToolkitAnimationScene } from './CrystalToolkitAnimationScene'; -import { s2 as scene } from '../scene/simple-scene'; +import { phonon_scene as scene } from '../scene/phonon-animation-scene'; import { MOUNT_NODE_CLASS, Renderer } from '../scene/constants'; import Scene from '../scene/Scene'; const spy = jest.spyOn(Scene.prototype, 'renderScene'); -const RENDERSCENE_CALLS_BY_REACT_RENDERING = 1; // goal is to reach 1 and stay there :) +const RENDERSCENE_CALLS_BY_REACT_RENDERING = 3; +// goal is to reach 1 and stay there :) +// MHC: not share why reach 1 is the goal... +// But in this test, when mount, run animate(), addToScene(), and resizeRendererToDisplaySize() // When we run test, three.js is bundled differently, and we encounter again the bug // where we have 2 different instances of three From 292ac0ed756ab03dba081840970dec8f4de8865d Mon Sep 17 00:00:00 2001 From: Chiu Peter Date: Mon, 6 Oct 2025 13:56:28 -0700 Subject: [PATCH 4/4] remove animate from test case for CrystalToolkitAnimation (static) --- demo/app.tsx | 2 +- .../CrystalToolkitAnimationScene.test.tsx | 5 +- .../CrystalToolkitAnimationScene.tsx | 2 +- src/components/crystal-toolkit/scene/Scene.ts | 3 + .../crystal-toolkit/scene/animation-helper.ts | 1 - .../crystal-toolkit/scene/simple-scene.ts | 272 ++++++++++++++++++ .../MatscholarSearchUIContextProvider.tsx | 3 +- .../CrystalStructureAnimationViewer.tsx | 4 +- 8 files changed, 282 insertions(+), 10 deletions(-) diff --git a/demo/app.tsx b/demo/app.tsx index 5b215dbf..b6376182 100644 --- a/demo/app.tsx +++ b/demo/app.tsx @@ -27,7 +27,7 @@ ReactDOM.render(
- +
diff --git a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx index a79b5225..77fea1d1 100644 --- a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx +++ b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.test.tsx @@ -6,10 +6,7 @@ import { MOUNT_NODE_CLASS, Renderer } from '../scene/constants'; import Scene from '../scene/Scene'; const spy = jest.spyOn(Scene.prototype, 'renderScene'); -const RENDERSCENE_CALLS_BY_REACT_RENDERING = 3; -// goal is to reach 1 and stay there :) -// MHC: not share why reach 1 is the goal... -// But in this test, when mount, run animate(), addToScene(), and resizeRendererToDisplaySize() +const RENDERSCENE_CALLS_BY_REACT_RENDERING = 3; // goal is to reach 1 and stay there :) // When we run test, three.js is bundled differently, and we encounter again the bug // where we have 2 different instances of three diff --git a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.tsx b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.tsx index dc535c01..777b36d1 100644 --- a/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.tsx +++ b/src/components/crystal-toolkit/CrystalToolkitAnimationScene/CrystalToolkitAnimationScene.tsx @@ -419,9 +419,9 @@ export const CrystalToolkitAnimationScene: React.FC = ({ const params: any = preprocessQueryParams( { ...query, ...props.apiEndpointParams }, state.filterGroups, - defaultQuery + defaultQuery, + '' ); params[props.fieldsKey] = fields; diff --git a/src/pages/CrystalStructureAnimationViewer/CrystalStructureAnimationViewer.tsx b/src/pages/CrystalStructureAnimationViewer/CrystalStructureAnimationViewer.tsx index 7fdbb342..a4ff1351 100644 --- a/src/pages/CrystalStructureAnimationViewer/CrystalStructureAnimationViewer.tsx +++ b/src/pages/CrystalStructureAnimationViewer/CrystalStructureAnimationViewer.tsx @@ -184,8 +184,8 @@ export const CrystalStructureAnimationViewer: React.FC = () => { extractAxis: false, zoomToFit2D: true }} - //data={phonon_scene} - data={phonon_position_scene} + data={phonon_scene} + // data={phonon_position_scene} sceneSize="100%" debug={false} toggleVisibility={{}}