mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
Fix the Screen and ScreenOrientation prototype
This commit is contained in:
29
src/tests/html/error_event.html
Normal file
29
src/tests/html/error_event.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<script src="../testing.js"></script>
|
||||
|
||||
<script id=ErrorEvent>
|
||||
let e1 = new ErrorEvent('err1')
|
||||
testing.expectEqual('', e1.message);
|
||||
testing.expectEqual('', e1.filename);
|
||||
testing.expectEqual(0, e1.lineno);
|
||||
testing.expectEqual(0, e1.colno);
|
||||
testing.expectEqual(undefined, e1.error);
|
||||
|
||||
let e2 = new ErrorEvent('err1', {
|
||||
message: 'm1',
|
||||
filename: 'fx19',
|
||||
lineno: 443,
|
||||
colno: 8999,
|
||||
error: 'under 9000!',
|
||||
});
|
||||
|
||||
testing.expectEqual('m1', e2.message);
|
||||
testing.expectEqual('fx19', e2.filename);
|
||||
testing.expectEqual(443, e2.lineno);
|
||||
testing.expectEqual(8999, e2.colno);
|
||||
testing.expectEqual('under 9000!', e2.error);
|
||||
</script>
|
||||
|
||||
<script id=ErrorEvent>
|
||||
let e3 = new ErrorEvent('err3')
|
||||
e3.addEventListener('change', () => {});
|
||||
</script>
|
||||
20
src/tests/html/screen.html
Normal file
20
src/tests/html/screen.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<script src="../testing.js"></script>
|
||||
|
||||
<script id=screen>
|
||||
let screen = window.screen;
|
||||
testing.expectEqual(1920, screen.width);
|
||||
testing.expectEqual(1080, screen.height);
|
||||
|
||||
let orientation = screen.orientation;
|
||||
testing.expectEqual(0, orientation.angle);
|
||||
testing.expectEqual('landscape-primary', orientation.type);
|
||||
|
||||
// this shouldn't crash (it used to)
|
||||
screen.addEventListener('change', () => {});
|
||||
</script>
|
||||
|
||||
<script id=orientation>
|
||||
screen.orientation.addEventListener('change', () => {})
|
||||
// above shouldn't crash (it used to)
|
||||
testing.skip();
|
||||
</script>
|
||||
Reference in New Issue
Block a user