mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-21 20:24:42 +00:00
Merge pull request #1836 from mvanhorn/osc/1822-fix-axvalue-integer-string
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / wba-demo-scripts (push) Has been cancelled
e2e-test / wba-test (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / zig build release (push) Has been cancelled
wpt / build wpt runner (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / wba-demo-scripts (push) Has been cancelled
e2e-test / wba-test (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / zig build release (push) Has been cancelled
wpt / build wpt runner (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
fix: serialize AXValue integer as string per CDP spec
This commit is contained in:
@@ -228,6 +228,13 @@ pub const Writer = struct {
|
||||
|
||||
try w.objectField("value");
|
||||
switch (value) {
|
||||
.integer => |v| {
|
||||
// CDP spec requires integer values to be serialized as strings.
|
||||
// 20 bytes is enough for the decimal representation of a 64-bit integer.
|
||||
var buf: [20]u8 = undefined;
|
||||
const s = try std.fmt.bufPrint(&buf, "{d}", .{v});
|
||||
try w.write(s);
|
||||
},
|
||||
inline else => |v| try w.write(v),
|
||||
}
|
||||
|
||||
@@ -1212,4 +1219,25 @@ test "AXNode: writer" {
|
||||
// Check childIds array exists
|
||||
const child_ids = doc_node.get("childIds").?.array.items;
|
||||
try testing.expect(child_ids.len > 0);
|
||||
|
||||
// Find the h1 node and verify its level property is serialized as a string
|
||||
for (nodes) |node_val| {
|
||||
const obj = node_val.object;
|
||||
const role_obj = obj.get("role") orelse continue;
|
||||
const role_val = role_obj.object.get("value") orelse continue;
|
||||
if (!std.mem.eql(u8, role_val.string, "heading")) continue;
|
||||
|
||||
const props = obj.get("properties").?.array.items;
|
||||
for (props) |prop| {
|
||||
const prop_obj = prop.object;
|
||||
const name_str = prop_obj.get("name").?.string;
|
||||
if (!std.mem.eql(u8, name_str, "level")) continue;
|
||||
const level_value = prop_obj.get("value").?.object;
|
||||
try testing.expectEqual("integer", level_value.get("type").?.string);
|
||||
// CDP spec: integer values must be serialized as strings
|
||||
try testing.expectEqual("1", level_value.get("value").?.string);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return error.HeadingNodeNotFound;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user