1818
1919const std = @import ("std" );
2020
21+ const parser = @import ("../netsurf.zig" );
2122const EventTarget = @import ("../dom/event_target.zig" ).EventTarget ;
2223
2324pub const Interfaces = .{
@@ -29,6 +30,8 @@ pub const Interfaces = .{
2930pub const Screen = struct {
3031 pub const prototype = * EventTarget ;
3132
33+ proto : parser.EventTargetTBase = .{ .internal_target_type = .screen },
34+
3235 height : u32 = 1080 ,
3336 width : u32 = 1920 ,
3437 // https://developer.mozilla.org/en-US/docs/Web/API/Screen/colorDepth
@@ -83,6 +86,7 @@ pub const ScreenOrientation = struct {
8386
8487 angle : u32 = 0 ,
8588 type : ScreenOrientationType ,
89+ proto : parser.EventTargetTBase = .{ .internal_target_type = .screen_orientation },
8690
8791 pub fn get_angle (self : * const ScreenOrientation ) u32 {
8892 return self .angle ;
@@ -94,16 +98,6 @@ pub const ScreenOrientation = struct {
9498};
9599
96100const testing = @import ("../../testing.zig" );
97- test "Browser.HTML.Screen" {
98- var runner = try testing .jsRunner (testing .tracking_allocator , .{});
99- defer runner .deinit ();
100-
101- try runner .testCases (&.{
102- .{ "let screen = window.screen" , "undefined" },
103- .{ "screen.width === 1920" , "true" },
104- .{ "screen.height === 1080" , "true" },
105- .{ "let orientation = screen.orientation" , "undefined" },
106- .{ "orientation.angle === 0" , "true" },
107- .{ "orientation.type === \" landscape-primary\" " , "true" },
108- }, .{});
101+ test "Browser: HTML.Screen" {
102+ try testing .htmlRunner ("html/screen.html" );
109103}
0 commit comments