| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
| 3 | 3 |
| 4 <title>Geometry Interfaces: DOMRect</title> | 4 <title>Geometry Interfaces: DOMRect</title> |
| 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> | 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> |
| 6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
| 8 <script src="./resources/geometry-interfaces-test-helpers.js"></script> | 8 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
| 9 <script> | 9 <script> |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); | 34 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); |
| 35 }, 'DOMRect constructor with x, y, width, height parameters'); | 35 }, 'DOMRect constructor with x, y, width, height parameters'); |
| 36 | 36 |
| 37 test(() => { | 37 test(() => { |
| 38 var rect = new DOMRect(10, 20, -80, -50); | 38 var rect = new DOMRect(10, 20, -80, -50); |
| 39 assert_dom_rect_equals(rect, [10, 20, -80, -50, -30, 10, 20, -70]); | 39 assert_dom_rect_equals(rect, [10, 20, -80, -50, -30, 10, 20, -70]); |
| 40 }, 'DOMRect constructor with negative width and height parameters'); | 40 }, 'DOMRect constructor with negative width and height parameters'); |
| 41 | 41 |
| 42 test(() => { | 42 test(() => { |
| 43 var rect = new DOMRect(10, 20, 80, 50); | 43 var rect = new DOMRect(10, 20, 80, 50); |
| 44 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top:
20, right: 90, bottom: 70, left: 10}); |
| 45 }, 'DOMRect toJSON'); |
| 46 |
| 47 test(() => { |
| 48 var rect = new DOMRect(10, 20, 80, 50); |
| 44 rect.x = 30; | 49 rect.x = 30; |
| 45 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); | 50 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); |
| 46 rect.y = -10; | 51 rect.y = -10; |
| 47 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); | 52 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); |
| 48 rect.width = 20; | 53 rect.width = 20; |
| 49 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); | 54 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); |
| 50 rect.height = 40; | 55 rect.height = 40; |
| 51 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); | 56 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); |
| 52 }, 'DOMRect setter'); | 57 }, 'DOMRect setter'); |
| 53 | 58 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 }, 'DOMRectReadOnly constructor with x, y, width, height parameters'); | 82 }, 'DOMRectReadOnly constructor with x, y, width, height parameters'); |
| 78 | 83 |
| 79 test(() => { | 84 test(() => { |
| 80 var rect = new DOMRectReadOnly(10, 20, 80, 50); | 85 var rect = new DOMRectReadOnly(10, 20, 80, 50); |
| 81 assert_readonly(rect, 'x'); | 86 assert_readonly(rect, 'x'); |
| 82 assert_readonly(rect, 'y'); | 87 assert_readonly(rect, 'y'); |
| 83 assert_readonly(rect, 'width'); | 88 assert_readonly(rect, 'width'); |
| 84 assert_readonly(rect, 'height'); | 89 assert_readonly(rect, 'height'); |
| 85 }, 'DOMRectReadOnly readonly test'); | 90 }, 'DOMRectReadOnly readonly test'); |
| 86 | 91 |
| 92 test(() => { |
| 93 var rect = new DOMRectReadOnly(10, 20, 80, 50); |
| 94 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top:
20, right: 90, bottom: 70, left: 10}); |
| 95 }, 'DOMRectReadOnly toJSON'); |
| 96 |
| 87 </script> | 97 </script> |
| OLD | NEW |