mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Update web-platform-tests to revision a3dd2ad02c65588ad280ceac378d82e9250d1045
This commit is contained in:
parent
e26530341b
commit
15e68ad3d3
171 changed files with 2819 additions and 1841 deletions
|
@ -135,6 +135,32 @@
|
|||
}, `Element with smooth scroll-behavior ; ${scrollFunction}() with smooth behavior`);
|
||||
});
|
||||
|
||||
[{scrollAttribute: "scrollLeft", scrollValue: elementToRevealLeft}, {scrollAttribute: "scrollTop", scrollValue: elementToRevealTop}].forEach((attributeTest) => {
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "autoBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_equals( scrollingElement[attributeTest.scrollAttribute], expectedValue, "Should set scroll attribute immediately");
|
||||
return new Promise((resolve) => { resolve(); });
|
||||
}, `Set ${attributeTest.scrollAttribute} to element with auto scroll-behavior`);
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_less_than(scrollingElement[attributeTest.scrollAttribute], expectedValue, "Shouldn't set scroll attribute immediately");
|
||||
return waitForScrollEnd(scrollingElement).then(() => {
|
||||
assert_equals(scrollingElement[attributeTest.scrollAttribute], expectedValue, "Final value of scroll attribute");
|
||||
});
|
||||
}, `Set ${attributeTest.scrollAttribute} to element with smooth scroll-behavior`);
|
||||
});
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
|
|
|
@ -140,6 +140,32 @@
|
|||
}, `Main frame with smooth scroll-behavior ; ${scrollFunction}() with smooth behavior`);
|
||||
});
|
||||
|
||||
[{scrollAttribute: "scrollLeft", scrollValue: elementToRevealLeft}, {scrollAttribute: "scrollTop", scrollValue: elementToRevealTop}].forEach((attributeTest) => {
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "autoBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_equals( scrollingElement[attributeTest.scrollAttribute], expectedValue, "Should set scroll attribute immediately");
|
||||
return new Promise((resolve) => { resolve(); });
|
||||
}, `Set ${attributeTest.scrollAttribute} to frame with auto scroll-behavior`);
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_less_than(scrollingElement[attributeTest.scrollAttribute], expectedValue, "Shouldn't set scroll attribute immediately");
|
||||
return waitForScrollEnd(scrollingElement).then(() => {
|
||||
assert_equals(scrollingElement[attributeTest.scrollAttribute], expectedValue, "Final value of scroll attribute");
|
||||
});
|
||||
}, `Set ${attributeTest.scrollAttribute} to frame with smooth scroll-behavior`);
|
||||
});
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
|
|
|
@ -62,6 +62,34 @@
|
|||
});
|
||||
});
|
||||
|
||||
[{scrollAttribute: "scrollLeft", scrollValue: 500}, {scrollAttribute: "scrollTop", scrollValue: 250}].forEach(function(scrollTest) {
|
||||
var initialPosition = Number(scrollTest.scrollValue) * 2;
|
||||
[0, initialPosition].forEach((initial) => {
|
||||
promise_test(() => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
scrollNode(overflowNode, "scroll", "instant", initial, initial);
|
||||
var oldValue = overflowNode[scrollTest.scrollAttribute];
|
||||
assert_equals(oldValue, initial, `${scrollTest.scrollAttribute} should be at initial position`);
|
||||
var expectedValue = Number(scrollTest.scrollValue);
|
||||
overflowNode[scrollTest.scrollAttribute] = expectedValue;
|
||||
observeScrolling(overflowNode, function(done) {
|
||||
try {
|
||||
var newValue = overflowNode[scrollTest.scrollAttribute];
|
||||
assert_less_than_equal(Math.abs(expectedValue - newValue), Math.abs(expectedValue - oldValue), "Scroll position should move towards the final position");
|
||||
if (done)
|
||||
assert_equals(newValue, expectedValue, `${scrollTest.scrollAttribute} should reach final position`);
|
||||
oldValue = newValue;
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
}
|
||||
if (done)
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}, `Scroll positions when performing smooth scrolling from ${initial} to ${scrollTest.scrollValue} by setting ${scrollTest.scrollAttribute} `);
|
||||
});
|
||||
});
|
||||
|
||||
promise_test(() => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
resetScroll(overflowNode);
|
||||
|
|
|
@ -141,6 +141,32 @@
|
|||
}, `Subframe with smooth scroll-behavior ; ${scrollFunction}() with smooth behavior`);
|
||||
});
|
||||
|
||||
[{scrollAttribute: "scrollLeft", scrollValue: elementToRevealLeft}, {scrollAttribute: "scrollTop", scrollValue: elementToRevealTop}].forEach((attributeTest) => {
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "autoBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_equals(scrollingElement[attributeTest.scrollAttribute], expectedValue, `Should set ${attributeTest.scrollAttribute} immediately`);
|
||||
return new Promise((resolve) => { resolve(); });
|
||||
}, `Subframe setting ${attributeTest.scrollAttribute} with auto scroll-behavior`);
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
assert_equals(scrollingElement.scrollLeft, 0);
|
||||
assert_equals(scrollingElement.scrollTop, 0);
|
||||
var expectedValue = Number(attributeTest.scrollValue);
|
||||
scrollingElement[attributeTest.scrollAttribute] = expectedValue;
|
||||
assert_less_than(scrollingElement[attributeTest.scrollAttribute], expectedValue, `Should not set ${attributeTest.scrollAttribute} immediately`);
|
||||
return waitForScrollEnd(scrollingElement).then(() => {
|
||||
assert_equals(scrollingElement[attributeTest.scrollAttribute], expectedValue, `Final value of ${attributeTest.scrollAttribute}`);
|
||||
});
|
||||
}, `Subframe setting ${attributeTest.scrollAttribute} with smooth scroll-behavior`);
|
||||
});
|
||||
|
||||
promise_test(() => {
|
||||
resetScroll(scrollingElement);
|
||||
setScrollBehavior(styledElement, "smoothBehavior");
|
||||
|
@ -164,7 +190,7 @@
|
|||
return waitForScrollEnd(scrollingElement).then(() => {
|
||||
assert_equals(scrollingElement.scrollLeft, 0, "Final value of scrollLeft");
|
||||
assert_equals(scrollingElement.scrollTop, 0, "Final value of scrollTop");
|
||||
});
|
||||
}, "Aborting an ongoing smooth scrolling on a subframe with an instant scrolling");
|
||||
});
|
||||
}, "Aborting an ongoing smooth scrolling on a subframe with an instant scrolling");
|
||||
}));
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue