Update web-platform-tests to revision 06f77f6bfaa86f3643a79f1ec2c49c6b6955cf18

This commit is contained in:
WPT Sync Bot 2018-03-26 21:10:36 -04:00
parent 1981efcc35
commit c6c4fb2f7a
108 changed files with 2090 additions and 138 deletions

View file

@ -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");
}