eyeling 1.23.2 → 1.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -488,6 +488,8 @@ async function main() {
488
488
  // Intercept CodeMirror + remote GitHub raw URLs (keep test deterministic).
489
489
  const localPkg = fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8');
490
490
  const localEyeling = fs.readFileSync(path.join(ROOT, 'eyeling.js'), 'utf8');
491
+ const localSudoku = fs.readFileSync(path.join(ROOT, 'examples', 'sudoku.n3'), 'utf8');
492
+ const localSudokuBuiltin = fs.readFileSync(path.join(ROOT, 'examples', 'builtin', 'sudoku.js'), 'utf8');
491
493
 
492
494
  const intercept = new Map([
493
495
  // CodeMirror assets (CDN)
@@ -517,6 +519,14 @@ async function main() {
517
519
  'https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/eyeling.js',
518
520
  { ct: 'application/javascript', body: localEyeling },
519
521
  ],
522
+ [
523
+ 'https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/examples/sudoku.n3',
524
+ { ct: 'text/plain', body: localSudoku },
525
+ ],
526
+ [
527
+ 'https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/examples/builtin/sudoku.js',
528
+ { ct: 'application/javascript', body: localSudokuBuiltin },
529
+ ],
520
530
  ]);
521
531
 
522
532
  await cdp.send(
@@ -641,6 +651,21 @@ async function main() {
641
651
  })()`);
642
652
  }
643
653
 
654
+ async function loadUrlIntoEditor(url) {
655
+ const payload = JSON.stringify(String(url));
656
+ await evalInPage(`(() => {
657
+ const input = document.getElementById('n3-uri');
658
+ const asBackground = document.getElementById('load-as-background');
659
+ const btn = document.getElementById('load-uri-btn');
660
+ if (!input) throw new Error('n3-uri input not found');
661
+ if (!btn) throw new Error('load-uri-btn not found');
662
+ input.value = ${payload};
663
+ if (asBackground) asBackground.checked = false;
664
+ btn.click();
665
+ return true;
666
+ })()`);
667
+ }
668
+
644
669
  async function waitForState(label, predicate, timeoutMs = 60000) {
645
670
  const deadline = Date.now() + timeoutMs;
646
671
  let last = { status: '', output: '', highlighted: [] };
@@ -731,6 +756,26 @@ ${JSON.stringify(last, null, 2)}`);
731
756
  );
732
757
  ok('playground renders log:outputString cleanly in Output');
733
758
 
759
+ // 5) URL-loaded repository examples should auto-load matching examples/builtin/<stem>.js.
760
+ await loadUrlIntoEditor('https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/examples/sudoku.n3');
761
+ await waitForState(
762
+ 'sudoku URL loaded with companion builtin',
763
+ (st) => /loaded n3 into the editor and loaded its example builtin/i.test(String(st.status || '')),
764
+ 20000,
765
+ );
766
+ await clickRun();
767
+ const sudoku = await waitForState(
768
+ 'URL-loaded Sudoku example completion',
769
+ (st) =>
770
+ String(st.status || '')
771
+ .trim()
772
+ .startsWith('Done') && /The puzzle is solved/i.test(String(st.output || '')),
773
+ 60000,
774
+ );
775
+ assert.match(sudoku.output, /Completed grid/i, 'Expected Sudoku rendered output');
776
+ assert.match(sudoku.output, /unique valid Sudoku solution/i, 'Expected Sudoku builtin-backed result');
777
+ ok('playground auto-loads a companion example builtin for URL-loaded Sudoku');
778
+
734
779
  // Ensure no uncaught runtime exceptions.
735
780
  assert.equal(exceptions.length, 0, `Uncaught exceptions in demo.html: ${JSON.stringify(exceptions[0] || {})}`);
736
781