mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +01:00
Update web-platform-tests to revision 06f77f6bfaa86f3643a79f1ec2c49c6b6955cf18
This commit is contained in:
parent
1981efcc35
commit
c6c4fb2f7a
108 changed files with 2090 additions and 138 deletions
|
@ -31,6 +31,13 @@ function checkModification(e, funcName, args, expectedRes, before, after,
|
|||
}
|
||||
setClass(e, before);
|
||||
|
||||
var obs;
|
||||
// If we have MutationObservers available, do some checks to make
|
||||
// sure attribute sets are happening at sane times.
|
||||
if (self.MutationObserver) {
|
||||
obs = new MutationObserver(() => {});
|
||||
obs.observe(e, { attributes: true });
|
||||
}
|
||||
if (shouldThrow) {
|
||||
assert_throws(expectedException, function() {
|
||||
var list = e.classList;
|
||||
|
@ -40,6 +47,21 @@ function checkModification(e, funcName, args, expectedRes, before, after,
|
|||
var list = e.classList;
|
||||
var res = list[funcName].apply(list, args);
|
||||
}
|
||||
if (obs) {
|
||||
var mutationRecords = obs.takeRecords();
|
||||
obs.disconnect();
|
||||
if (shouldThrow) {
|
||||
assert_equals(mutationRecords.length, 0,
|
||||
"There should have been no mutation");
|
||||
} else if (funcName == "replace") {
|
||||
assert_equals(mutationRecords.length == 1,
|
||||
expectedRes,
|
||||
"Should have a mutation exactly when replace() returns true");
|
||||
} else {
|
||||
// For other functions, would need to check when exactly
|
||||
// mutations are supposed to happen.
|
||||
}
|
||||
}
|
||||
if (!shouldThrow) {
|
||||
assert_equals(res, expectedRes, "wrong return value");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue