Skip to content

Commit 2ba09c9

Browse files
akoclaude
andcommitted
Add DATAGRID and GALLERY mx check integration tests (issues #6, #7)
Validates that pages with DATAGRID and GALLERY widgets pass mx check after the placeholder ID leak fix. Both issues share the same root cause in augment.go's regenerateNestedIDs ordering. - TestMxCheck_DataGridPage: DATAGRID with explicit columns — 0 errors - TestMxCheck_DataGridNoColumns: template defaults — no structural errors - TestMxCheck_GalleryPage: GALLERY with content widget — 0 errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0948144 commit 2ba09c9

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

mdl/executor/roundtrip_mxcheck_datagrid_test.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,60 @@ func TestMxCheck_DataGridNoColumns(t *testing.T) {
136136
t.Logf("mx check passed for DATAGRID (no columns) page:\n%s", output)
137137
}
138138
}
139+
140+
// TestMxCheck_GalleryPage creates a page with a GALLERY widget and verifies
141+
// mx check passes. Regression test for issue #7: same placeholder ID leak
142+
// as issue #6 but for the Gallery widget.
143+
func TestMxCheck_GalleryPage(t *testing.T) {
144+
if !mxCheckAvailable() {
145+
t.Skip("mx command not available")
146+
}
147+
148+
env := setupTestEnv(t)
149+
defer env.teardown()
150+
151+
entityName := testModule + ".MxCheckGalleryItem"
152+
env.registerCleanup("entity", entityName)
153+
154+
if err := env.executeMDL(`CREATE OR MODIFY PERSISTENT ENTITY ` + entityName + ` (
155+
Heading: String(200),
156+
Summary: String(500)
157+
);`); err != nil {
158+
t.Fatalf("Failed to create entity: %v", err)
159+
}
160+
161+
pageName := testModule + ".MxCheckGalleryPage"
162+
env.registerCleanup("page", pageName)
163+
164+
createPageMDL := `CREATE PAGE ` + pageName + ` (
165+
Title: 'Gallery Check Test',
166+
Layout: Atlas_Core.Atlas_Default
167+
) {
168+
LAYOUTGRID mainGrid {
169+
ROW row1 {
170+
COLUMN col1 (DesktopWidth: 12) {
171+
GALLERY gal (DataSource: DATABASE ` + entityName + `) {
172+
DYNAMICTEXT dtHeading (Content: '{1}', ContentParams: [{1} = Heading])
173+
}
174+
}
175+
}
176+
}
177+
}`
178+
179+
if err := env.executeMDL(createPageMDL); err != nil {
180+
t.Fatalf("Failed to create page with GALLERY: %v", err)
181+
}
182+
183+
env.executor.Execute(&ast.DisconnectStmt{})
184+
185+
output, err := runMxCheck(t, env.projectPath)
186+
if err != nil {
187+
if strings.Contains(output, "placeholder") || strings.Contains(output, "CE0463") {
188+
t.Errorf("mx check found structural errors for GALLERY page (possible placeholder leak):\n%s", output)
189+
} else {
190+
t.Logf("mx check output:\n%s", output)
191+
}
192+
} else {
193+
t.Logf("mx check passed for GALLERY page:\n%s", output)
194+
}
195+
}

0 commit comments

Comments
 (0)