You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CodeHealth] Update PE attribute tests for a cleaner wpt.fyi status.
- Remove redundant assert messages.
- Combine related asserts into fewer tests.
- Add missing type checks for inherited attributes.
- Clean up the use of action Promises.
Change-Id: I1e87af6e55d13be23a959bd0ee5e28d96a510ab9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4086645
Reviewed-by: Kevin Ellis <[email protected]>
Commit-Queue: Mustaq Ahmed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1081495}
assert_equals(event.type,expectedEventType,"Event.type should be "+expectedEventType)
40
-
},pointerTestName+"'s type should be "+expectedEventType);
40
+
assert_equals(event.type,expectedEventType);
41
+
},pointerTestName+".type should be "+expectedEventType);
41
42
42
43
// Test button and buttons
43
44
if(event.type=='pointerdown'){
44
45
test(function(){
45
-
assert_equals(event.button,0,"Button attribute is 0")
46
-
},pointerTestName+"'s button attribute is 0 when left mouse button is pressed.");
46
+
assert_equals(event.button,0);
47
+
},pointerTestName+".button attribute is 0 when left mouse button is pressed.");
47
48
test(function(){
48
-
assert_equals(event.buttons,1,"Buttons attribute is 1")
49
-
},pointerTestName+"'s buttons attribute is 1 when left mouse button is pressed.");
49
+
assert_equals(event.buttons,1);
50
+
},pointerTestName+".buttons attribute is 1 when left mouse button is pressed.");
50
51
}elseif(event.type=='pointerup'){
51
52
test(function(){
52
-
assert_equals(event.button,0,"Button attribute is 0")
53
-
},pointerTestName+"'s button attribute is 0 when left mouse button is just released.");
53
+
assert_equals(event.button,0);
54
+
},pointerTestName+".button attribute is 0 when left mouse button is just released.");
54
55
test(function(){
55
-
assert_equals(event.buttons,0,"Buttons attribute is 0")
56
-
},pointerTestName+"'s buttons attribute is 0 when left mouse button is just released.");
56
+
assert_equals(event.buttons,0);
57
+
},pointerTestName+".buttons attribute is 0 when left mouse button is just released.");
57
58
}else{
58
59
test(function(){
59
-
assert_equals(event.button,-1,"Button attribute is -1")
60
-
},pointerTestName+"'s button is -1 when mouse buttons are in released state.");
60
+
assert_equals(event.button,-1);
61
+
},pointerTestName+".button is -1 when mouse buttons are in released state.");
61
62
test(function(){
62
-
assert_equals(event.buttons,0,"Buttons attribute is 0")
63
-
},pointerTestName+"'s buttons is 0 when mouse buttons are in released state.");
63
+
assert_equals(event.buttons,0);
64
+
},pointerTestName+".buttons is 0 when mouse buttons are in released state.");
64
65
}
65
66
66
67
// Test clientX and clientY
@@ -70,38 +71,37 @@
70
71
assert_greater_than_equal(event.clientY,targetBoundingClientRect.top,"clientY should be greater or equal than top of the box");
71
72
assert_less_than_equal(event.clientX,targetBoundingClientRect.right,"clientX should be less or equal than right of the box");
72
73
assert_less_than_equal(event.clientY,targetBoundingClientRect.bottom,"clientY should be less or equal than bottom of the box");
73
-
},pointerTestName+"'s ClientX and ClientY attributes are correct.");
74
+
},pointerTestName+".clientX and .clientY attributes are correct.");
74
75
}else{
75
76
test(function(){
76
-
assert_true(event.clientX<targetBoundingClientRect.left||event.clientX>=targetBoundingClientRect.right||event.clientY<targetBoundingClientRect.top||event.clientY>=targetBoundingClientRect.bottom,"ClientX/Y should be out of the boundaries of the box");
77
-
},pointerTestName+"'s ClientX and ClientY attributes are correct.");
assert_equals(event.buttons,1,"Buttons attribute is 1")
47
-
},pointerTestName+"'s buttons attribute is 1 on touch-down.");
47
+
assert_equals(event.buttons,1);
48
+
},pointerTestName+".buttons attribute is 1 on touch-down.");
48
49
}else{
49
50
test(function(){
50
-
assert_equals(event.buttons,0,"Buttons attribute is 0")
51
-
},pointerTestName+"'s buttons is 0 on touch-release.");
51
+
assert_equals(event.buttons,0);
52
+
},pointerTestName+".buttons is 0 on touch-release.");
52
53
}
53
54
54
55
// Test clientX and clientY
55
56
test(function(){
56
-
assert_true(event.clientX>=targetBoundingClientRect.left&&event.clientX<targetBoundingClientRect.right&&event.clientY>=targetBoundingClientRect.top&&event.clientY<targetBoundingClientRect.bottom,"ClientX/Y should be in the boundaries of the box");
57
-
},pointerTestName+"'s ClientX and ClientY attributes are correct.");
0 commit comments