mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-12 07:12:54 +01:00
4.6 KiB
4.6 KiB
TASK-009 Testing Guide: JavaScriptEditor
✅ Integration Complete!
The JavaScriptEditor is now integrated with a feature flag. You can test it immediately!
How to Enable the New Editor
Option 1: Browser DevTools Console
- Run the editor:
npm run dev - Open DevTools (Cmd+Option+I)
- In the console, type:
localStorage.setItem('use-javascript-editor', 'true'); - Refresh the editor (Cmd+R)
Option 2: Electron DevTools
- Start the editor
- View → Toggle Developer Tools
- Console tab
- Same command as above
Testing Checklist
Test 1: Expression Node
- ✅ Create/Open Expression node (e.g., in a Number node property)
- ✅ Check console - Should see:
🔥 Using NEW JavaScriptEditor for: javascript - ✅ Code loads - Your expression appears correctly (e.g.,
a + b) - ✅ Edit code - Type a valid expression
- ✅ See validation - Status shows "✓ Valid"
- ✅ Try invalid code - Type
a + + b - ✅ See error - Error panel appears with helpful message
- ✅ Save - Click Save button or Cmd+S
- ✅ Close editor - Close the popout
- ✅ Reopen - Code is still there!
- ✅ Check connections - Input/output connections intact
Test 2: Function Node
- ✅ Create/Open Function node
- ✅ Console shows:
🔥 Using NEW JavaScriptEditor for: javascript - ✅ Code loads - Function body appears
- ✅ Edit - Modify the function code
- ✅ Validation - Try valid/invalid syntax
- ✅ Format - Click Format button
- ✅ Save and reopen - Code persists
- ✅ Connections intact
Test 3: Script Node
- ✅ Create/Open Script node
- ✅ Console shows:
🔥 Using NEW JavaScriptEditor for: typescript - ✅ Code loads
- ✅ Edit and save
- ✅ Code persists
- ✅ Connections intact
What to Look For
✅ Good Signs
- Editor opens instantly (no Monaco lag)
- Code appears correctly
- You can type smoothly
- Format button works
- Save button works
- Cmd+S saves
- Error messages are helpful
- No console errors (except the 🔥 message)
⚠️ Warning Signs
- Code doesn't load
- Code gets corrupted
- Connections disappear
- Can't save
- Console errors
- Editor won't open
If Something Goes Wrong
Instant Rollback
In DevTools Console:
localStorage.setItem('use-javascript-editor', 'false');
Then refresh - Back to Monaco!
Your code is NEVER at risk because:
- Same storage format (string)
- Same parameter name ('code')
- No data transformation
- Instant rollback available
Debugging
Check What's Enabled
localStorage.getItem('use-javascript-editor');
// Returns: 'true' or 'false' or null
Check Current Code Value
When a node is selected:
// In console
NodeGraphEditor.instance.getSelectedNode().getParameter('code');
Clear Flag
localStorage.removeItem('use-javascript-editor');
Known Differences from Monaco
What's Missing (By Design)
- ❌ Syntax highlighting (just monospace font)
- ❌ Autocomplete (type manually)
- ❌ Live error checking (validates on blur/save)
What's Better
- ✅ Actually works in Electron!
- ✅ No web worker errors
- ✅ Opens instantly
- ✅ Simple and reliable
- ✅ Clear error messages
Reporting Issues
If You Find a Bug
Document:
- What node type? (Expression/Function/Script)
- What happened?
- What did you expect?
- Can you reproduce it?
- Console errors?
Then:
- Toggle flag back to
false - Note the issue
- We'll fix it!
Next Steps After Testing
If It Works Well
- Keep using it!
- Test with more complex code
- Test with multiple projects
- Report any issues you find
When Ready to Make Default
- Remove feature flag check
- Make JavaScriptEditor the default
- Remove Monaco code (if unused elsewhere)
- Update documentation
Current Status
- JavaScriptEditor component built
- Integration with CodeEditorType complete
- Feature flag enabled
- ← YOU ARE HERE: Testing phase
- Fix any issues found
- Make default after testing
- Remove Monaco dependencies
Quick Command Reference
// Enable new editor
localStorage.setItem('use-javascript-editor', 'true');
// Disable new editor (rollback)
localStorage.setItem('use-javascript-editor', 'false');
// Check status
localStorage.getItem('use-javascript-editor');
// Clear (uses default = Monaco)
localStorage.removeItem('use-javascript-editor');
Ready to test! Enable the flag and open an Expression node. You should see the new editor! 🎉