Skip to content

Commit e9c7bf7

Browse files
feat(core,ui): add configurable Bootstrap text and JTabView component (#624)
* feat(core): add configurable Bootstrap text via BootstrapText struct Add a serializable BootstrapText struct that externalizes all ~30 user-facing strings from Bootstrap, enabling per-project localization and branding without modifying framework code. Closes #622 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * fix(core): address code review feedback - Add BootstrapText.SafeFormat helper with try/catch fallback for malformed user-edited format strings - Replace all string.Format calls with SafeFormat in Bootstrap.cs - Use nameof(BootstrapText.*) instead of string literals in editor UI - Use BindProperty for JTextField binding (proper undo/prefab support) - Add tests for SafeFormat, Default field validation, exact field count, sub-headers, and reset logic Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * feat(ui): add JTabView component and improve editor UI test coverage - Add JTabView tabbed container component with configurable maxTabsPerRow - Refactor BootstrapEditorUI Text Settings into 6 categorized tabs (3x2 grid) - Add 46 new tests across 8 components using reflection for private methods (JButton, JCard, JObjectField, JTextField, JDropdown, JStack, JTabView, BootstrapEditorUI) - Update GitHub instructions to require 93%+ coverage for non-core packages with support for both EditMode and non-interactive PlayMode tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * chore: update compiled build output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * style(ui): add explicit parentheses for arithmetic precedence Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * fix(core,ui): address code review feedback - Add null guard to BootstrapText.SafeFormat for null templates - Make JTabView._maxTabsPerRow readonly - Use evt.currentTarget instead of evt.target in JTabView handlers - Add SafeFormat null template test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> * fix(ui): use reflection for currentTarget setter in tests The currentTarget setter is internal in UIElements. Use reflection with a null check so tests gracefully skip if the API changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> --------- Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d29713b commit e9c7bf7

35 files changed

+2281
-71
lines changed

.github/instructions/code-review.instructions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,19 @@ Avoid LINQ in hot paths and UI code for performance:
4343
- Use array/list indexing instead of `.First()` / `.Last()`
4444
- LINQ allocates iterators and delegates - avoid in frequently called code
4545

46+
### 7. Unit Test Coverage
47+
New features and new logic in non-core packages (JEngine.UI, JEngine.Util, and any future packages) MUST include unit tests:
48+
- Target **93%+ code coverage** for all new/modified code
49+
- **Applies to**: All `Packages/com.jasonxudeveloper.jengine.*` packages **except** `jengine.core`
50+
- Prefer **EditMode tests** (`Tests/Editor/`) for most logic
51+
- Use **PlayMode tests** (`Tests/Runtime/`) when runtime behavior requires it (MonoBehaviour lifecycle, scene loading, etc.) — these must run **non-interactively** (no user input, no manual scene setup)
52+
- Cover: constructors, public API, fluent chaining, edge cases, event handlers
53+
- Use reflection to test private methods (e.g. `OnAttachToPanel`, hover handlers) when they contain meaningful logic
54+
- Verify tests exercise both happy paths and error/boundary conditions
55+
4656
## Common Issues to Flag
4757

58+
- Missing or insufficient unit tests for new features
4859
- Missing XML documentation on public APIs
4960
- Direct `Debug.Log` (should use proper logging)
5061
- `Task` instead of `UniTask`

.github/instructions/jengine.instructions.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,84 @@ internal class MyEditorClass
102102
}
103103
```
104104

105+
## Unit Testing
106+
107+
### Scope
108+
Unit tests are required for all non-core JEngine packages — i.e. any package under `Packages/com.jasonxudeveloper.jengine.*` **except** `jengine.core`. This includes JEngine.UI, JEngine.Util, and any future packages.
109+
110+
### Coverage Requirement
111+
New features and new logic MUST include unit tests targeting **93%+ code coverage**:
112+
- All public methods, properties, and constructors
113+
- Fluent API chaining
114+
- Edge cases and error conditions
115+
- Event handlers and callbacks (use reflection for private handlers)
116+
117+
### Test Modes
118+
- **EditMode tests** (`Tests/Editor/`): Preferred for most logic — fast, no scene required.
119+
- **PlayMode tests** (`Tests/Runtime/`): Use when the test needs a running game loop, MonoBehaviour lifecycle, or scene loading. PlayMode tests **must run non-interactively** (no user input, no manual scene setup). Use `[UnityTest]` with `UniTask.ToCoroutine()` for async PlayMode tests.
120+
121+
### Test Location
122+
Tests mirror the source structure under each package's test folders:
123+
```
124+
Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JButton.cs
125+
→ Packages/com.jasonxudeveloper.jengine.ui/Tests/Editor/Components/Button/JButtonTests.cs
126+
127+
Packages/com.jasonxudeveloper.jengine.util/Runtime/JAction.cs
128+
→ Packages/com.jasonxudeveloper.jengine.util/Tests/Editor/JActionTests.cs
129+
130+
# PlayMode tests when runtime behavior requires it:
131+
Packages/com.jasonxudeveloper.jengine.util/Runtime/SomeFeature.cs
132+
→ Packages/com.jasonxudeveloper.jengine.util/Tests/Runtime/SomeFeatureTests.cs
133+
```
134+
135+
### EditMode Test Pattern
136+
```csharp
137+
[TestFixture]
138+
public class MyComponentTests
139+
{
140+
private MyComponent _component;
141+
142+
[SetUp]
143+
public void SetUp()
144+
{
145+
_component = new MyComponent();
146+
}
147+
148+
[Test]
149+
public void Constructor_Default_AddsBaseClass()
150+
{
151+
Assert.IsTrue(_component.ClassListContains("my-component"));
152+
}
153+
}
154+
```
155+
156+
### PlayMode Test Pattern
157+
PlayMode tests must be fully automated — no interactive input or manual scene setup:
158+
```csharp
159+
[TestFixture]
160+
public class MyRuntimeTests
161+
{
162+
[UnityTest]
163+
public IEnumerator MyAsyncTest() => UniTask.ToCoroutine(async () =>
164+
{
165+
var go = new GameObject();
166+
var component = go.AddComponent<MyBehaviour>();
167+
await UniTask.DelayFrame(1);
168+
Assert.IsTrue(component.IsInitialized);
169+
Object.Destroy(go);
170+
});
171+
}
172+
```
173+
174+
### Testing Private Methods via Reflection
175+
For private event handlers and internal styling methods:
176+
```csharp
177+
var method = typeof(MyComponent).GetMethod("OnMouseEnter",
178+
BindingFlags.NonPublic | BindingFlags.Instance);
179+
method.Invoke(_component, new object[] { null });
180+
Assert.AreEqual(expectedColor, _component.style.backgroundColor.value);
181+
```
182+
105183
## Review Focus Areas
106184

107185
When reviewing JEngine code, check:
@@ -110,3 +188,4 @@ When reviewing JEngine code, check:
110188
3. Resource cleanup (ScriptableObjects, events)
111189
4. Thread safety for callback-accessed state
112190
5. Proper namespace usage
191+
6. Unit tests with 93%+ coverage for new features/logic
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

UnityProject/Assets/Obfuz/SymbolObfus/symbol-mapping.xml

Lines changed: 128 additions & 20 deletions
Large diffs are not rendered by default.

UnityProject/Assets/StreamingAssets/yoo/main/aa7811a04dda58d98435ef7170ce0828.bundle renamed to UnityProject/Assets/StreamingAssets/yoo/main/64a56ed51df1cee5f53c5ac4760ce454.bundle

15.9 KB
Binary file not shown.

UnityProject/Assets/StreamingAssets/yoo/main/main_260202209.bytes.meta renamed to UnityProject/Assets/StreamingAssets/yoo/main/64a56ed51df1cee5f53c5ac4760ce454.bundle.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

UnityProject/Assets/StreamingAssets/yoo/main/7d008b589c7529b71f703107fc14b2a1.bundle.meta renamed to UnityProject/Assets/StreamingAssets/yoo/main/723671f97fbc4c6dfad84ca9c9664b26.bundle.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)