blob: a31e53d32857f5715321e68af01da8322d97d051 [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>Button and buttons attribute test for mouse</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript" src="pointerevent_support.js"></script>
</head>
<body onload="run()">
<h1>Button attribute test for mouse</h1>
<h2>This test is for mouse only</h2>
<h4>
Test Description: This test checks if button attribute for mouse handled properly.
<p>Put your mouse over the black rectangle</p>
</h4>
<p>
<div id="target0" style="background:black"></div>
<script>
var eventTested = false;
var detected_pointertypes = {};
setup({ explicit_done: true });
add_completion_callback(showPointerTypes);
function run() {
var target0 = document.getElementById("target0");
// If pointerType is "mouse" and no mouse button is depressed, then the button attribute of the pointermove event must be -1 and the buttons attribute must be 0.
// TA: 5.8
on_event(target0, "pointerover", function (event) {
detected_pointertypes[event.pointerType] = true;
if(event.pointerType != "mouse") {
alert("Use mouse for this test please!");
return;
}
if (eventTested == false) {
test(function() {
assert_true(event.button == -1, "If mouse buttons are released button attribute is -1")
}, "If mouse buttons are released button attribute is -1");
test(function() {
assert_true(event.buttons == 0, "If mouse buttons are released buttons attribute is 0")
}, "If mouse buttons are released buttons attribute is 0");
eventTested = true;
done();
}
});
}
</script>
<h1>Pointer Events button attribute test for mouse test</h1>
<div id="complete-notice">
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
</div>
<div id="log"></div>
</body>
</html>