mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Update CSS tests to revision 31d63cc79bd4c929ed582229e936d7b389f3e6ab
This commit is contained in:
parent
1a81b18b9f
commit
2c9faf5363
91915 changed files with 5979820 additions and 0 deletions
158
tests/wpt/css-tests/css-regions-1_dev/html/mouse-events-004.htm
Normal file
158
tests/wpt/css-tests/css-regions-1_dev/html/mouse-events-004.htm
Normal file
|
@ -0,0 +1,158 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<meta charset="UTF-8">
|
||||
<title>CSS Regions: Removing content nodes on mouse events</title>
|
||||
<link href="mailto:mibalan@adobe.com" rel="author" title="Mihai Balan">
|
||||
<link href="http://www.w3.org/TR/css3-regions/#the-flow-into-property" rel="help">
|
||||
<link href="http://www.w3.org/TR/css3-regions/#the-flow-from-property" rel="help">
|
||||
<meta content="Altering the contents of the named flow via DOM manipulation in response to user gestures (mouse move, mouse click) should works as without regions." name="assert">
|
||||
<meta content="dom interact" name="flags">
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
.box {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
float: left;
|
||||
margin: 20px;
|
||||
}
|
||||
#content {
|
||||
background-color: red;
|
||||
}
|
||||
#content p {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
flow-into: flow;
|
||||
}
|
||||
#region {
|
||||
background-color: yellow;
|
||||
flow-from: flow;
|
||||
}
|
||||
#region p {
|
||||
margin-top: 100px;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
#result {
|
||||
clear: both;
|
||||
font-weight: bold;
|
||||
}
|
||||
.pass {
|
||||
color: green;
|
||||
}
|
||||
.fail {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.phase0 {
|
||||
background-color: green;
|
||||
}
|
||||
.phase1 {
|
||||
background-color: seagreen;
|
||||
}
|
||||
.phase2 {
|
||||
background-color: lime;
|
||||
}
|
||||
.phase3 {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
The test fails if you see any red, the text "FAIL" below the two rectangles below or if any of the expected results below don't happen.
|
||||
<ol>
|
||||
<li>You should see a green and a yellow rectangle, stacked vertically.</li>
|
||||
<li>Move the mouse over the green rectangle. <strong>Expected: </strong>The color should change to a lighter green.</li>
|
||||
<li>Click in the green rectangle. <strong>Expected: </strong>The color should change again to a yet lighter green.</li>
|
||||
<li>Move the mouse over the yellow rectangle.</li>
|
||||
<li><strong>Expected: </strong>The color of the green rectangle should change yet again to a pale green. There should be a green text below that says "PASS".</li>
|
||||
</ol>
|
||||
<div id="content">
|
||||
<p class="phase0"></p>
|
||||
</div>
|
||||
<div class="box" id="region">
|
||||
<p></p>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
<script type="text/javascript">
|
||||
var events = [ {
|
||||
name: "mouseover",
|
||||
hit: false
|
||||
}, {
|
||||
name: "click",
|
||||
hit: false
|
||||
}, {
|
||||
name: "mouseout",
|
||||
hit: false
|
||||
} ],
|
||||
target = document.querySelector("#content"),
|
||||
callCount = 0;
|
||||
|
||||
function setResult(value) {
|
||||
var tag = document.querySelector("#result");
|
||||
tag.innerHTML = value;
|
||||
tag.classList.add(value.toLowerCase());
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
if (window.testRunner) {
|
||||
testRunner.notifyDone();
|
||||
}
|
||||
}
|
||||
|
||||
function handlerForEvent(eventName, index) {
|
||||
return function(evt) {
|
||||
if ((evt.target === evt.currentTarget) || (events[index].hit))
|
||||
return;
|
||||
|
||||
callCount++;
|
||||
events[index].hit = true;
|
||||
|
||||
var nodeToRemove = document.querySelector("#content p"),
|
||||
nodeParent = nodeToRemove.parentNode;
|
||||
|
||||
nodeParent.removeChild(nodeToRemove);
|
||||
document.body.offsetTop;
|
||||
|
||||
var newNode = document.createElement("p");
|
||||
newNode.classList.add("phase" + callCount);
|
||||
nodeParent.appendChild(newNode);
|
||||
|
||||
if (callCount == 3) {
|
||||
setResult("PASS");
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runScript() {
|
||||
if (window.testRunner) {
|
||||
testRunner.dumpAsText();
|
||||
testRunner.waitUntilDone();
|
||||
|
||||
var boxLocation = document.querySelector("#region").getBoundingClientRect();
|
||||
eventSender.mouseMoveTo(boxLocation.left + 40, boxLocation.top + 50);
|
||||
eventSender.mouseDown();
|
||||
eventSender.mouseUp();
|
||||
|
||||
eventSender.mouseMoveTo(boxLocation.left + boxLocation.width - 40, boxLocation.top + boxLocation.height - 40);
|
||||
eventSender.mouseDown();
|
||||
eventSender.mouseUp();
|
||||
}
|
||||
}
|
||||
|
||||
events.forEach(function(item, index) {
|
||||
target.addEventListener(item.name, handlerForEvent(item, index));
|
||||
});
|
||||
|
||||
runScript();
|
||||
</script>
|
||||
|
||||
</body></html>
|
Loading…
Add table
Add a link
Reference in a new issue