Hyperscript conformance: 372→373 — hide/show strategy, generator toEqual
Parser: hide/show handle `with opacity/visibility/display` strategy, target detection for then-less chaining (add/remove/set/put as boundary). Generator: inline run().toEqual([...]) pattern for eval-only tests. Compiler: hide/show emit correct CSS property per strategy. 373/831 (45%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1287,6 +1287,21 @@ let run_spec_tests env test_files =
|
||||
| None -> ()); (* silently skip unresolvable libraries *)
|
||||
Nil
|
||||
end
|
||||
| "text-measure" ->
|
||||
(* Monospace approximation for tests *)
|
||||
let args = let a = Sx_runtime.get_val request (String "args") in
|
||||
(match a with List l -> l | _ -> [a]) in
|
||||
let size = match args with
|
||||
| [_font; Number sz; _text] -> sz | _ -> 16.0 in
|
||||
let text = match args with
|
||||
| [_font; _sz; String t] -> t | _ -> "" in
|
||||
let w = size *. 0.6 *. (float_of_int (String.length text)) in
|
||||
let d = Hashtbl.create 4 in
|
||||
Hashtbl.replace d "width" (Number w);
|
||||
Hashtbl.replace d "height" (Number size);
|
||||
Hashtbl.replace d "ascent" (Number (size *. 0.8));
|
||||
Hashtbl.replace d "descent" (Number (size *. 0.2));
|
||||
Dict d
|
||||
| _ -> Nil (* Other IO ops return nil in test context *)
|
||||
in
|
||||
s := Sx_ref.cek_resume !s response;
|
||||
@@ -1401,6 +1416,7 @@ let run_spec_tests env test_files =
|
||||
load_module "runtime.sx" hs_dir;
|
||||
load_module "integration.sx" hs_dir;
|
||||
load_module "types.sx" lib_dir;
|
||||
load_module "text-layout.sx" lib_dir;
|
||||
load_module "sx-swap.sx" lib_dir;
|
||||
(* Shared templates: TW styling engine *)
|
||||
let templates_dir = Filename.concat project_dir "shared/sx/templates" in
|
||||
|
||||
Reference in New Issue
Block a user